Skip to content

Commit

Permalink
RakuAST: hyphenize module_name
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Oct 17, 2023
1 parent 34eda66 commit babd7a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/Raku/Actions.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {

# "no foo" can only mean a pragma at the moment
method statement-control:sym<no>($/) {
my str $name := ~$<module_name>;
my str $name := ~$<module-name>;
my $Pragma := Nodify('Pragma');
if $Pragma.IS-PRAGMA($name) {
my $ast := $<arglist><EXPR>
Expand All @@ -734,7 +734,7 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
}

method statement-control:sym<use>($/) {
my str $name := ~$<module_name>;
my str $name := ~$<module-name>;
my $Pragma := Nodify('Pragma');
my $ast;

Expand All @@ -749,11 +749,11 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
else {
$ast := $<arglist><EXPR>
?? Nodify('Statement', 'Use').new(
:module-name($<module_name>.ast),
:module-name($<module-name>.ast),
:argument($<arglist><EXPR>.ast)
)
!! Nodify('Statement', 'Use').new(
:module-name($<module_name>.ast)
:module-name($<module-name>.ast)
);
$ast.ensure-begin-performed($*R, $*CU.context);
for $ast.IMPL-UNWRAP-LIST($ast.categoricals) {
Expand All @@ -767,7 +767,7 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {

method statement-control:sym<need>($/) {
my @module-names;
for $<module_name> {
for $<module-name> {
@module-names.push: $_.ast;
}

Expand All @@ -780,11 +780,11 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
method statement-control:sym<import>($/) {
my $ast := $<arglist><EXPR>
?? Nodify('Statement', 'Import').new(
:module-name($<module_name>.ast),
:module-name($<module-name>.ast),
:argument($<arglist><EXPR>.ast)
)
!! Nodify('Statement', 'Import').new(
:module-name($<module_name>.ast)
:module-name($<module-name>.ast)
);
$ast.IMPL-CHECK($*R, $*CU.context, 1);
for $ast.IMPL-UNWRAP-LIST($ast.categoricals) {
Expand All @@ -798,7 +798,7 @@ class Raku::Actions is HLL::Actions does Raku::CommonActions {
method statement-control:sym<require>($/) {
#TODO non-trivial cases, args
self.attach: $/, Nodify('Statement', 'Require').new(
module-name => $<module_name>.ast,
module-name => $<module-name>.ast,
);
}

Expand Down
10 changes: 5 additions & 5 deletions src/Raku/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
token statement-control:sym<no> {
<.use-no>
<.ws>
<module_name=.longname> [ <.spacey> <arglist> ]?
<module-name=.longname> [ <.spacey> <arglist> ]?
<.ws>
}
Expand All @@ -1488,7 +1488,7 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
| <version>
{ $/.typed-panic: 'X::Language::TooLate', version => ~$<version> }
| <module_name=.longname>
| <module-name=.longname>
[ <.spacey> <arglist> <.cheat-heredoc>? ]?
]
<.ws>
Expand All @@ -1500,22 +1500,22 @@ grammar Raku::Grammar is HLL::Grammar does Raku::Common {
| <version>
<.sorry('In case of using pragma, use "use" instead (e.g., "use v6;", "use v6.c;").')>
| <module_name=.longname>
| <module-name=.longname>
]+ % ','
}
token statement-control:sym<import> {
:my $*IN-DECL := 'import';
<.use-import> <.ws>
<module_name=.longname>
<module-name=.longname>
[ <.spacey> <arglist> ]?
<.ws>
}
rule statement-control:sym<require> {
<.use-require>
[
| <module_name=.longname>
| <module-name=.longname>
| <file=.variable>
| <!sigil> <file=.term>
]
Expand Down

0 comments on commit babd7a4

Please sign in to comment.