Skip to content

Commit

Permalink
Always enclose namespace names in brackets for new pdd21 opcodes.
Browse files Browse the repository at this point in the history
This patch brings PGE up to this spec.

git-svn-id: https://svn.parrot.org/parrot/trunk@13559 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
Chip Salzenberg committed Jul 25, 2006
1 parent c4d6d5d commit a96d265
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
14 changes: 7 additions & 7 deletions compilers/pge/PGE/Exp.pir
Expand Up @@ -65,7 +65,7 @@ tree as a PIR code object that can be compiled.
.local pmc exp .local pmc exp
.local string explabel .local string explabel
exp = self exp = self
set_hll_global 'PGE::Exp', '$!group', exp set_hll_global ['PGE::Exp'], '$!group', exp
exp = exp.reduce(self) exp = exp.reduce(self)


## we don't need a coroutine if :ratchet is set ## we don't need a coroutine if :ratchet is set
Expand Down Expand Up @@ -565,11 +565,11 @@ tree as a PIR code object that can be compiled.
.local pmc group .local pmc group
## Temporarily store this group as the current group. Any ## Temporarily store this group as the current group. Any
## cut nodes we encounter will set a cutmark into this group. ## cut nodes we encounter will set a cutmark into this group.
group = get_hll_global 'PGE::Exp', '$!group' group = get_hll_global ['PGE::Exp'], '$!group'
set_hll_global 'PGE::Exp', '$!group', self set_hll_global ['PGE::Exp'], '$!group', self
exp = self[0] exp = self[0]
exp = exp.reduce(next) exp = exp.reduce(next)
set_hll_global 'PGE::Exp', '$!group', group set_hll_global ['PGE::Exp'], '$!group', group
$I0 = self['cutmark'] $I0 = self['cutmark']
if $I0 > 0 goto keep_group if $I0 > 0 goto keep_group
$I0 = self['iscapture'] $I0 = self['iscapture']
Expand Down Expand Up @@ -725,7 +725,7 @@ tree as a PIR code object that can be compiled.
%L: # grammar subrule %0::%1 %L: # grammar subrule %0::%1
(captob, $P9, $P9, $P0) = captscope.'newfrom'(pos, '%0') (captob, $P9, $P9, $P0) = captscope.'newfrom'(pos, '%0')
$P0 = pos $P0 = pos
$P0 = get_hll_global '%0', '%1' $P0 = get_hll_global ['%0'], '%1'
CODE CODE
goto subrule_match goto subrule_match


Expand Down Expand Up @@ -1107,7 +1107,7 @@ tree as a PIR code object that can be compiled.
## This node is cutting a group. We need to ## This node is cutting a group. We need to
## get the current group's cutmark, or set ## get the current group's cutmark, or set
## one if it doesn't already have one. ## one if it doesn't already have one.
group = get_hll_global 'PGE::Exp', '$!group' group = get_hll_global ['PGE::Exp'], '$!group'
cutmark = group['cutmark'] cutmark = group['cutmark']
if cutmark > 0 goto has_cutmark if cutmark > 0 goto has_cutmark
$P1 = new 'PGE::CodeString' $P1 = new 'PGE::CodeString'
Expand Down Expand Up @@ -1321,7 +1321,7 @@ tree as a PIR code object that can be compiled.
$S0 = concat %2, ':"' $S0 = concat %2, ':"'
$S1 = %3 $S1 = %3
$S0 .= $S1 $S0 .= $S1
$P0 = get_hll_global 'PGE::Match', '%!cache' $P0 = get_hll_global ['PGE::Match'], '%!cache'
$I0 = exists $P0[$S0] $I0 = exists $P0[$S0]
if $I0 goto %0_1 if $I0 goto %0_1
$P1 = compreg %2 $P1 = compreg %2
Expand Down
4 changes: 2 additions & 2 deletions compilers/pge/PGE/OPTable.pir
Expand Up @@ -93,7 +93,7 @@ Adds (or replaces) a syntactic category's defaults.
key = substr name, $I0 key = substr name, $I0


