Skip to content

Commit

Permalink
Get us able to parse module names with colonpairs in (don't do anythi…
Browse files Browse the repository at this point in the history
…ng with them for now though; this just brings us closer to STD.pm and lets us parse a spectest I want to be able to run).
  • Loading branch information
jnthn committed May 6, 2009
1 parent 871c1e3 commit 79eb819
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/parser/actions.pm
Expand Up @@ -1394,7 +1394,8 @@ method package_def($/, $key) {
# At block opening, unshift module name (fully qualified) onto @?NS; otherwise,
# shift it off.
if $key eq 'open' {
my $add := ~$<module_name>[0] eq '::' ?? '' !! ~$<module_name>[0];
my $add := ~$<module_name>[0]<longname><name> eq '::' ?? '' !!
(~$<module_name>[0]<longname><name> ~ ~$<module_name>[0]<role_params>);
my $fqname := +@?NS ?? @?NS[0] ~ '::' ~ $add !! $add;
@?NS.unshift($fqname);
return 0;
Expand All @@ -1409,8 +1410,8 @@ method package_def($/, $key) {

my $modulename;
my $is_anon := 0;
if $<module_name> && ~$<module_name>[0] ne '::' {
$modulename := ~$<module_name>[0];
if $<module_name> && ~$<module_name>[0]<longname><name> ne '::' {
$modulename := ~$<module_name>[0]<longname><name> ~ ~$<module_name>[0]<role_params>;
}
else {
$modulename := $block.unique('!ANON');
Expand Down
9 changes: 7 additions & 2 deletions src/parser/grammar.pg
Expand Up @@ -693,6 +693,7 @@ rule package_def {
{{
$P0 = match['module_name']
$P0 = $P0[0]
$P0 = $P0['longname']
$P0 = $P0['name']
$S0 = $P0.'text'()
match.'add_type'($S0)
Expand Down Expand Up @@ -830,8 +831,8 @@ token circumfix {
}

token module_name {
<name>
[
<longname>
$<role_params>=[
:dba('generic role')
<?{{
## ($+PKGDECL//'') eq 'role' (more like (@?PKGDECL[0]//'') eq 'role')
Expand All @@ -844,6 +845,10 @@ token module_name {
]?
}

token longname {
<name> <colonpair>*
}

token name {
| <identifier> <morename>*
| <morename>+
Expand Down

0 comments on commit 79eb819

Please sign in to comment.