Permalink
Browse files

Merge pge-pm branch with updated PGE into trunk.

* Class "PGE::Rule" is now "PGE::Regex".
* The "PGE::P6Rule" and "PGE::P5Regexp" compilers are now 
  "PGE::P6Regex" and "PGE::P5Regex".
* Updated the "pgc.pir" compiler for compiling grammars and rule sets,
  removed the outdated "rulec.pir" compiler.
* Removed the library/PGE/P6Grammar.pir file (use pgc.pir instead).
* Redesigned/rewrote/updated the "PGE::Glob" compiler.
* Improved PGE code generation capabilities and error handling.
* Added more PGE tests and subsystem tests.
* Patched other tools and languages to conform to new PGE interfaces:
  + [TGE]: adjusted PGE::Rule -> PGE::Regex, switched to call PGE::P6Regex
  + [Tcl]: adjusted PGE::P6Rule -> PGE::P6Regex
  + [APL]: adjusted PGE::Rule -> PGE::Regex, updated namespace issues
  + [m4]: adjusted PGE::P6Rule -> PGE::P6Regex
  + [punie]: Adjusted PGE::Rule -> PGE::Regex, switched to pgc.pir compiler
  + [pheme]: Adjusted PGE::Rule -> PGE::Regex
  + [perl6]: corrected error in <dot_comment> pattern
  + [perl6]: renamed *.pge and *.tge files to *.pg and *.tg



git-svn-id: https://svn.parrot.org/parrot/trunk@12442 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent f55e50f commit 9cbdcbc20332d35687a1fe5af498ed1f7dac50c0 @pmichaud pmichaud committed Apr 27, 2006
Showing with 3,354 additions and 3,191 deletions.
  1. +9 −11 MANIFEST
  2. +5 −4 compilers/pge/PGE.pir
  3. +27 −0 compilers/pge/PGE/CodeString.pir
  4. +1,049 −1,012 compilers/pge/PGE/Exp.pir
  5. +101 −57 compilers/pge/PGE/Match.pir
  6. +139 −44 compilers/pge/PGE/OPTable.pir
  7. +103 −98 compilers/pge/PGE/{P5Regexp.pir → P5Regex.pir}
  8. +1,278 −0 compilers/pge/PGE/P6Regex.pir
  9. +0 −1,018 compilers/pge/PGE/P6Rule.pir
  10. +53 −23 compilers/pge/PGE/{Rule.pir → Regex.pir}
  11. +4 −0 compilers/pge/PGE/builtins.pg
  12. +0 −6 compilers/pge/library.pge
  13. +183 −195 compilers/pge/pgc.pir
  14. +0 −217 compilers/pge/rulec.pir
  15. +2 −3 compilers/tge/TGE/Parser.pir
  16. +7 −7 config/gen/makefiles/perl6.in
  17. +13 −12 config/gen/makefiles/pge.in
  18. +1 −1 config/gen/makefiles/punie.in
  19. +3 −3 languages/APL/APL.pir
  20. +1 −1 languages/APL/config/root.in
  21. +2 −2 languages/APL/lib/APLFunctions.pir
  22. +0 −16 languages/APL/lib/PAST.pir
  23. +6 −5 languages/APL/lib/past2pir.tge
  24. +1 −1 languages/m4/src/input.pir
  25. +1 −1 languages/m4/t/regex/004_pge.t
  26. 0 languages/perl6/lib/{grammar_optok.pge → grammar_optok.pg}
  27. +1 −1 languages/perl6/lib/{grammar_rules.pge → grammar_rules.pg}
  28. 0 languages/perl6/lib/{grammar_sub.pge → grammar_sub.pg}
  29. +1 −1 languages/perl6/lib/parse.pir
  30. 0 languages/perl6/lib/{past2pir.tge → past2pir.tg}
  31. 0 languages/perl6/lib/{pge2past.tge → pge2past.tg}
  32. +1 −1 languages/perl6/perl6.pir
  33. +1 −1 languages/pheme/lib/PhemeGrammar.pir
  34. +2 −2 languages/punie/lib/PunieGrammar.pir
  35. +1 −1 languages/punie/punie.pir
  36. +3 −3 languages/tcl/runtime/builtin/namespace.pir
  37. +2 −2 lib/Parrot/Test/PGE.pm
  38. +286 −265 runtime/parrot/library/PGE/Glob.pir
  39. +3 −3 runtime/parrot/library/PGE/Hs.pir
  40. +0 −129 runtime/parrot/library/PGE/P6Grammar.pir
  41. +2 −3 runtime/parrot/library/PGE/Text.pir
  42. +1 −2 runtime/parrot/library/PGE/Util.pir
  43. +1 −1 runtime/parrot/library/Test/More.pir
  44. +24 −14 t/compilers/pge/03-optable.t
  45. +3 −3 t/compilers/pge/p5regexp/p5rx.t
  46. +4 −1 t/compilers/pge/p6rules/backtrack.t
  47. +7 −3 t/compilers/pge/p6rules/builtins.t
  48. +5 −1 t/compilers/pge/p6rules/capture.t
  49. +1 −1 t/compilers/pge/p6rules/context.t
  50. +2 −2 t/compilers/pge/p6rules/subrules.t
  51. +10 −12 t/compilers/pge/pge.t
  52. +5 −2 t/compilers/pge/pge_examples.t
