Author: coke
Date: Sun Jul 31 09:40:59 2005
New Revision: 8759
Modified:
trunk/languages/tcl/lib/tcl.p6r
Log:
work in progress
Modified: trunk/languages/tcl/lib/tcl.p6r
==============================================================================
--- trunk/languages/tcl/lib/tcl.p6r (original)
+++ trunk/languages/tcl/lib/tcl.p6r Sun Jul 31 09:40:59 2005
@@ -1,55 +1,45 @@
-rule command { \[ (.*?) \] };
-rule quotes { " ([\\.|<-["]>]*) : " };
-rule braces { \{ : ([\\.|<braces>|<-[\{\}]>]*) : \} }
-rule variable { \$ [
- (<[A..Za..z_0..9]>+) |
- (<[A..Za..z_0..9]>* \( <[A..Za..z_0..9]>* \)) |
- \{ (<-[\}]>*) \}
- ]
-};
-
-rule float { [<[0..9]>+|0+]\.<[0..9]>* };
-rule decimal { <[1..9]><[0..9]>*] };
-rule octal { 0<[0..7]>*: };
-rule hex { 0<[xX]><[0..9A..Fa..f]>+ };
-rule number { [<float> | <decimal> | <octal> | <hex> ] };
+grammar _TclRules;
-rule nullary_functions { rand };
+rule command { \[ (.*?) \] }
+rule quotes { " ([\\.|<-["]>]*) : " }
+
+rule float { [<[0..9]>+|0+]\.<[0..9]>* }
+rule decimal { <[1..9]><[0..9]>*] }
+rule octal { 0<[0..7]>*: }
+rule hex { 0<[xX]><[0..9A..Fa..f]>+ }
+rule number { [<float> | <decimal> | <octal> | <hex> ] }
+
+rule unaryop { <[\-+~!]> }
+
+rule expr {:w <logor> | <logor> \? <logor> : <logor> }
+rule logor {:w <logand> [ (\|\|) <logand> ]* }
+rule logand {:w <bitor> [ (&&) <bitor> ]* }
+rule bitor {:w <bitxor> [ (\|) <bitxor> ]* }
+rule bitxor {:w <bitand> [ (\^) <bitand> ]* }
+rule bitand {:w <listin> [ (&) <listin> ]* }
+rule listin {:w <streq> [ (in|ni) <streq> ]* }
+rule streq {:w <equals> [ (eq|ne) <equals> ]* }
+rule equals {:w <compare> [ (\==|\!=) <compare> ]* }
+rule compare {:w <shifted> [ (\<|\>|\<=|\>=) <shifted> ]* }
+rule shifted {:w <sum> [ (\<\<|\>\>) <sum> ]* }
+rule sum {:w <term> [ (<[+\-]>) <term> ]* }
+rule term {:w <power> [ (<[*/%]>) <power> ]* }
+rule power {:w <unary> [ (\*\*) <unary> ]* }
+rule unary {:w <unaryop>* <operand> }
+
+rule operand { <number> | \( <expr> \) | <function> | <command> | <quotes> }
+
+rule nullary_functions { rand }
rule unary_functions {
abs | acos | asin | atan | ceil | cosh? | double | exp | floor | int |
log | log10 | round | sinh? | sqrt | srand | tanh? | wide
-};
+}
-rule binary_functions { atan2 | fmod | hypot | pow };
+rule binary_functions { atan2 | fmod | hypot | pow }
rule function {
<nullary_functions> \( \) |
- <unary_functions> \( <factor> \) |
- <binary_functions> \( <factor> , <factor> \)
-};
-
-rule unaryop { <[\-+~!]> };
-
-rule factor { <unaryop>* [ <operand> | <power> | \( <factor> \) ]};
-
-rule power {:w <term> [ (\*\*) <term> ]* };
-rule term {:w <sum> [ (<[*/%]>) <sum> ]* };
-rule sum {:w <shifted> [ (<[+\-]>) <shifted> ]* };
-rule shifted {:w <compare> [ (\<\<|\>\>) <compare> ]* };
-rule compare {:w <equals> [ (\<|\>|\<=|\>=) <equals> ]* };
-rule equals {:w <streq> [ (\==|\!=) <streq> ]* };
-rule streq {:w <listin> [ (eq|ne) <listin> ]* };
-rule listin {:w <bitand> [ (in|ni) <bitand> ]* };
-rule bitand {:w <bitxor> [ (&) <bitxor> ]* };
-rule bitxor {:w <bitor> [ (\^) <bitor> ]* };
-rule bitor {:w <logand> [ (\|) <logand> ]* };
-rule logand {:w <logor> [ (&&) <logor> ]* };
-rule logor {:w <ternary> [ (\|\|) <ternary> ]* };
-
-rule ternary {:w <operand> | <operand> \? <any> : <operand> };
-
-rule operand { <number> | <function> | <command> | <quotes> | <braces> |
<variable> };
-
-rule expr { ^^ <factor> $$ };
-
+ <unary_functions> \( <expr> \) |
+ <binary_functions> \( <expr> , <expr> \)
+}