diff --git a/TODO.md b/TODO.md index 9c853b30..dafc5ace 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ -[builtin] `Builtin` -- syntax [builtin] add `@` as prefix to all builtins [builtin] remove `isPrivate` from Definition diff --git a/src/lang/syntax/grammars/word.ts b/src/lang/syntax/grammars/word.ts index 2b72460d..422c5b56 100644 --- a/src/lang/syntax/grammars/word.ts +++ b/src/lang/syntax/grammars/word.ts @@ -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": [ '"("', diff --git a/src/lang/syntax/matchers/word_matcher.ts b/src/lang/syntax/matchers/word_matcher.ts index 9e4fd6d9..3ed1bb6f 100644 --- a/src/lang/syntax/matchers/word_matcher.ts +++ b/src/lang/syntax/matchers/word_matcher.ts @@ -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",