Skip to content

Commit

Permalink
feat: replace eval.expr with eval.term
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Sep 22, 2024
1 parent b9e6a4f commit 17004a9
Show file tree
Hide file tree
Showing 15 changed files with 1,039 additions and 824 deletions.
4 changes: 3 additions & 1 deletion editors/vscode/src/lsp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);

const languageService = new CosmoLanguageService(documents);

const ENABLE_HOVER = false;

const offsetOf = (doc: TextDocument | undefined, pos: Position) =>
doc?.offsetAt(pos) ?? 0;

Expand Down Expand Up @@ -72,7 +74,7 @@ connection.onInitialize((params: InitializeParams) => {
completionProvider: {
resolveProvider: true,
},
hoverProvider: true,
hoverProvider: ENABLE_HOVER,
diagnosticProvider: {
interFileDependencies: false,
workspaceDiagnostics: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,236 +83,6 @@ Some(
)
),
ct = false
),
Match(lhs = Ident(name = "a"), rhs = Block(stmts = List())),
Match(
lhs = BinOp(op = "+", lhs = Ident(name = "a"), rhs = IntLit(value = 1)),
rhs = Block(stmts = List())
),
Match(
lhs = Select(lhs = Ident(name = "a"), rhs = Ident(name = "method"), ct = false),
rhs = Block(stmts = List())
),
Match(
lhs = Apply(
lhs = Select(lhs = Ident(name = "a"), rhs = Ident(name = "method"), ct = false),
rhs = List(),
ct = false
),
rhs = Block(stmts = List())
),
Match(
lhs = BinOp(op = "*", lhs = Ident(name = "a"), rhs = IntLit(value = 1)),
rhs = Block(stmts = List())
),
BinOp(
op = "=",
lhs = Ident(name = "a"),
rhs = Match(lhs = IntLit(value = 1), rhs = Block(stmts = List()))
),
BinOp(
op = "=",
lhs = Ident(name = "a"),
rhs = Match(lhs = Ident(name = "a"), rhs = Block(stmts = List()))
),
Match(
lhs = IntLit(value = 1),
rhs = CaseBlock(stmts = List(Case(cond = IntLit(value = 1), body = None)))
),
Match(
lhs = IntLit(value = 1),
rhs = CaseBlock(
stmts = List(
Case(cond = IntLit(value = 1), body = Some(value = IntLit(value = 2)))
)
)
),
Match(
lhs = IntLit(value = 1),
rhs = CaseBlock(
stmts = List(
Case(cond = BoolLit(value = false), body = Some(value = IntLit(value = 2)))
)
)
),
Match(
lhs = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = CaseBlock(
stmts = List(
Case(
cond = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
body = Some(value = IntLit(value = 2))
)
)
)
),
Match(
lhs = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = CaseBlock(
stmts = List(
Case(
cond = BinOp(
op = "+",
lhs = BinOp(op = "*", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = IntLit(value = 1)
),
body = Some(value = IntLit(value = 2))
)
)
)
),
Match(
lhs = IntLit(value = 1),
rhs = CaseBlock(
stmts = List(
Case(cond = Ident(name = "a"), body = Some(value = IntLit(value = 2)))
)
)
),
Match(
lhs = IntLit(value = 1),
rhs = CaseBlock(
stmts = List(
Case(cond = Ident(name = "a"), body = Some(value = IntLit(value = 2)))
)
)
),
Match(
lhs = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = CaseBlock(
stmts = List(
Case(
cond = BinOp(op = "+", lhs = IntLit(value = 1), rhs = Ident(name = "a")),
body = Some(value = IntLit(value = 2))
)
)
)
),
Match(
lhs = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = CaseBlock(
stmts = List(
Case(
cond = BinOp(
op = "+",
lhs = BinOp(op = "*", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = Ident(name = "a")
),
body = Some(value = IntLit(value = 2))
)
)
)
),
Match(
lhs = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = CaseBlock(
stmts = List(
Case(
cond = Ident(name = "a"),
body = Some(value = Block(stmts = List(IntLit(value = 2))))
)
)
)
),
Match(
lhs = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = CaseBlock(
stmts = List(
Case(
cond = Apply(
lhs = Select(lhs = Ident(name = "A"), rhs = Ident(name = "B"), ct = false),
rhs = List(),
ct = false
),
body = Some(value = Block(stmts = List(IntLit(value = 2))))
)
)
)
),
Match(
lhs = BinOp(op = "+", lhs = IntLit(value = 1), rhs = IntLit(value = 1)),
rhs = CaseBlock(
stmts = List(
Case(
cond = Apply(
lhs = Select(lhs = Ident(name = "A"), rhs = Ident(name = "B"), ct = false),
rhs = List(),
ct = false
),
body = Some(value = Block(stmts = List(IntLit(value = 2))))
)
)
)
),
Match(
lhs = Match(
lhs = IntLit(value = 1),
rhs = CaseBlock(
stmts = List(
Case(
cond = Ident(name = "a"),
body = Some(value = Block(stmts = List(IntLit(value = 2))))
)
)
)
),
rhs = CaseBlock(
stmts = List(
Case(
cond = Ident(name = "b"),
body = Some(value = Block(stmts = List(IntLit(value = 2))))
)
)
)
),
As(
lhs = Match(
lhs = IntLit(value = 1),
rhs = CaseBlock(
stmts = List(
Case(
cond = Ident(name = "a"),
body = Some(value = Block(stmts = List(IntLit(value = 2))))
)
)
)
),
rhs = Ident(name = "a")
),
Match(
lhs = As(lhs = IntLit(value = 1), rhs = Ident(name = "a")),
rhs = CaseBlock(
stmts = List(
Case(
cond = Ident(name = "a"),
body = Some(value = Block(stmts = List(IntLit(value = 2))))
)
)
)
),
Match(
lhs = As(lhs = IntLit(value = 1), rhs = Ident(name = "a")),
rhs = CaseBlock(stmts = List(Case(cond = Ident(name = "_"), body = None)))
),
Match(
lhs = As(lhs = IntLit(value = 1), rhs = Ident(name = "a")),
rhs = CaseBlock(stmts = List(Case(cond = Ident(name = "_"), body = None)))
),
Match(
lhs = As(lhs = IntLit(value = 1), rhs = Ident(name = "a")),
rhs = CaseBlock(
stmts = List(
Case(cond = Ident(name = "_"), body = Some(value = Ident(name = "a")))
)
)
),
Match(
lhs = As(lhs = IntLit(value = 1), rhs = Ident(name = "a")),
rhs = CaseBlock(
stmts = List(
Case(cond = Ident(name = "_"), body = Some(value = Ident(name = "a")))
)
)
)
)
)
Expand Down
Loading

0 comments on commit 17004a9

Please sign in to comment.