Author: tewk
Date: Thu Dec 11 16:03:43 2008
New Revision: 33816
Added:
trunk/languages/ecmascript/t/00-comments.t
Modified:
trunk/languages/ecmascript/src/parser/grammar.pg
Log:
[js] parses whitespace
Modified: trunk/languages/ecmascript/src/parser/grammar.pg
==============================================================================
--- trunk/languages/ecmascript/src/parser/grammar.pg (original)
+++ trunk/languages/ecmascript/src/parser/grammar.pg Thu Dec 11 16:03:43 2008
@@ -369,6 +369,23 @@
<keyword> | <future_reserved_word>
}
+token singlelinecomment { '//' \N* } # end of line comment like Unix shell
and C++
+
+token multilinecomment { '/*' .*? '*/' } # C-like multiline comment
+
+token ws_all {
+ | \h
+ | \v
+ | <singlelinecomment>
+ | <multilinecomment>
+}
+
+# whitespace rule used implicity by rules
+token ws {
+ | <!ww> <ws_all>+
+ | <ws_all>*
+}
+
#### whitespace
#token ws {
# | <.whitespace>
@@ -390,18 +407,19 @@
#token comment {
# <.singlelinecomment>
+# <.multilinecomment>
#}
## comments
-token multilinecomment {
- '/*' .*? '*/'
-}
+#token multilinecomment {
+# '/*' .*? '*/'
+#}
-token singlelinecomment {
- '//' \N* \n
-}
+#token singlelinecomment {
+# '//' \N* \n
+#}
rule expression {
<assignment_expression> [',' <assignment_expression>]*
Added: trunk/languages/ecmascript/t/00-comments.t
==============================================================================
--- (empty file)
+++ trunk/languages/ecmascript/t/00-comments.t Thu Dec 11 16:03:43 2008
@@ -0,0 +1,4 @@
+/* comment 1 */
+// comment 2
+print("1..1\n");
+print("ok 1\n");