.local pmc sctable, token .local pmc sctable, token
sctable = get_hll_global "PGE::OPTable", "%!sctable" sctable = get_hll_global ["PGE::OPTable"], "%!sctable"
$I0 = exists sctable[syncat] $I0 = exists sctable[syncat]
if $I0 == 0 goto token_hash if $I0 == 0 goto token_hash
token = sctable[syncat] token = sctable[syncat]
Expand Down Expand Up @@ -273,7 +273,7 @@ Adds (or replaces) a syntactic category's defaults.
operstack = new .ResizablePMCArray operstack = new .ResizablePMCArray
termstack = new .ResizablePMCArray termstack = new .ResizablePMCArray


newfrom = get_hll_global "PGE::Match", "newfrom" newfrom = get_hll_global ["PGE::Match"], "newfrom"
(mob, target, mfrom, mpos) = newfrom(mob, 0) (mob, target, mfrom, mpos) = newfrom(mob, 0)
pos = mfrom pos = mfrom
lastpos = length target lastpos = length target
Expand Down
22 changes: 11 additions & 11 deletions compilers/pge/PGE/P5Regex.pir
Expand Up @@ -19,7 +19,7 @@
target = adverbs['target'] target = adverbs['target']


.local pmc match .local pmc match
$P0 = get_hll_global "PGE::Grammar", "p5regex" $P0 = get_hll_global ["PGE::Grammar"], "p5regex"
match = $P0(source) match = $P0(source)
if target != 'parse' goto check if target != 'parse' goto check
.return (match) .return (match)
Expand Down Expand Up @@ -60,7 +60,7 @@
.sub "p5regex" .sub "p5regex"
.param pmc mob .param pmc mob
.local pmc optable .local pmc optable
optable = get_hll_global "PGE::P5Regex", "$optable" optable = get_hll_global ["PGE::P5Regex"], "$optable"
$P0 = optable."parse"(mob) $P0 = optable."parse"(mob)
.return ($P0) .return ($P0)
.end .end
Expand All @@ -77,9 +77,9 @@


$I0 = find_type "PGE::OPTable" $I0 = find_type "PGE::OPTable"
optable = new $I0 optable = new $I0
set_hll_global "PGE::P5Regex", "$optable", optable set_hll_global ["PGE::P5Regex"], "$optable", optable


