Reviewers: marja,

Message:
Committed patchset #1 manually as r17758 (presubmit successful).

Description:
Experimental parser: more escaping

[email protected]

BUG=

Committed: https://code.google.com/p/v8/source/detail?r=17758

Please review this at https://codereview.chromium.org/59903027/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/parser

Affected files (+5, -4 lines):
  M src/lexer/lexer_py.re
  M tools/lexer_generator/regex_lexer.py
  M tools/lexer_generator/rule_lexer.py
  M tools/lexer_generator/rule_parser.py


Index: src/lexer/lexer_py.re
diff --git a/src/lexer/lexer_py.re b/src/lexer/lexer_py.re
index 4d03a129cdc78c555feff8e2ef757c6e2c64d1c1..317e24d6797b34789dd062d6bb48bd948907b0ae 100644
--- a/src/lexer/lexer_py.re
+++ b/src/lexer/lexer_py.re
@@ -194,7 +194,7 @@ catch_all <<continue>>

 <MultiLineComment>
 "*/"             <<skip>>
-/\*[^\057]/      <<continue>>
+/\*[^\/]/      <<continue>>
 line_terminator { PUSH_LINE_TERMINATOR(); } <<continue>>
 catch_all <<continue>>

Index: tools/lexer_generator/regex_lexer.py
diff --git a/tools/lexer_generator/regex_lexer.py b/tools/lexer_generator/regex_lexer.py index 9d1ef3610cb615698cf059afcba6d454cd06f6a7..262955fa585fee03237158ce497ca37c19cb5d9c 100644
--- a/tools/lexer_generator/regex_lexer.py
+++ b/tools/lexer_generator/regex_lexer.py
@@ -115,7 +115,7 @@ class RegexLexer:
     t.value = RegexLexer.__escaped_class_literals[t.value]
     return t

-  t_class_CLASS_LITERAL = r'[\w $_+\']'
+  t_class_CLASS_LITERAL = r'[\w $_+\'/]'

   def t_REPEAT_BEGIN(self, t):
     r'\{'
Index: tools/lexer_generator/rule_lexer.py
diff --git a/tools/lexer_generator/rule_lexer.py b/tools/lexer_generator/rule_lexer.py index e8a6207d4e0b79f85011764d71deaa9945ef7b56..0f5865afcb6f52410fa57f77916ac99b4d5ba8dc 100644
--- a/tools/lexer_generator/rule_lexer.py
+++ b/tools/lexer_generator/rule_lexer.py
@@ -80,7 +80,7 @@ class RuleLexer:
     return t

   t_STRING = r'"((\\("|\w|\\))|[^\\"])+"'
-  t_REGEX = r'/[^\/]+/'
+  t_REGEX = r'/(\\/|[^/])+/'
   t_CHARACTER_CLASS_REGEX = r'\[([^\]]|\\\])+\]'

   t_PLUS = r'\+'
Index: tools/lexer_generator/rule_parser.py
diff --git a/tools/lexer_generator/rule_parser.py b/tools/lexer_generator/rule_parser.py index d6468a027818490a7db88d076c306b45db22971e..2884e3dee552a2d32bd97ae090c70335b96efa55 100644
--- a/tools/lexer_generator/rule_parser.py
+++ b/tools/lexer_generator/rule_parser.py
@@ -169,7 +169,8 @@ class RuleParser:

   def p_regex(self, p):
     'regex : REGEX'
-    p[0] = RegexParser.parse(p[1][1:-1])
+    string = p[1][1:-1].replace("\\/", "/")
+    p[0] = RegexParser.parse(string)

   def p_regex_class(self, p):
     'regex_class : CHARACTER_CLASS_REGEX'


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to