]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix handling of _ and $ in Javascript names
authorChris Double <chris@bethia.(none)>
Wed, 18 Jun 2008 12:51:47 +0000 (00:51 +1200)
committerChris Double <chris@bethia.(none)>
Wed, 18 Jun 2008 12:51:47 +0000 (00:51 +1200)
extra/peg/javascript/tokenizer/tokenizer.factor

index d62bb9395bf5185efbad0d37062735c39e9dffda..420abff442497b94c7c10e0bb6318c2415157c69 100644 (file)
@@ -6,6 +6,8 @@ IN: peg.javascript.tokenizer
 #! Grammar for JavaScript. Based on OMeta-JS example from:
 #! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler 
 
+USE: prettyprint
+
 EBNF: tokenizer 
 Letter            = [a-zA-Z]
 Digit             = [0-9]
@@ -14,7 +16,7 @@ SingleLineComment = "//" (!("\n") .)* "\n" => [[ ignore ]]
 MultiLineComment  = "/*" (!("*/") .)* "*/" => [[ ignore ]]
 Space             = " " | "\t" | "\r" | "\n" | SingleLineComment | MultiLineComment
 Spaces            = Space* => [[ ignore ]]
-NameFirst         = Letter | "$" | "_"
+NameFirst         = Letter | "$" => [[ CHAR: $ ]] | "_" => [[ CHAR: _ ]]
 NameRest          = NameFirst | Digit
 iName             = NameFirst NameRest* => [[ first2 swap prefix >string ]]
 Keyword           =  ("break"