Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: src/lexer/lexer_py.re

Issue 69293005: Experimental parser: add catch all rule (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/lexer_generator/automata_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 the V8 project authors. All rights reserved. 1 # Copyright 2013 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 /\\u[0-9a-fA-F]{4}/ { 156 /\\u[0-9a-fA-F]{4}/ {
157 if (V8_UNLIKELY(!ValidIdentifierStart())) { 157 if (V8_UNLIKELY(!ValidIdentifierStart())) {
158 PUSH_TOKEN(ILLEGAL); 158 PUSH_TOKEN(ILLEGAL);
159 } 159 }
160 } <<Identifier>> 160 } <<Identifier>>
161 161
162 eof <<terminate>> 162 eof <<terminate>>
163 default_action { PUSH_TOKEN(ILLEGAL); } 163 default_action { PUSH_TOKEN(ILLEGAL); }
164 164
165 <DoubleQuoteString> 165 <DoubleQuoteString>
166 "\\" <<continue>>
167 "\\\"" <<continue>>
168 "\"" { PUSH_TOKEN(STRING); }
169 /\\\n\r?/ <<continue>> 166 /\\\n\r?/ <<continue>>
170 /\\\r\n?/ <<continue>> 167 /\\\r\n?/ <<continue>>
171 /\n|\r/ { PUSH_TOKEN(ILLEGAL); } 168 /\\./ <<continue>>
169 /\n|\r/ { PUSH_TOKEN(ILLEGAL); }
170 "\"" { PUSH_TOKEN(STRING); }
172 eof <<terminate_illegal>> 171 eof <<terminate_illegal>>
173 /./ <<continue>> 172 catch_all <<continue>>
174 173
175 <SingleQuoteString> 174 <SingleQuoteString>
176 "\\" <<continue>>
177 "\\'" <<continue>>
178 "'" { PUSH_TOKEN(STRING); }
179 /\\\n\r?/ <<continue>> 175 /\\\n\r?/ <<continue>>
180 /\\\r\n?/ <<continue>> 176 /\\\r\n?/ <<continue>>
181 /\n|\r/ { PUSH_TOKEN(ILLEGAL); } 177 /\\./ <<continue>>
178 /\n|\r/ { PUSH_TOKEN(ILLEGAL); }
179 "'" { PUSH_TOKEN(STRING); }
182 eof <<terminate_illegal>> 180 eof <<terminate_illegal>>
183 /./ <<continue>> 181 catch_all <<continue>>
184 182
185 <Identifier> 183 <Identifier>
186 identifier_char <<continue>> 184 identifier_char <<continue>>
187 /\\u[0-9a-fA-F]{4}/ { 185 /\\u[0-9a-fA-F]{4}/ {
188 if (V8_UNLIKELY(!ValidIdentifierStart())) { 186 if (V8_UNLIKELY(!ValidIdentifierStart())) {
189 PUSH_TOKEN(ILLEGAL); 187 PUSH_TOKEN(ILLEGAL);
190 } 188 }
191 } <<continue>> 189 } <<continue>>
192 default_action { PUSH_TOKEN(IDENTIFIER); } 190 default_action { PUSH_TOKEN(IDENTIFIER); }
193 191
194 <SingleLineComment> 192 <SingleLineComment>
195 line_terminator { PUSH_LINE_TERMINATOR(); } 193 line_terminator { PUSH_LINE_TERMINATOR(); }
196 eof <<terminate>> 194 eof <<terminate>>
197 /./ <<continue>> 195 catch_all <<continue>>
198 196
199 <MultiLineComment> 197 <MultiLineComment>
200 "*/" { SKIP(); } 198 "*/" { SKIP(); }
199 /\*./ <<continue>>
201 # need to force action 200 # need to force action
202 line_terminator+ { PUSH_LINE_TERMINATOR(); } <<continue>> 201 line_terminator+ { PUSH_LINE_TERMINATOR(); } <<continue>>
203 eof <<terminate>> 202 eof <<terminate>>
204 /./ <<continue>> 203 catch_all <<continue>>
205 204
206 <HtmlComment> 205 <HtmlComment>
207 "-->" { SKIP(); } 206 "-->" { SKIP(); }
207 /--./ <<continue>>
208 /-./ <<continue>>
marja 2013/11/12 08:45:02 Why are these two needed?
dcarney 2013/11/12 09:03:59 otherwise the string "<!-- --k" would produce an i
208 # need to force action 209 # need to force action
209 line_terminator+ { PUSH_LINE_TERMINATOR(); } <<continue>> 210 line_terminator+ { PUSH_LINE_TERMINATOR(); } <<continue>>
210 eof <<terminate>> 211 eof <<terminate>>
211 /./ <<continue>> 212 catch_all <<continue>>
OLDNEW
« no previous file with comments | « no previous file | tools/lexer_generator/automata_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698