Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Jan 6, 2024
1 parent 310b5b1 commit 3ee65e6
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 32 deletions.
3 changes: 1 addition & 2 deletions src/lexer/Lexer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { ParserOptions } from "../parser/index.js"
import { ParserConfig } from "../parser/index.js"
import { ParserConfig, type ParserOptions } from "../parser/index.js"
import { Token } from "../token/index.js"
import { Lexing } from "./Lexing.js"

Expand Down
3 changes: 1 addition & 2 deletions src/lexer/Lexing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { InternalError, ParsingError } from "../errors/index.js"
import { Lexer } from "../lexer/index.js"
import { Position } from "../position/index.js"
import { Span } from "../span/index.js"
import type { TokenKind } from "../token/index.js"
import { Token } from "../token/index.js"
import { Token, type TokenKind } from "../token/index.js"

export class Lexing implements Iterator<Token> {
position = Position.init()
Expand Down
9 changes: 3 additions & 6 deletions src/match/match.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { ParsingError } from "../errors/index.js"
import type { PatternExp } from "../pattern-exp/index.js"
import { evaluate } from "../pattern-exp/index.js"
import type { Pattern } from "../pattern/index.js"
import { formatPattern, matchPattern } from "../pattern/index.js"
import type { Sexp } from "../sexp/index.js"
import { formatSexp } from "../sexp/index.js"
import { evaluate, type PatternExp } from "../pattern-exp/index.js"
import { formatPattern, matchPattern, type Pattern } from "../pattern/index.js"
import { formatSexp, type Sexp } from "../sexp/index.js"
import { Span } from "../span/index.js"

export function matchSymbol(sexp: Sexp): string {
Expand Down
5 changes: 2 additions & 3 deletions src/parser/Parser.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { ParsingError } from "../errors/index.js"
import { Lexer } from "../lexer/index.js"
import type { ParserOptions } from "../parser/index.js"
import { ParserConfig } from "../parser/index.js"
import type { Sexp } from "../sexp/index.js"
import { ParserConfig, type ParserOptions } from "../parser/index.js"
import { type Sexp } from "../sexp/index.js"
import { Token } from "../token/index.js"
import { Parsing } from "./Parsing.js"

Expand Down
2 changes: 1 addition & 1 deletion src/parser/Parsing.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { InternalError, ParsingError } from "../errors/index.js"
import { Parser } from "../parser/index.js"
import { Position } from "../position/index.js"
import type { Sexp } from "../sexp/index.js"
import * as Sexps from "../sexp/index.js"
import { type Sexp } from "../sexp/index.js"
import { Span } from "../span/index.js"
import { Token } from "../token/index.js"

Expand Down
12 changes: 9 additions & 3 deletions src/parser/parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { expect, test } from "vitest"
import { ParsingError } from "../errors/index.js"
import { Parser } from "../parser/index.js"
import type { PatternExp } from "../pattern-exp/index.js"
import { cons, evaluate, list, str, v } from "../pattern-exp/index.js"
import {
cons,
evaluate,
list,
str,
v,
type PatternExp,
} from "../pattern-exp/index.js"
import { matchPatternOrFail } from "../pattern/index.js"
import type { Sexp } from "../sexp/index.js"
import { type Sexp } from "../sexp/index.js"

const parser = new Parser({
quotes: [
Expand Down
4 changes: 2 additions & 2 deletions src/pattern-exp/evaluate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { InternalError } from "../errors/index.js"
import type { PatternExp } from "../pattern-exp/index.js"
import type { Pattern } from "../pattern/index.js"
import { type PatternExp } from "../pattern-exp/index.js"
import * as Patterns from "../pattern/index.js"
import { type Pattern } from "../pattern/index.js"

export function evaluate(exp: PatternExp): Pattern {
if (typeof exp === "number") {
Expand Down
2 changes: 1 addition & 1 deletion src/pattern/Pattern.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ParsingError } from "../errors/index.js"
import type { Sexp } from "../sexp/index.js"
import { type Sexp } from "../sexp/index.js"
import { equal } from "../utils/equal.js"

export type Pattern = Var | Cons | Null | Num | Str | Sym
Expand Down
3 changes: 1 addition & 2 deletions src/pattern/formatPattern.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Pattern } from "../pattern/index.js"
import { unfoldFormatCons } from "../pattern/index.js"
import { unfoldFormatCons, type Pattern } from "../pattern/index.js"

export function formatPattern(pattern: Pattern): string {
switch (pattern.kind) {
Expand Down
4 changes: 2 additions & 2 deletions src/pattern/matchPattern.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ParsingError } from "../errors/index.js"
import type { Pattern } from "../pattern/index.js"
import type { Sexp } from "../sexp/index.js"
import { type Pattern } from "../pattern/index.js"
import { type Sexp } from "../sexp/index.js"
import { equal } from "../utils/equal.js"

export function matchPatternOrFail(
Expand Down
3 changes: 1 addition & 2 deletions src/pattern/unfoldFormatCons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Pattern } from "../pattern/index.js"
import { formatPattern } from "../pattern/index.js"
import { formatPattern, type Pattern } from "../pattern/index.js"

export function unfoldFormatCons(pattern: Pattern): {
heads: Array<string>
Expand Down
3 changes: 1 addition & 2 deletions src/sexp/formatSexp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Sexp } from "../sexp/index.js"
import { unfoldFormatCons } from "../sexp/index.js"
import { unfoldFormatCons, type Sexp } from "../sexp/index.js"

export function formatSexp(sexp: Sexp): string {
switch (sexp.kind) {
Expand Down
3 changes: 1 addition & 2 deletions src/sexp/unfoldFormatCons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Sexp } from "../sexp/index.js"
import { formatSexp } from "../sexp/index.js"
import { formatSexp, type Sexp } from "../sexp/index.js"

export function unfoldFormatCons(sexp: Sexp): {
heads: Array<string>
Expand Down
3 changes: 1 addition & 2 deletions src/span/Span.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Position } from "../position/index.js"
import type { ColorMode } from "../utils/color.js"
import { color } from "../utils/color.js"
import { color, type ColorMode } from "../utils/color.js"
import { intervalOverlap } from "../utils/interval.js"
import { isBrowser } from "../utils/isBrowser.js"

Expand Down

0 comments on commit 3ee65e6

Please sign in to comment.