Commit | Line | Data |
---|---|---|
bb051423 CY |
1 | ;;; semantic/wisent/js-wy.el --- Generated parser support file |
2 | ||
49f70d46 | 3 | ;; Copyright (C) 2005, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. |
76e47e3d | 4 | ;; Copyright (C) 1998-2012 Ecma International. |
bb051423 CY |
5 | |
6 | ;; This file is part of GNU Emacs. | |
7 | ||
8 | ;; GNU Emacs is free software: you can redistribute it and/or modify | |
9 | ;; it under the terms of the GNU General Public License as published by | |
10 | ;; the Free Software Foundation, either version 3 of the License, or | |
11 | ;; (at your option) any later version. | |
12 | ||
13 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ;; GNU General Public License for more details. | |
17 | ||
18 | ;; You should have received a copy of the GNU General Public License | |
19 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |
20 | ||
21 | ;;; Commentary: | |
22 | ;; | |
866b58d6 CY |
23 | ;; This file was generated from etc/grammars/js.wy. |
24 | ;; | |
25 | ;; It is derived from the grammar in the ECMAScript Language | |
26 | ;; Specification published at | |
27 | ;; | |
28 | ;; http://www.ecma-international.org/publications/standards/Ecma-262.htm | |
29 | ;; | |
30 | ;; and redistributed under the following license: | |
31 | ;; | |
32 | ;; Redistribution and use in source and binary forms, with or without | |
33 | ;; modification, are permitted provided that the following conditions | |
34 | ;; are met: | |
35 | ;; | |
36 | ;; 1. Redistributions of source code must retain the above copyright | |
37 | ;; notice, this list of conditions and the following disclaimer. | |
38 | ;; | |
39 | ;; 2. Redistributions in binary form must reproduce the above | |
40 | ;; copyright notice, this list of conditions and the following | |
41 | ;; disclaimer in the documentation and/or other materials provided | |
42 | ;; with the distribution. | |
43 | ;; | |
44 | ;; 3. Neither the name of the authors nor Ecma International may be | |
45 | ;; used to endorse or promote products derived from this software | |
46 | ;; without specific prior written permission. THIS SOFTWARE IS | |
47 | ;; PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR | |
48 | ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
49 | ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
50 | ;; ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR | |
51 | ;; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
52 | ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT | |
53 | ;; OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR | |
54 | ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
55 | ;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
56 | ;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |
57 | ;; USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | |
58 | ;; DAMAGE. | |
bb051423 CY |
59 | |
60 | ;;; Code: | |
61 | (require 'semantic/lex) | |
62 | \f | |
63 | ;;; Prologue | |
64 | ;; | |
65 | \f | |
66 | ;;; Declarations | |
67 | ;; | |
68 | (defconst wisent-javascript-jv-wy--keyword-table | |
69 | (semantic-lex-make-keyword-table | |
70 | '(("if" . IF) | |
71 | ("break" . BREAK) | |
72 | ("continue" . CONTINUE) | |
73 | ("else" . ELSE) | |
74 | ("for" . FOR) | |
75 | ("function" . FUNCTION) | |
76 | ("this" . THIS) | |
77 | ("return" . RETURN) | |
78 | ("while" . WHILE) | |
79 | ("void" . VOID_SYMBOL) | |
80 | ("new" . NEW) | |
81 | ("delete" . DELETE) | |
82 | ("var" . VAR) | |
83 | ("with" . WITH) | |
84 | ("typeof" . TYPEOF) | |
85 | ("in" . IN)) | |
86 | '(("in" summary "in something") | |
87 | ("typeof" summary "typeof ") | |
88 | ("with" summary "with ") | |
89 | ("var" summary "var <variablename> [= value];") | |
90 | ("delete" summary "delete(<objectreference>) - Deletes the object.") | |
91 | ("new" summary "new <objecttype> - Creates a new object.") | |
92 | ("void" summary "Method return type: void <name> ...") | |
93 | ("while" summary "while (<expr>) <stmt> | do <stmt> while (<expr>);") | |
94 | ("return" summary "return [<expr>] ;") | |
95 | ("this" summary "this") | |
96 | ("function" summary "function declaration blah blah") | |
97 | ("for" summary "for ([<init-expr>]; [<expr>]; [<update-expr>]) <stmt>") | |
98 | ("else" summary "if (<expr>) <stmt> else <stmt>") | |
99 | ("continue" summary "continue [<label>] ;") | |
100 | ("break" summary "break [<label>] ;") | |
101 | ("if" summary "if (<expr>) <stmt> [else <stmt>] (jv)"))) | |
102 | "Table of language keywords.") | |
103 | ||
104 | (defconst wisent-javascript-jv-wy--token-table | |
105 | (semantic-lex-make-type-table | |
106 | '(("<no-type>" | |
107 | (NULL_TOKEN) | |
108 | (QUERY) | |
109 | (TRUE) | |
110 | (FALSE)) | |
111 | ("number" | |
112 | (NUMBER)) | |
113 | ("string" | |
114 | (STRING)) | |
115 | ("symbol" | |
116 | (VARIABLE)) | |
117 | ("close-paren" | |
118 | (CLOSE_SQ_BRACKETS . "]") | |
119 | (END_BLOCK . "}") | |
120 | (CLOSE_PARENTHESIS . ")")) | |
121 | ("open-paren" | |
122 | (OPEN_SQ_BRACKETS . "[") | |
123 | (START_BLOCK . "{") | |
124 | (OPEN_PARENTHESIS . "(")) | |
125 | ("block" | |
126 | (BRACK_BLOCK . "(OPEN_SQ_BRACKETS CLOSE_SQ_BRACKETS)") | |
127 | (BRACE_BLOCK . "(START_BLOCK END_BLOCK)") | |
128 | (PAREN_BLOCK . "(OPEN_PARENTHESIS CLOSE_PARENTHESIS)")) | |
129 | ("punctuation" | |
130 | (ONES_COMPLIMENT . "~") | |
131 | (SEMICOLON . ";") | |
132 | (LINE_TERMINATOR . "\n") | |
133 | (LESS_THAN . "<") | |
134 | (DOT . ".") | |
135 | (COMMA . ",") | |
136 | (COLON . ":") | |
137 | (DIV . "/") | |
138 | (DECREMENT . "--") | |
139 | (INCREMENT . "++") | |
140 | (PLUS_EQUALS . "+=") | |
141 | (PLUS . "+") | |
142 | (MULTIPLY_EQUALS . "*=") | |
143 | (MULTIPLY . "*") | |
144 | (MOD_EQUALS . "%=") | |
145 | (MOD . "%") | |
146 | (MINUS_EQUALS . "-=") | |
147 | (MINUS . "-") | |
148 | (LS_EQUAL . "<=") | |
149 | (LOGICAL_NOT . "!!") | |
150 | (LOGICAL_OR . "||") | |
151 | (LOGICAL_AND . "&&") | |
152 | (GT_EQUAL . ">=") | |
153 | (GREATER_THAN . ">") | |
154 | (EQUALS . "==") | |
155 | (DIV_EQUALS . "/=") | |
156 | (NOT_EQUAL . "!=") | |
157 | (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=") | |
158 | (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>") | |
159 | (BITWISE_SHIFT_RIGHT_EQUALS . ">>=") | |
160 | (BITWISE_SHIFT_RIGHT . ">>") | |
161 | (BITWISE_SHIFT_LEFT_EQUALS . "<<=") | |
162 | (BITWISE_SHIFT_LEFT . "<<") | |
163 | (BITWISE_OR_EQUALS . "|=") | |
164 | (BITWISE_OR . "|") | |
165 | (BITWISE_EXCLUSIVE_OR_EQUALS . "^=") | |
166 | (BITWISE_EXCLUSIVE_OR . "^") | |
167 | (BITWISE_AND_EQUALS . "&=") | |
168 | (BITWISE_AND . "&") | |
169 | (ASSIGN_SYMBOL . "="))) | |
170 | '(("number" :declared t) | |
171 | ("string" :declared t) | |
172 | ("symbol" :declared t) | |
173 | ("keyword" :declared t) | |
174 | ("block" :declared t) | |
175 | ("punctuation" :declared t))) | |
176 | "Table of lexical tokens.") | |
177 | ||
178 | (defconst wisent-javascript-jv-wy--parse-table | |
179 | (progn | |
180 | (eval-when-compile | |
181 | (require 'semantic/wisent/comp)) | |
182 | (wisent-compile-grammar | |
183 | '((ASSIGN_SYMBOL BITWISE_AND BITWISE_AND_EQUALS BITWISE_EXCLUSIVE_OR BITWISE_EXCLUSIVE_OR_EQUALS BITWISE_OR BITWISE_OR_EQUALS BITWISE_SHIFT_LEFT BITWISE_SHIFT_LEFT_EQUALS BITWISE_SHIFT_RIGHT BITWISE_SHIFT_RIGHT_EQUALS BITWISE_SHIFT_RIGHT_ZERO_FILL BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS NOT_EQUAL DIV_EQUALS EQUALS GREATER_THAN GT_EQUAL LOGICAL_AND LOGICAL_OR LOGICAL_NOT LS_EQUAL MINUS MINUS_EQUALS MOD MOD_EQUALS MULTIPLY MULTIPLY_EQUALS PLUS PLUS_EQUALS INCREMENT DECREMENT DIV COLON COMMA DOT LESS_THAN LINE_TERMINATOR SEMICOLON ONES_COMPLIMENT PAREN_BLOCK BRACE_BLOCK BRACK_BLOCK OPEN_PARENTHESIS CLOSE_PARENTHESIS START_BLOCK END_BLOCK OPEN_SQ_BRACKETS CLOSE_SQ_BRACKETS IF BREAK CONTINUE ELSE FOR FUNCTION THIS RETURN WHILE VOID_SYMBOL NEW DELETE VAR WITH TYPEOF IN VARIABLE STRING NUMBER FALSE TRUE QUERY NULL_TOKEN) | |
184 | ((left PLUS MINUS) | |
185 | (left MULTIPLY DIV MOD) | |
186 | (nonassoc FALSE) | |
187 | (nonassoc HIGHER_THAN_FALSE) | |
188 | (nonassoc ELSE) | |
189 | (nonassoc LOWER_THAN_CLOSE_PARENTHESIS) | |
190 | (nonassoc CLOSE_PARENTHESIS)) | |
191 | (Program | |
192 | ((SourceElement))) | |
193 | (SourceElement | |
194 | ((Statement)) | |
195 | ((FunctionDeclaration))) | |
196 | (Statement | |
197 | ((Block)) | |
198 | ((VariableStatement)) | |
199 | ((EmptyStatement)) | |
200 | ((ExpressionStatement)) | |
201 | ((IfStatement)) | |
202 | ((IterationExpression)) | |
203 | ((ContinueStatement)) | |
204 | ((BreakStatement)) | |
205 | ((ReturnStatement)) | |
206 | ((WithStatement))) | |
207 | (FunctionDeclaration | |
208 | ((FUNCTION VARIABLE FormalParameterListBlock Block) | |
209 | (wisent-raw-tag | |
210 | (semantic-tag-new-function $2 nil $3)))) | |
211 | (FormalParameterListBlock | |
212 | ((PAREN_BLOCK) | |
213 | (semantic-parse-region | |
214 | (car $region1) | |
215 | (cdr $region1) | |
216 | 'FormalParameterList 1))) | |
217 | (FormalParameterList | |
218 | ((OPEN_PARENTHESIS) | |
219 | nil) | |
220 | ((VARIABLE) | |
221 | (wisent-raw-tag | |
222 | (semantic-tag-new-variable $1 nil nil))) | |
223 | ((CLOSE_PARENTHESIS) | |
224 | nil) | |
225 | ((COMMA) | |
226 | nil)) | |
227 | (StatementList | |
228 | ((Statement)) | |
229 | ((StatementList Statement))) | |
230 | (Block | |
231 | ((BRACE_BLOCK))) | |
232 | (BlockExpand | |
233 | ((START_BLOCK StatementList END_BLOCK)) | |
234 | ((START_BLOCK END_BLOCK))) | |
235 | (VariableStatement | |
236 | ((VAR VariableDeclarationList SEMICOLON) | |
237 | (wisent-raw-tag | |
238 | (semantic-tag-new-variable $2 nil nil)))) | |
239 | (VariableDeclarationList | |
240 | ((VariableDeclaration) | |
241 | (list $1)) | |
242 | ((VariableDeclarationList COMMA VariableDeclaration) | |
243 | (append $1 | |
244 | (list $3)))) | |
245 | (VariableDeclaration | |
246 | ((VARIABLE) | |
247 | (append | |
248 | (list $1 nil) | |
249 | $region)) | |
250 | ((VARIABLE Initializer) | |
251 | (append | |
252 | (cons $1 $2) | |
253 | $region))) | |
254 | (Initializer | |
255 | ((ASSIGN_SYMBOL AssignmentExpression) | |
256 | (list $2))) | |
257 | (EmptyStatement | |
258 | ((SEMICOLON))) | |
259 | (ExpressionStatement | |
260 | ((Expression SEMICOLON))) | |
261 | (IfStatement | |
262 | ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement) | |
263 | [HIGHER_THAN_FALSE]) | |
264 | ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement ELSE Statement)) | |
265 | ((IF OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement)) | |
266 | ((IF OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement))) | |
267 | (IterationExpression | |
268 | ((WHILE OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement) | |
269 | [HIGHER_THAN_FALSE]) | |
270 | ((WHILE OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement)) | |
271 | ((WHILE OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement)) | |
272 | ((FOR OPEN_PARENTHESIS OptionalExpression SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement)) | |
273 | ((FOR OPEN_PARENTHESIS VAR VariableDeclarationList SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement)) | |
274 | ((FOR OPEN_PARENTHESIS LeftHandSideExpression IN Expression CLOSE_PARENTHESIS Statement)) | |
275 | ((FOR OPEN_PARENTHESIS VAR VARIABLE OptionalInitializer IN Expression CLOSE_PARENTHESIS Statement))) | |
276 | (ContinueStatement | |
277 | ((CONTINUE SEMICOLON))) | |
278 | (BreakStatement | |
279 | ((BREAK SEMICOLON))) | |
280 | (ReturnStatement | |
281 | ((RETURN Expression SEMICOLON)) | |
282 | ((RETURN SEMICOLON))) | |
283 | (WithStatement | |
284 | ((WITH OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement))) | |
285 | (OptionalInitializer | |
286 | ((Initializer)) | |
287 | (nil)) | |
288 | (PrimaryExpression | |
289 | ((THIS)) | |
290 | ((VARIABLE)) | |
291 | ((NUMBER)) | |
292 | ((STRING)) | |
293 | ((NULL_TOKEN)) | |
294 | ((TRUE)) | |
295 | ((FALSE)) | |
296 | ((OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS))) | |
297 | (MemberExpression | |
298 | ((PrimaryExpression)) | |
299 | ((MemberExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS)) | |
300 | ((MemberExpression DOT VARIABLE)) | |
301 | ((NEW MemberExpression Arguments))) | |
302 | (NewExpression | |
303 | ((MemberExpression)) | |
304 | ((NEW NewExpression))) | |
305 | (CallExpression | |
306 | ((MemberExpression Arguments)) | |
307 | ((CallExpression Arguments)) | |
308 | ((CallExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS)) | |
309 | ((CallExpression DOT VARIABLE))) | |
310 | (Arguments | |
311 | ((OPEN_PARENTHESIS CLOSE_PARENTHESIS)) | |
312 | ((OPEN_PARENTHESIS ArgumentList CLOSE_PARENTHESIS))) | |
313 | (ArgumentList | |
314 | ((AssignmentExpression)) | |
315 | ((ArgumentList COMMA AssignmentExpression))) | |
316 | (LeftHandSideExpression | |
317 | ((NewExpression)) | |
318 | ((CallExpression))) | |
319 | (PostfixExpression | |
320 | ((LeftHandSideExpression)) | |
321 | ((LeftHandSideExpression INCREMENT)) | |
322 | ((LeftHandSideExpression DECREMENT))) | |
323 | (UnaryExpression | |
324 | ((PostfixExpression)) | |
325 | ((DELETE UnaryExpression)) | |
326 | ((VOID_SYMBOL UnaryExpression)) | |
327 | ((TYPEOF UnaryExpression)) | |
328 | ((INCREMENT UnaryExpression)) | |
329 | ((DECREMENT UnaryExpression)) | |
330 | ((PLUS UnaryExpression)) | |
331 | ((MINUS UnaryExpression)) | |
332 | ((ONES_COMPLIMENT UnaryExpression)) | |
333 | ((LOGICAL_NOT UnaryExpression))) | |
334 | (MultiplicativeExpression | |
335 | ((UnaryExpression)) | |
336 | ((MultiplicativeExpression MULTIPLY UnaryExpression)) | |
337 | ((MultiplicativeExpression DIV UnaryExpression)) | |
338 | ((MultiplicativeExpression MOD UnaryExpression))) | |
339 | (AdditiveExpression | |
340 | ((MultiplicativeExpression)) | |
341 | ((AdditiveExpression PLUS MultiplicativeExpression)) | |
342 | ((AdditiveExpression MINUS MultiplicativeExpression))) | |
343 | (ShiftExpression | |
344 | ((AdditiveExpression)) | |
345 | ((ShiftExpression BITWISE_SHIFT_LEFT AdditiveExpression)) | |
346 | ((ShiftExpression BITWISE_SHIFT_RIGHT AdditiveExpression)) | |
347 | ((ShiftExpression BITWISE_SHIFT_RIGHT_ZERO_FILL AdditiveExpression))) | |
348 | (RelationalExpression | |
349 | ((ShiftExpression)) | |
350 | ((RelationalExpression LESS_THAN ShiftExpression)) | |
351 | ((RelationalExpression GREATER_THAN ShiftExpression)) | |
352 | ((RelationalExpression LS_EQUAL ShiftExpression)) | |
353 | ((RelationalExpression GT_EQUAL ShiftExpression))) | |
354 | (EqualityExpression | |
355 | ((RelationalExpression)) | |
356 | ((EqualityExpression EQUALS RelationalExpression)) | |
357 | ((EqualityExpression NOT_EQUAL RelationalExpression))) | |
358 | (BitwiseANDExpression | |
359 | ((EqualityExpression)) | |
360 | ((BitwiseANDExpression BITWISE_AND EqualityExpression))) | |
361 | (BitwiseXORExpression | |
362 | ((BitwiseANDExpression)) | |
363 | ((BitwiseXORExpression BITWISE_EXCLUSIVE_OR BitwiseANDExpression))) | |
364 | (BitwiseORExpression | |
365 | ((BitwiseXORExpression)) | |
366 | ((BitwiseORExpression BITWISE_OR BitwiseXORExpression))) | |
367 | (LogicalANDExpression | |
368 | ((BitwiseORExpression)) | |
369 | ((LogicalANDExpression LOGICAL_AND BitwiseORExpression))) | |
370 | (LogicalORExpression | |
371 | ((LogicalANDExpression)) | |
372 | ((LogicalORExpression LOGICAL_OR LogicalANDExpression))) | |
373 | (ConditionalExpression | |
374 | ((LogicalORExpression)) | |
375 | ((LogicalORExpression QUERY AssignmentExpression COLON AssignmentExpression))) | |
376 | (AssignmentExpression | |
377 | ((ConditionalExpression)) | |
378 | ((LeftHandSideExpression AssignmentOperator AssignmentExpression) | |
379 | [LOWER_THAN_CLOSE_PARENTHESIS])) | |
380 | (AssignmentOperator | |
381 | ((ASSIGN_SYMBOL)) | |
382 | ((MULTIPLY_EQUALS)) | |
383 | ((DIV_EQUALS)) | |
384 | ((MOD_EQUALS)) | |
385 | ((PLUS_EQUALS)) | |
386 | ((MINUS_EQUALS)) | |
387 | ((BITWISE_SHIFT_LEFT_EQUALS)) | |
388 | ((BITWISE_SHIFT_RIGHT_EQUALS)) | |
389 | ((BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS)) | |
390 | ((BITWISE_AND_EQUALS)) | |
391 | ((BITWISE_EXCLUSIVE_OR_EQUALS)) | |
392 | ((BITWISE_OR_EQUALS))) | |
393 | (Expression | |
394 | ((AssignmentExpression)) | |
395 | ((Expression COMMA AssignmentExpression))) | |
396 | (OptionalExpression | |
397 | ((Expression)) | |
398 | (nil))) | |
399 | '(Program FormalParameterList))) | |
400 | "Parser table.") | |
401 | ||
402 | (defun wisent-javascript-jv-wy--install-parser () | |
403 | "Setup the Semantic Parser." | |
404 | (semantic-install-function-overrides | |
405 | '((parse-stream . wisent-parse-stream))) | |
406 | (setq semantic-parser-name "LALR" | |
407 | semantic--parse-table wisent-javascript-jv-wy--parse-table | |
408 | semantic-debug-parser-source "wisent-javascript-jv.wy" | |
409 | semantic-flex-keywords-obarray wisent-javascript-jv-wy--keyword-table | |
410 | semantic-lex-types-obarray wisent-javascript-jv-wy--token-table) | |
411 | ;; Collect unmatched syntax lexical tokens | |
412 | (semantic-make-local-hook 'wisent-discarding-token-functions) | |
413 | (add-hook 'wisent-discarding-token-functions | |
414 | 'wisent-collect-unmatched-syntax nil t)) | |
415 | ||
416 | \f | |
417 | ;;; Analyzers | |
418 | ;; | |
419 | (define-lex-keyword-type-analyzer wisent-javascript-jv-wy--<keyword>-keyword-analyzer | |
420 | "keyword analyzer for <keyword> tokens." | |
421 | "\\(\\sw\\|\\s_\\)+") | |
422 | ||
423 | (define-lex-block-type-analyzer wisent-javascript-jv-wy--<block>-block-analyzer | |
424 | "block analyzer for <block> tokens." | |
425 | "\\s(\\|\\s)" | |
426 | '((("(" OPEN_PARENTHESIS PAREN_BLOCK) | |
427 | ("{" START_BLOCK BRACE_BLOCK) | |
428 | ("[" OPEN_SQ_BRACKETS BRACK_BLOCK)) | |
429 | (")" CLOSE_PARENTHESIS) | |
430 | ("}" END_BLOCK) | |
431 | ("]" CLOSE_SQ_BRACKETS)) | |
432 | ) | |
433 | ||
434 | (define-lex-regex-type-analyzer wisent-javascript-jv-wy--<symbol>-regexp-analyzer | |
435 | "regexp analyzer for <symbol> tokens." | |
436 | "\\(\\sw\\|\\s_\\)+" | |
437 | nil | |
438 | 'VARIABLE) | |
439 | ||
440 | (define-lex-sexp-type-analyzer wisent-javascript-jv-wy--<string>-sexp-analyzer | |
441 | "sexp analyzer for <string> tokens." | |
442 | "\\s\"" | |
443 | 'STRING) | |
444 | ||
445 | (define-lex-regex-type-analyzer wisent-javascript-jv-wy--<number>-regexp-analyzer | |
446 | "regexp analyzer for <number> tokens." | |
447 | semantic-lex-number-expression | |
448 | nil | |
449 | 'NUMBER) | |
450 | ||
451 | (define-lex-string-type-analyzer wisent-javascript-jv-wy--<punctuation>-string-analyzer | |
452 | "string analyzer for <punctuation> tokens." | |
453 | "\\(\\s.\\|\\s$\\|\\s'\\)+" | |
454 | '((ONES_COMPLIMENT . "~") | |
455 | (SEMICOLON . ";") | |
456 | (LINE_TERMINATOR . "\n") | |
457 | (LESS_THAN . "<") | |
458 | (DOT . ".") | |
459 | (COMMA . ",") | |
460 | (COLON . ":") | |
461 | (DIV . "/") | |
462 | (DECREMENT . "--") | |
463 | (INCREMENT . "++") | |
464 | (PLUS_EQUALS . "+=") | |
465 | (PLUS . "+") | |
466 | (MULTIPLY_EQUALS . "*=") | |
467 | (MULTIPLY . "*") | |
468 | (MOD_EQUALS . "%=") | |
469 | (MOD . "%") | |
470 | (MINUS_EQUALS . "-=") | |
471 | (MINUS . "-") | |
472 | (LS_EQUAL . "<=") | |
473 | (LOGICAL_NOT . "!!") | |
474 | (LOGICAL_OR . "||") | |
475 | (LOGICAL_AND . "&&") | |
476 | (GT_EQUAL . ">=") | |
477 | (GREATER_THAN . ">") | |
478 | (EQUALS . "==") | |
479 | (DIV_EQUALS . "/=") | |
480 | (NOT_EQUAL . "!=") | |
481 | (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=") | |
482 | (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>") | |
483 | (BITWISE_SHIFT_RIGHT_EQUALS . ">>=") | |
484 | (BITWISE_SHIFT_RIGHT . ">>") | |
485 | (BITWISE_SHIFT_LEFT_EQUALS . "<<=") | |
486 | (BITWISE_SHIFT_LEFT . "<<") | |
487 | (BITWISE_OR_EQUALS . "|=") | |
488 | (BITWISE_OR . "|") | |
489 | (BITWISE_EXCLUSIVE_OR_EQUALS . "^=") | |
490 | (BITWISE_EXCLUSIVE_OR . "^") | |
491 | (BITWISE_AND_EQUALS . "&=") | |
492 | (BITWISE_AND . "&") | |
493 | (ASSIGN_SYMBOL . "=")) | |
494 | 'punctuation) | |
495 | ||
496 | \f | |
497 | ;;; Epilogue | |
498 | ;; | |
499 | ;;here something like: | |
500 | ;;(define-lex wisent-java-tags-lexer | |
501 | ;; should go | |
502 | (define-lex javascript-lexer-jv | |
503 | "javascript thingy" | |
504 | ;;std stuff | |
505 | semantic-lex-ignore-whitespace | |
506 | semantic-lex-ignore-newline | |
507 | semantic-lex-ignore-comments | |
508 | ||
509 | ;;stuff generated from the wy file(one for each "type" declaration) | |
510 | wisent-javascript-jv-wy--<number>-regexp-analyzer | |
511 | wisent-javascript-jv-wy--<string>-sexp-analyzer | |
512 | ||
513 | wisent-javascript-jv-wy--<keyword>-keyword-analyzer | |
514 | ||
515 | wisent-javascript-jv-wy--<symbol>-regexp-analyzer | |
516 | wisent-javascript-jv-wy--<punctuation>-string-analyzer | |
517 | wisent-javascript-jv-wy--<block>-block-analyzer | |
518 | ||
519 | ||
520 | ;;;;more std stuff | |
521 | semantic-lex-default-action | |
522 | ) | |
523 | ||
524 | (provide 'semantic/wisent/js-wy) | |
525 | ||
3999968a | 526 | ;; arch-tag: ff9ecf05-18e6-46a6-a3bb-e7f43f04640f |
bb051423 | 527 | ;;; semantic/wisent/js-wy.el ends here |