$P0 = get_hll_global "PGE::P5Regex", "parse_lit" $P0 = get_hll_global ["PGE::P5Regex"], "parse_lit"
optable.addtok("term:", "", "nows", $P0) optable.addtok("term:", "", "nows", $P0)
optable.addtok("term:\\b", "term:", "nows", "PGE::Exp::Anchor") optable.addtok("term:\\b", "term:", "nows", "PGE::Exp::Anchor")
optable.addtok("term:\\B", "term:", "nows", "PGE::Exp::Anchor") optable.addtok("term:\\B", "term:", "nows", "PGE::Exp::Anchor")
Expand All @@ -96,11 +96,11 @@
optable.addtok("circumfix:( )", "term:", "nows,nullterm", 'PGE::Exp::CGroup') optable.addtok("circumfix:( )", "term:", "nows,nullterm", 'PGE::Exp::CGroup')
optable.addtok("circumfix:(?: )", "term:", "nows,nullterm", 'PGE::Exp::Group') optable.addtok("circumfix:(?: )", "term:", "nows,nullterm", 'PGE::Exp::Group')
$P0 = get_hll_global "PGE::P5Regex", "parse_enumclass" $P0 = get_hll_global ["PGE::P5Regex"], "parse_enumclass"
optable.addtok("term:[", "", "nows", $P0) optable.addtok("term:[", "", "nows", $P0)
optable.addtok("term:.", "", "nows", $P0) optable.addtok("term:.", "", "nows", $P0)
$P0 = get_hll_global "PGE::P5Regex", "parse_quant" $P0 = get_hll_global ["PGE::P5Regex"], "parse_quant"
optable.addtok("postfix:*", "<term:", "left,nows", $P0) optable.addtok("postfix:*", "<term:", "left,nows", $P0)
optable.addtok("postfix:+", "postfix:*", "left,nows", $P0) optable.addtok("postfix:+", "postfix:*", "left,nows", $P0)
optable.addtok("postfix:?", "postfix:*", "left,nows", $P0) optable.addtok("postfix:?", "postfix:*", "left,nows", $P0)
Expand All @@ -112,7 +112,7 @@
optable.addtok("close:}", "<infix:|", "nows") # XXX: hack optable.addtok("close:}", "<infix:|", "nows") # XXX: hack
optable.addtok("close:]", "close:}", "nows") # XXX: hack optable.addtok("close:]", "close:}", "nows") # XXX: hack
$P0 = get_hll_global "PGE::P5Regex", "compile_p5regex" $P0 = get_hll_global ["PGE::P5Regex"], "compile_p5regex"
compreg "PGE::P5Regex", $P0 compreg "PGE::P5Regex", $P0
.end .end
Expand All @@ -124,7 +124,7 @@
.local int pos, lastpos .local int pos, lastpos
.local int litstart, litlen .local int litstart, litlen
.local string initchar .local string initchar
newfrom = get_hll_global "PGE::Match", "newfrom" newfrom = get_hll_global ["PGE::Match"], "newfrom"
(mob, target, $P0, $P1) = newfrom(mob, 0, "PGE::Exp::Literal") (mob, target, $P0, $P1) = newfrom(mob, 0, "PGE::Exp::Literal")
pos = $P0 pos = $P0
lastpos = length target lastpos = length target
Expand Down Expand Up @@ -174,7 +174,7 @@
.local pmc mfrom, mpos .local pmc mfrom, mpos
.local string key .local string key
key = mob['KEY'] key = mob['KEY']
$P0 = get_hll_global "PGE::Match", "newfrom" $P0 = get_hll_global ["PGE::Match"], "newfrom"
(mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::Quant") (mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::Quant")
pos = mfrom pos = mfrom
lastpos = length target lastpos = length target
Expand Down Expand Up @@ -230,7 +230,7 @@
.local string target .local string target
.local pmc mfrom, mpos .local pmc mfrom, mpos
.local int pos, lastpos .local int pos, lastpos
$P0 = get_hll_global "PGE::Match", "newfrom" $P0 = get_hll_global ["PGE::Match"], "newfrom"
(mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::CGroup") (mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::CGroup")
pos = mfrom pos = mfrom
inc pos inc pos
Expand All @@ -253,7 +253,7 @@
.local string charlist .local string charlist
.local string key .local string key
key = mob['KEY'] key = mob['KEY']
$P0 = get_hll_global "PGE::Match", "newfrom" $P0 = get_hll_global ["PGE::Match"], "newfrom"
(mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::EnumCharList") (mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::EnumCharList")
pos = mfrom pos = mfrom
if key == '.' goto dot if key == '.' goto dot
Expand Down
22 changes: 11 additions & 11 deletions compilers/pge/PGE/P6Regex.pir
Expand Up @@ -90,7 +90,7 @@ or the resulting PIR code (target='PIR').


parse: parse:
## Let's parse the source as a regex ## Let's parse the source as a regex
$P0 = get_hll_global 'PGE::Grammar', 'regex' $P0 = get_hll_global ['PGE::Grammar'], 'regex'
match = $P0(source, adverbs :flat :named) match = $P0(source, adverbs :flat :named)
if target != 'parse' goto check if target != 'parse' goto check
.return (match) .return (match)
Expand Down Expand Up @@ -160,8 +160,8 @@ parse valid Perl 6 regular expressions.
.local string stop .local string stop
.local pmc stopstack, optable, match .local pmc stopstack, optable, match


stopstack = get_hll_global 'PGE::P6Regex', '@!stopstack' stopstack = get_hll_global ['PGE::P6Regex'], '@!stopstack'
optable = get_hll_global 'PGE::P6Regex', '$optable' optable = get_hll_global ['PGE::P6Regex'], '$optable'