View
@@ -71,19 +71,18 @@ compilers/imcc/symreg.c []
compilers/imcc/symreg.h []
compilers/imcc/unit.h []
compilers/pge/demo.pir []
-compilers/pge/library.pge []
-compilers/pge/rulec.pir []
compilers/pge/P6Rule.grammar []
compilers/pge/PGE.pir []
compilers/pge/README.pod []
compilers/pge/STATUS []
compilers/pge/pgc.pir []
+compilers/pge/PGE/builtins.pg []
compilers/pge/PGE/Exp.pir []
compilers/pge/PGE/Match.pir []
compilers/pge/PGE/OPTable.pir []
-compilers/pge/PGE/P5Regexp.pir []
-compilers/pge/PGE/P6Rule.pir []
-compilers/pge/PGE/Rule.pir []
+compilers/pge/PGE/P5Regex.pir []
+compilers/pge/PGE/P6Regex.pir []
+compilers/pge/PGE/Regex.pir []
compilers/pge/PGE/CodeString.pir []
compilers/tge/README []
compilers/tge/TGE.pir []
@@ -1526,13 +1525,13 @@ languages/perl6/t/00-parrot/05-var.t [perl6]
languages/perl6/t/00-parrot/04-op-cmp.t [perl6]
languages/perl6/lib/parse.pir [perl6]
languages/perl6/lib/PAST.pir [perl6]
-languages/perl6/lib/past2pir.tge [perl6]
languages/perl6/lib/builtins.pir [perl6]
-languages/perl6/lib/pge2past.tge [perl6]
+languages/perl6/lib/past2pir.tg [perl6]
+languages/perl6/lib/pge2past.tg [perl6]
languages/perl6/lib/main.pir [perl6]
-languages/perl6/lib/grammar_optok.pge [perl6]
-languages/perl6/lib/grammar_rules.pge [perl6]
-languages/perl6/lib/grammar_sub.pge [perl6]
+languages/perl6/lib/grammar_optok.pg [perl6]
+languages/perl6/lib/grammar_rules.pg [perl6]
+languages/perl6/lib/grammar_sub.pg [perl6]
languages/pheme/MANIFEST [pheme]
languages/pheme/TODO [pheme]
languages/pheme/pheme.pir [pheme]
@@ -1774,7 +1773,6 @@ runtime/parrot/library/PGE/Glob.pir [library]
runtime/parrot/library/PGE/Hs.pir [library]
runtime/parrot/library/PGE/Text.pir [library]
runtime/parrot/library/PGE/Util.pir [library]
-runtime/parrot/library/PGE/P6Grammar.pir [library]
runtime/parrot/library/SDL/App.pir [library]
runtime/parrot/library/SDL/Button.pir [library]
runtime/parrot/library/SDL/Color.pir [library]
@@ -15,8 +15,9 @@ unit, calling the subroutines marked with the C<:load> subpragma for each.
.include "compilers/pge/PGE/CodeString.pir"
.include "compilers/pge/PGE/Match.pir"
.include "compilers/pge/PGE/OPTable.pir"
+.include "compilers/pge/PGE/Regex.pir"
.include "compilers/pge/PGE/Exp.pir"
-.include "compilers/pge/PGE/P6Rule.pir"
-.include "compilers/pge/PGE/P5Regexp.pir"
-.include "compilers/pge/PGE/Rule.pir"
-.include "compilers/pge/PGE/Library.pir"
+.include "compilers/pge/PGE/P6Regex.pir"
+.include "compilers/pge/PGE/P5Regex.pir"
+.include "compilers/pge/PGE/builtins_gen.pir"
+
@@ -128,7 +128,10 @@ A newline is automatically added to the end of the fmt.
goto emit_loop
end:
self .= fmt
+ $S0 = substr fmt, -1, 1
+ if $S0 == "\n" goto end_1
self .= "\n"
+ end_1:
.return ()
.end
@@ -158,6 +161,30 @@ counting at 10 (so that the values 0..9 can be considered "safe").
.end
+=item C<escape(string str)>
+
+Returns an escaped value of C<str> suitable for including in PIR.
+If the string contains any non-ASCII characters, then it's
+prefixed with 'unicode:'.
+
+=cut
+
+.sub 'escape' :method
+ .param string str
+ str = escape str
+ str = concat '"', str
+ str = concat str, '"'
+ $I0 = index str, '\x'
+ if $I0 >= 0 goto unicode
+ $I0 = index str, '\u'
+ if $I0 >= 0 goto unicode
+ .return (str)
+ unicode:
+ str = concat 'unicode:', str
+ .return (str)
+.end
+
+
=back
=head1 AUTHOR
Oops, something went wrong.

0 comments on commit 9cbdcbc

Please sign in to comment.