[svn:parrot] r46960 - trunk/compilers/opsc/src/Ops/Compiler
bacek at svn.parrot.org
bacek at svn.parrot.org
Mon May 24 12:06:26 UTC 2010
Author: bacek
Date: Mon May 24 12:06:25 2010
New Revision: 46960
URL: https://trac.parrot.org/parrot/changeset/46960
Log:
Speed up opsc grammar more by using more specific tokens instead of "catch-them-all" <alnum>|<punct>
Modified:
trunk/compilers/opsc/src/Ops/Compiler/Grammar.pm
Modified: trunk/compilers/opsc/src/Ops/Compiler/Grammar.pm
==============================================================================
--- trunk/compilers/opsc/src/Ops/Compiler/Grammar.pm Mon May 24 12:06:11 2010 (r46959)
+++ trunk/compilers/opsc/src/Ops/Compiler/Grammar.pm Mon May 24 12:06:25 2010 (r46960)
@@ -93,10 +93,25 @@
[
|| <.ws> <macro_param> <.ws>
|| <.ws> <op_macro> <.ws>
- || $<word>=[ [<alnum>+|<punct>]? <ws> ]
+ || <word>
]
}
+token word {
+ || <quote>
+ || <ident>
+ || <raw_word> <ws>
+ || <ws>
+}
+
+token raw_word {
+ <alnum>|<punct>
+}
+
+proto token quote { <...> }
+token quote:sym<apos> { <?[']> <quote_EXPR: ':q'> }
+token quote:sym<dblq> { <?["]> <quote_EXPR: ':q'> }
+
token macro_param {
'$' $<num>=<[1..9]> # Up to nine params.
}
More information about the parrot-commits
mailing list