stop = adverbs['stop'] stop = adverbs['stop']
push stopstack, stop push stopstack, stop
Expand Down Expand Up @@ -274,13 +274,13 @@ needed for compiling regexes.
# Create and store closure preprocessors in %closure_pp # Create and store closure preprocessors in %closure_pp
$P0 = new .Hash $P0 = new .Hash
set_hll_global 'PGE::P6Regex', '%closure_pp', $P0 set_hll_global ['PGE::P6Regex'], '%closure_pp', $P0
$P1 = get_hll_global 'PGE::P6Regex', 'PIR_closure' $P1 = get_hll_global ['PGE::P6Regex'], 'PIR_closure'
$P0["PIR"] = $P1 $P0["PIR"] = $P1
# Create an array for holding stop tokens # Create an array for holding stop tokens
$P0 = new .ResizablePMCArray $P0 = new .ResizablePMCArray
set_hll_global 'PGE::P6Regex', '@!stopstack', $P0 set_hll_global ['PGE::P6Regex'], '@!stopstack', $P0
$P0 = get_global 'compile_p6regex' $P0 = get_global 'compile_p6regex'
compreg 'PGE::P6Regex', $P0 compreg 'PGE::P6Regex', $P0
Expand Down Expand Up @@ -308,7 +308,7 @@ Return a failed match if the stoptoken is found.
lastpos = length target lastpos = length target
.local string stop .local string stop
$P0 = get_hll_global 'PGE::P6Regex', '@!stopstack' $P0 = get_hll_global ['PGE::P6Regex'], '@!stopstack'
stop = $P0[-1] stop = $P0[-1]
.local string initchar .local string initchar
Expand Down Expand Up @@ -588,7 +588,7 @@ anchors, and match subscripts.
.local int pos, lastpos .local int pos, lastpos
.local pmc newfrom, mfrom, mpos .local pmc newfrom, mfrom, mpos
.local string cname .local string cname
newfrom = get_hll_global 'PGE::Match', 'newfrom' newfrom = get_hll_global ['PGE::Match'], 'newfrom'
$P0 = getattribute mob, '$.target' $P0 = getattribute mob, '$.target'
target = $P0 target = $P0
$P0 = getattribute mob, '$.pos' $P0 = getattribute mob, '$.pos'
Expand Down Expand Up @@ -693,7 +693,7 @@ Parses a subrule token.
inc pos inc pos
mpos = pos mpos = pos
.local pmc regex .local pmc regex
regex = get_hll_global 'PGE::Grammar', 'regex' regex = get_hll_global ['PGE::Grammar'], 'regex'
$P1 = regex(mob, 'stop'=>'>') $P1 = regex(mob, 'stop'=>'>')
unless $P1 goto end unless $P1 goto end
$S0 = $P1 $S0 = $P1
Expand Down Expand Up @@ -892,7 +892,7 @@ Parse a modifier.
.local string target .local string target
.local pmc mfrom, mpos .local pmc mfrom, mpos
.local int pos, len .local int pos, len
$P0 = get_hll_global "PGE::Match", "newfrom" $P0 = get_hll_global ["PGE::Match"], "newfrom"
(mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::Closure") (mob, target, mfrom, mpos) = $P0(mob, 0, "PGE::Exp::Closure")
pos = mfrom pos = mfrom
len = 2 len = 2
Expand Down Expand Up @@ -1331,7 +1331,7 @@ Parse a modifier.
lang = pad['lang'] lang = pad['lang']
self['lang'] = lang self['lang'] = lang
# see if we need to do any pre-processing of the closure # see if we need to do any pre-processing of the closure
closure_pp = get_hll_global 'PGE::P6Regex', '%closure_pp' closure_pp = get_hll_global ['PGE::P6Regex'], '%closure_pp'
$I0 = defined closure_pp[lang] $I0 = defined closure_pp[lang]
if $I0 == 0 goto end if $I0 == 0 goto end
closure_fn = closure_pp[lang] closure_fn = closure_pp[lang]
Expand Down

0 comments on commit a96d265

Please sign in to comment.