Skip to content

Commit

Permalink
[builtin] Builtin -- syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Sep 5, 2023
1 parent be82189 commit acb8b4f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[builtin] `Builtin` -- syntax
[builtin] add `@` as prefix to all builtins
[builtin] remove `isPrivate` from Definition

Expand Down
1 change: 1 addition & 0 deletions src/lang/syntax/grammars/word.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const word = {
$grammar: {
"word:call": [{ name: "variable_name" }],
"word:builtin": ['"@"', { name: "variable_name" }],
"word:local": ['"$"', { name: "variable_name" }],
"word:port_push": [
'"("',
Expand Down
6 changes: 6 additions & 0 deletions src/lang/syntax/matchers/word_matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export function word_matcher(tree: pt.Tree): Word {
name: pt.str(name),
span,
}),
"word:builtin": ({ name }, { span }) => ({
"@type": "Word",
"@kind": "Builtin",
name: pt.str(name),
span,
}),
"word:local": ({ name }, { span }) => ({
"@type": "Word",
"@kind": "Local",
Expand Down

0 comments on commit acb8b4f

Please sign in to comment.