develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33816 - in trunk/languages/ecmascript: src/parser t

From:
tewk
Date:
December 11, 2008 16:03
Subject:
[svn:parrot] r33816 - in trunk/languages/ecmascript: src/parser t
Message ID:
20081212000344.16FF0CB9AF@x12.develooper.com
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");



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About