Author: pmichaud
Date: Wed Nov 16 13:24:44 2005
New Revision: 10047
Modified:
trunk/compilers/pge/PGE/P6Rule.pir
trunk/compilers/pge/PGE/Rule.pir
trunk/compilers/pge/demo.pir
trunk/compilers/pge/mklib.pir
trunk/examples/pge/all.pir
trunk/examples/pge/p6parse.pir
trunk/examples/pge/simple.pir
trunk/runtime/parrot/library/PGE/Glob.pir
trunk/runtime/parrot/library/PGE/Util.pir
Log:
Added compreg of "PGE::P6Rule" and "PGE::Glob".
Modified: trunk/compilers/pge/PGE/P6Rule.pir
==============================================================================
--- trunk/compilers/pge/PGE/P6Rule.pir (original)
+++ trunk/compilers/pge/PGE/P6Rule.pir Wed Nov 16 13:24:44 2005
@@ -83,6 +83,9 @@
$P0["h"] =
unicode:"\x09\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000"
$P0["n"] = unicode:"\x0a\x0d\x0c\x85\u2028\u2029"
# See http://www.unicode.org/Public/UNIDATA/PropList.txt for above
+
+ $P0 = find_global "PGE", "p6rule"
+ compreg "PGE::P6Rule", $P0
end:
.end
Modified: trunk/compilers/pge/PGE/Rule.pir
==============================================================================
--- trunk/compilers/pge/PGE/Rule.pir (original)
+++ trunk/compilers/pge/PGE/Rule.pir Wed Nov 16 13:24:44 2005
@@ -16,7 +16,6 @@ a number of built-in rules.
.sub "__onload" :load
.local pmc base
- .local pmc p6rule
$I0 = find_type "PGE::Rule"
if $I0 goto end
base = getclass "PGE::Match"
@@ -470,7 +469,7 @@ success.
rule = cache[pattern]
goto match
new_pattern:
- $P0 = find_global "PGE", "p6rule"
+ $P0 = compreg "PGE::P6Rule"
rule = $P0(pattern)
cache[pattern] = rule
match:
@@ -520,7 +519,7 @@ potentially very inefficient, but it "wo
rule = cache[pattern]
goto match
new_pattern:
- $P0 = find_global "PGE", "p6rule"
+ $P0 = compreg "PGE::P6Rule"
rule = $P0(pattern)
cache[pattern] = rule
match:
Modified: trunk/compilers/pge/demo.pir
==============================================================================
--- trunk/compilers/pge/demo.pir (original)
+++ trunk/compilers/pge/demo.pir Wed Nov 16 13:24:44 2005
@@ -18,8 +18,8 @@
load_bytecode "PGE/Glob.pir"
load_bytecode "PGE/Text.pir"
load_bytecode "PGE/Util.pir"
- find_global p6rule_compile, "PGE", "p6rule"
- find_global glob_compile, "PGE", "glob"
+ p6rule_compile = compreg "PGE::P6Rule"
+ glob_compile = compreg "PGE::Glob"
istrace = 0
null rulesub
Modified: trunk/compilers/pge/mklib.pir
==============================================================================
--- trunk/compilers/pge/mklib.pir (original)
+++ trunk/compilers/pge/mklib.pir Wed Nov 16 13:24:44 2005
@@ -13,9 +13,6 @@ file.
.sub "main" :main
.local pmc load
- .local pmc p6rule
- .local pmc gparse
- .local pmc stmt
.local string keyword
.local string name
.local string rulex
Modified: trunk/examples/pge/all.pir
==============================================================================
--- trunk/examples/pge/all.pir (original)
+++ trunk/examples/pge/all.pir Wed Nov 16 13:24:44 2005
@@ -17,7 +17,7 @@
"loadexpr"("Simple", "expr")
"loadexpr"("Perl6", "expr")
- p6rule = find_global "PGE", "p6rule"
+ p6rule = compreg "PGE::P6Rule"
cmdpat = p6rule("^(rule|next|trace|pir)\\s*(.*)$")
dumper = find_global "_dumper"
null istrace
Modified: trunk/examples/pge/p6parse.pir
==============================================================================
--- trunk/examples/pge/p6parse.pir (original)
+++ trunk/examples/pge/p6parse.pir Wed Nov 16 13:24:44 2005
@@ -3,7 +3,6 @@
.sub "__onload"
.local pmc optable
.local pmc term
- .local pmc p6rule
.local string op
$I0 = find_type "PGE::OPTable"
Modified: trunk/examples/pge/simple.pir
==============================================================================
--- trunk/examples/pge/simple.pir (original)
+++ trunk/examples/pge/simple.pir Wed Nov 16 13:24:44 2005
@@ -10,7 +10,7 @@
optable = new $I0
store_global "Simple", "$optable", optable
- p6rule = find_global "PGE", "p6rule"
+ p6rule = compreg "PGE::P6Rule"
term = p6rule("\\d+ | <ident>", "Simple", "term")
optable.addtok("infix:+")
Modified: trunk/runtime/parrot/library/PGE/Glob.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Glob.pir (original)
+++ trunk/runtime/parrot/library/PGE/Glob.pir Wed Nov 16 13:24:44 2005
@@ -15,6 +15,11 @@ A parser for shell-stype glob notation.
.const string STOPCHARS = ",*?{}[]" # XXX: should be part of context
.const int GLOB_INF = 2147483647 # XXX: arbitrary limit
+.sub "__onload" :load
+ $P0 = find_global "PGE", "glob"
+ compreg "PGE::Glob", $P0
+.end
+
=item C<new(STR class [, PMC exp1 [, PMC exp2]])>
Creates and returns a new C<Exp> object of C<class>, initializing
Modified: trunk/runtime/parrot/library/PGE/Util.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Util.pir (original)
+++ trunk/runtime/parrot/library/PGE/Util.pir Wed Nov 16 13:24:44 2005
@@ -34,7 +34,7 @@ is supplied, rules are loaded into the C
namespace = new String
namespace = "PGE::Rule"
code = new String
- p6rule = find_global "PGE", "p6rule"
+ p6rule = compreg "PGE::P6Rule"
parser = p6rule(":w ( (grammar) (\\w+[\\:\\:\\w+]*) ;? | (rule) (\\w+)
\\{(<-[}]>*)\\} ;? | (\\#)\\N*\\n )*")
match = parser(str)