Author: pmichaud
Date: Sat Mar 29 09:17:40 2008
New Revision: 26624
Modified:
trunk/languages/tcl/config/makefiles/root.in
trunk/languages/tcl/src/grammar/expr/expression.pg
Log:
[tcl]: RT#48028 changes
* Convert grammar to use Perl6Regex syntax instead of obsolete P6Regex.
* Change pgc to Perl6Grammar.
* 'make test' produces same results as before.
Modified: trunk/languages/tcl/config/makefiles/root.in
==============================================================================
--- trunk/languages/tcl/config/makefiles/root.in (original)
+++ trunk/languages/tcl/config/makefiles/root.in Sat Mar 29 09:17:40 2008
@@ -25,8 +25,8 @@
CC = @cc@
-PGE_DIR = ../../compilers/pge
TGE_DIR = ../../compilers/tge
+PERL6GRAMMAR = ../../runtime/parrot/library/PGE/Perl6Grammar.pbc
# can't use $(wildcard) and friends for PMCS, as these have to be in
# dependency order; with no duplicates.
@@ -95,7 +95,7 @@
$(PARROT) $(TGE_DIR)/tgc.pir --output=$@ $<
.pg.pir :
- $(PARROT) $(PGE_DIR)/pgc.pir --output=$@ $<
+ $(PARROT) $(PERL6GRAMMAR) --output=$@ $<
.pir.pbc :
$(PARROT) --output=$@ $<
Modified: trunk/languages/tcl/src/grammar/expr/expression.pg
==============================================================================
--- trunk/languages/tcl/src/grammar/expr/expression.pg (original)
+++ trunk/languages/tcl/src/grammar/expr/expression.pg Sat Mar 29 09:17:40 2008
@@ -8,18 +8,18 @@
token ws { \h* }
token program {
- | <[;\n\r\t\ ]>* <command> [ <?ws> <[\r\n;]> <?ws> <command>? ]*
- | $<empty>:=[^\s*$]
+ | <[;\n\r\t\ ]>* <command> [ <.ws> <[\r\n;]> <.ws> <command>? ]*
+ | $<empty>=[^\s*$]
}
token command {
- | \# \N*
- | [ $<word>:=( <expand>?
+ | '#' \N*
+ | [ $<word>=( <expand>?
[ <quoted_word> [ <before [<[;\n\r\t\ ]>|$]>
| <error: extra characters after close-quote> ]
| <braced_word> [ <before [<[;\n\r\t\ ]>|$]>
| <error: extra characters after close-brace> ]
- | $<chunk>:=( <substitution> | \$ | <-[[$\\;\n\r\t\ ]>+ )+
+ | $<chunk>=( <substitution> | '$' | <-[[$\\;\n\r\t\ ]>+ )+
]
) \h*
]+
@@ -32,37 +32,37 @@
}
token quoted_word {
- " $<chunk>:=( <substitution> | \$ | <-[[$\\"]>+ )* [ " | <error: missing
"> ]
+ '"' $<chunk>=( <substitution> | '$' | <-[[$\\"]>+ )* [ '"' | <error:
missing "> ]
}
token braced_word {
<PGE::Text::bracketed: {}>
- | \{ <error: missing close-brace>
+ | '{' <error: missing close-brace>
}
token command_substitution {
- \[ \]
- | \[ <[;\n\r\t\ ]>* <subcommand> [ <?ws> <[\r\n;]> <?ws> <subcommand>? ]* \]
- | \[ <error: missing close-bracket>
+ '[' ']'
+ | '[' <[;\n\r\t\ ]>* <subcommand> [ <.ws> <[\r\n;]> <.ws> <subcommand>? ]*
']'
+ | '[' <error: missing close-bracket>
}
token subcommand {
- | \# \N*
- | [ $<word>:=( <expand>?
+ | '#' \N*
+ | [ $<word>=( <expand>?
[ <quoted_word> [ <before [<[\];\n\r\t\ ]>|$]>
| <error: extra characters after close-quote> ]
| <braced_word> [ <before [<[\];\n\r\t\ ]>|$]>
| <error: extra characters after close-brace> ]
- | $<chunk>:=( <substitution> | \$ | <-[[$\]\\;\n\r\t\ ]>+ )+
+ | $<chunk>=( <substitution> | \$ | <-[[$\]\\;\n\r\t\ ]>+ )+
]
) \h*
]+
}
token variable_substitution {
- \$ [ \{ ( <-[}]>+ ) \}
- | ([\:\:]?<?name>) [ \( $<index>:=( <substitution> | \$ | <-[[$\\)]>+
)+ \) ]?
- ]
+ '$' [ '{' ( <-[}]>+ ) '}'
+ | ('::'?<.name>) [ '(' $<index>=( <substitution> | '$' | <-[[$\\)]>+
)+ ')' ]?
+ ]
}
token backslash_substitution {
@@ -74,7 +74,7 @@
}
token expand {
- \{\*\}<!before:\s>
+ '{*}'<!before:\s>
}
# this is so we can use these rules in [subst]
@@ -104,10 +104,10 @@
| no | n
| on
| off | of )
- <?wb>
+ <.wb>
}
-rule nested { \( <expression> \) }
+rule nested { '(' <expression> ')' }
token number { <scientific> | <float> | <integer> }
@@ -138,8 +138,8 @@
# XXX This should actually be a PIR rule so we can add more rules.
token mathfunc {
[ <nary_function> | <binary_function> | <unary_function> |
<nullary_function>
- | ( <[a..zA..Z]>\w* ) \( <unknown_math_function> ]
- \( [<expression> [, <expression>]*]? \)
+ | ( <[a..zA..Z]>\w* ) '(' <unknown_math_function> ]
+ '(' [<expression> [',' <expression>]*]? ')'
}
rule 'expression' is optable {...}