Permalink
Browse files

[PGE]:

* Switched "PGE::Regex" to be "PGE::Grammar", to be more accurate.
* Moved default rules from PGE::Regex into PGE::Match.
* Updated various languages and tools to match.


git-svn-id: https://svn.parrot.org/parrot/trunk@12610 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 2096998 commit 1c757c963931c429ec22db4683abc793f61bfa31 @pmichaud pmichaud committed May 11, 2006
@@ -1289,7 +1289,7 @@ tree as a PIR code object that can be compiled.
$S0 = concat %2, ':"'
$S1 = %3
$S0 .= $S1
- $P0 = find_global 'PGE::Regex', '%!cache'
+ $P0 = find_global 'PGE::Match', '%!cache'
$I0 = exists $P0[$S0]
if $I0 goto %0_1
$P1 = compreg %2
@@ -12,14 +12,14 @@
adverbs_1:
$I0 = exists adverbs['grammar']
if $I0 goto adverbs_2
- adverbs['grammar'] = 'PGE::Regex'
+ adverbs['grammar'] = 'PGE::Grammar'
adverbs_2:
.local string target
target = adverbs['target']
.local pmc match
- $P0 = find_global "PGE::Regex", "p5regex"
+ $P0 = find_global "PGE::Grammar", "p5regex"
match = $P0(source)
if target != 'parse' goto check
.return (match)
@@ -55,7 +55,7 @@
.end
-.namespace [ "PGE::Regex" ]
+.namespace [ "PGE::Grammar" ]
.sub "p5regex"
.param pmc mob
@@ -36,7 +36,7 @@ or the resulting PIR code (target='PIR').
adverbs['grammar'] = $S0
goto with_grammar
adverb_grammar_1:
- adverbs['grammar'] = 'PGE::Regex'
+ adverbs['grammar'] = 'PGE::Grammar'
with_grammar:
$I0 = exists adverbs['name']
if $I0 goto with_name
@@ -78,7 +78,7 @@ or the resulting PIR code (target='PIR').
parse:
## Let's parse the source as a regex
- $P0 = find_global 'PGE::Regex', 'regex'
+ $P0 = find_global 'PGE::Grammar', 'regex'
match = $P0(source)
if target != 'parse' goto check
.return (match)
@@ -119,7 +119,7 @@ or the resulting PIR code (target='PIR').
make_grammar:
$I0 = find_type grammar
if $I0 > 0 goto end
- $P0 = subclass 'PGE::Regex', grammar
+ $P0 = subclass 'PGE::Grammar', grammar
end:
.return ($P1)
.end
@@ -129,12 +129,12 @@ or the resulting PIR code (target='PIR').
Parses a regex according to Perl 6 regex syntax, and returns
the corresponding parse tree. This is installed as a C<< <regex> >>
-rule in C<PGE::Regex>, so one can call it from another regex to
+rule in C<PGE::Grammar>, so one can call it from another regex to
parse valid Perl 6 regular expressions.
=cut
-.namespace [ 'PGE::Regex' ]
+.namespace [ 'PGE::Grammar' ]
.sub 'regex'
.param pmc mob
@@ -639,7 +639,7 @@ Parses a subrule token.
inc pos
mpos = pos
.local pmc regex
- regex = find_global 'PGE::Regex', 'regex'
+ regex = find_global 'PGE::Grammar', 'regex'
$P1 = regex(mob)
unless $P1 goto end
$S0 = $P1
@@ -9,14 +9,14 @@ a number of built-in rules.
=cut
-.namespace [ 'PGE::Regex' ]
+.namespace [ 'PGE::Match' ]
.include 'cclass.pasm'
.include 'interpinfo.pasm'
.sub '__onload' :load
.local pmc base
- $P0 = subclass 'PGE::Match', 'PGE::Regex'
+ $P0 = subclass 'PGE::Match', 'PGE::Grammar'
$P0 = new .Hash
store_global '%!cache', $P0
.return ()
@@ -1,4 +1,4 @@
-grammar PGE::Regex;
+grammar PGE::Grammar;
token name { <ident> [ \:\: <ident> ]* }
View
@@ -236,14 +236,14 @@ OPTIONS
ns = iter[namespace]
$P0 = ns['rule']
rulepir .= $P0
- if namespace == 'PGE::Regex' goto ns_optable
+ if namespace == 'PGE::Grammar' goto ns_optable
if namespace == '' goto ns_optable
$S0 = initpir.unique('onload_')
initpir.emit(<<' CODE', namespace, $S0)
## namespace %0
$I0 = find_type '%0'
if $I0 != 0 goto %1
- $P0 = subclass 'PGE::Regex', '%0'
+ $P0 = subclass 'PGE::Grammar', '%0'
%1:
CODE
ns_optable:
@@ -15,7 +15,7 @@ TGE::Parser - parser for the grammar syntax of TGE
.local string classname
classname = 'TGE::Parser'
- $P1 = subclass 'PGE::Regex', classname
+ $P1 = subclass 'PGE::Grammar', classname
# Construct the grammar
.local pmc p6rule
View
@@ -176,7 +176,7 @@ executing program statements.
$P0()
$P0 = find_global 'APL', '__load_pirtable'
$P0()
- $P0 = subclass 'PGE::Regex', 'APL::Grammar'
+ $P0 = subclass 'PGE::Grammar', 'APL::Grammar'
load_bytecode 'dumper.pbc'
load_bytecode 'PGE/Dumper.pbc'
@@ -6,7 +6,7 @@
.local pmc pge_rule_class
.local pmc pheme_grammar_class
- pge_rule_class = getclass 'PGE::Regex'
+ pge_rule_class = getclass 'PGE::Grammar'
pheme_grammar_class = subclass pge_rule_class, 'PhemeGrammar'
.end
@@ -27,7 +27,7 @@ PunieGrammar -- A grammar for parsing Perl 1
=head1 DESCRIPTION
This is a grammar to parse Perl 1 programs. It inherits the behavior
-of the PGE::Regex class. It parses a string of source code according to
+of the PGE::Grammar class. It parses a string of source code according to
its hierarchy of rules and returns a PGE::Match object (a parse tree).
=cut
@@ -38,7 +38,7 @@ its hierarchy of rules and returns a PGE::Match object (a parse tree).
load_bytecode 'PGE.pbc'
load_bytecode 'PGE/Text.pbc'
- $P0 = getclass 'PGE::Regex'
+ $P0 = getclass 'PGE::Grammar'
$P1 = subclass $P0, 'PunieGrammar'
.local pmc optable
@@ -9,7 +9,7 @@ punie -- A compiler for Perl 1
=head1 DESCRIPTION
Punie is a compiler for Perl version 1, running on Parrot. Its parser is
-a PGE grammar (a subclass of PGE::Regex). The compilation is a series of
+a PGE grammar (a subclass of PGE::Grammar). The compilation is a series of
tree transformations using TGE: from match tree to abstract syntax tree
(AST), from AST to opcode syntax tree (OST), and finally from OST to
bytecode (actually to PIR, at first). For more on the ideas behind the
@@ -33,7 +33,7 @@ or the resulting PIR code (target='PIR').
target = adverbs['target']
.local pmc match
- $P0 = find_global 'PGE::Regex', 'glob'
+ $P0 = find_global 'PGE::Grammar', 'glob'
match = $P0(source)
if target != 'parse' goto check
.return (match)
@@ -106,13 +106,13 @@ or the resulting PIR code (target='PIR').
Parses a glob expression, returning the corresponding
parse C<PGE::Match> object. This is installed as a
-C<< <glob> >> subrule in C<PGE::Regex>, so one can call
+C<< <glob> >> subrule in C<PGE::Grammar>, so one can call
it from another regex in order to parse a valid glob
expression.
=cut
-.namespace [ 'PGE::Regex' ]
+.namespace [ 'PGE::Grammar' ]
.const int GLOB_INF = 2147483647
@@ -68,7 +68,7 @@ whole thing may be taken out or refactored away at any moment.
null rulesub
rulesub = p6rule_compile(pattern)
## leo XXX need namespace
- store_global "PGE::Regex", name, rulesub
+ store_global "PGE::Grammar", name, rulesub
.return (name)
.end
@@ -16,7 +16,7 @@ also.)
.sub "__onload" :load
.local pmc base
- $P0 = subclass 'PGE::Regex', 'PGE::Text'
+ $P0 = subclass 'PGE::Grammar', 'PGE::Text'
.end
=head2 Available rules
@@ -17,7 +17,7 @@ parsing tasks using PGE.
.sub "__onload" :load
.local pmc base
- $P0 = subclass 'PGE::Regex', 'PGE::Util'
+ $P0 = subclass 'PGE::Grammar', 'PGE::Util'
.return ()
.end
@@ -133,7 +133,7 @@ sub optable_output_is {
optable.newtok('postfix:--', 'equiv'=>'prefix:++')
.local pmc ident
- ident = find_global 'PGE::Regex', 'ident'
+ ident = find_global 'PGE::Match', 'ident'
optable.newtok('term:', 'tighter'=>'prefix:++', 'parsed'=>ident)
optable.newtok('circumfix:( )', 'equiv'=>'term:')
optable.newtok('circumfix:[ ]', 'equiv'=>'term:')
@@ -61,14 +61,14 @@ p6rule_isnt("0-900-04-41-59",
p6rule_is("ab",
[
[ alpha => '<[aeiou]>' ],
- [ _MASTER => '^ <alpha> <PGE::Regex::alpha>' ],
+ [ _MASTER => '^ <alpha> <PGE::Match::alpha>' ],
],
"named and lexical subrules");
#p6rule_isnt("ba",
# [
# [ alpha => '<[aeiou]>' ],
-# [ _MASTER => '^ <alpha> <PGE::Regex::alpha>' ],
+# [ _MASTER => '^ <alpha> <PGE::Match::alpha>' ],
# ],
# "named and lexical subrules");
View
@@ -42,10 +42,10 @@ my $ns_subs = {
'PGE' => [qw/ /],
'PGE::Exp' => [qw/ /],
'PGE::P6Regex' => [qw/ /],
- 'PGE::Regex' => [qw/ regex /], ## TODO deprecated
+ 'PGE::Grammar' => [qw/ regex /], ## TODO deprecated
},
'PGE/Regex.pir' => {
- 'PGE::Regex' => [qw/
+ 'PGE::Match' => [qw/
ident null fail upper lower alpha digit xdigit space
print graph blank cntrl punct alnum sp lt gt dot ws before
/],

0 comments on commit 1c757c9

Please sign in to comment.