From bc3cc07a286b28bb6b54792fab12981833e0b15e Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Sun, 17 Sep 2023 16:21:48 +0200 Subject: [PATCH] RakuAST: ready grammar/actions for translation, Part 9 Instead of checking for literal strings such as "my" or "our", replace these by sub-classable tokens. Part 9 covers the scope- section as found in lib/RakuAST/Deparse/L10N/CORE.rakumod --- src/Raku/Grammar.nqp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Raku/Grammar.nqp b/src/Raku/Grammar.nqp index d583388a971..f6c454856fb 100644 --- a/src/Raku/Grammar.nqp +++ b/src/Raku/Grammar.nqp @@ -843,6 +843,17 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common { token routine-submethod { submethod } token routine-token { token } + token scope-anon { anon } + token scope-augment { augment } + token scope-constant { constant } + token scope-has { has } + token scope-HAS { HAS } + token scope-my { my } + token scope-our { our } + token scope-state { state } + token scope-supersede { supersede } + token scope-unit { unit } + #------------------------------------------------------------------------------- # Grammar entry point @@ -3191,17 +3202,16 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common { token leave-package-scope { } proto token scope-declarator {*} - token scope-declarator:sym { } - token scope-declarator:sym { } - token scope-declarator:sym { } - token scope-declarator:sym { } - token scope-declarator:sym { } - token scope-declarator:sym { } - token scope-declarator:sym { } - - token scope-declarator:sym { } + token scope-declarator:sym { <.scope-my> } + token scope-declarator:sym { <.scope-our> } + token scope-declarator:sym { <.scope-has> } + token scope-declarator:sym { <.scope-HAS> } + token scope-declarator:sym { <.scope-anon> } + token scope-declarator:sym { <.scope-state> } + token scope-declarator:sym { <.scope-unit> } + token scope-declarator:sym { <.scope-augment> } token scope-declarator:sym { - <.NYI: '"supersede"'> + <.scope-supersede> <.NYI: '"supersede"'> } token scoped($*SCOPE) {