Commit | Line | Data |
---|---|---|
bb051423 CY |
1 | ;;; semantic/wisent/js-wy.el --- Generated parser support file |
2 | ||
acaf905b | 3 | ;; Copyright (C) 2005, 2009-2012 Free Software Foundation, Inc. |
110544de | 4 | ;; Copyright (C) 1998-2011 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 | ;; | |
78adbf9c CY |
23 | ;; This file was generated from admin/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: | |
78adbf9c | 61 | |
bb051423 CY |
62 | (require 'semantic/lex) |
63 | \f | |
64 | ;;; Prologue | |
65 | ;; | |
66 | \f | |
67 | ;;; Declarations | |
68 | ;; | |
69 | (defconst wisent-javascript-jv-wy--keyword-table | |
70 | (semantic-lex-make-keyword-table | |
71 | '(("if" . IF) | |
72 | ("break" . BREAK) | |
73 | ("continue" . CONTINUE) | |
74 | ("else" . ELSE) | |
75 | ("for" . FOR) | |
76 | ("function" . FUNCTION) | |
77 | ("this" . THIS) | |
78 | ("return" . RETURN) | |
79 | ("while" . WHILE) | |
80 | ("void" . VOID_SYMBOL) | |
81 | ("new" . NEW) | |
82 | ("delete" . DELETE) | |
83 | ("var" . VAR) | |
84 | ("with" . WITH) | |
85 | ("typeof" . TYPEOF) | |
86 | ("in" . IN)) | |
87 | '(("in" summary "in something") | |
88 | ("typeof" summary "typeof ") | |
89 | ("with" summary "with ") | |
90 | ("var" summary "var <variablename> [= value];") | |
91 | ("delete" summary "delete(<objectreference>) - Deletes the object.") | |
92 | ("new" summary "new <objecttype> - Creates a new object.") | |
93 | ("void" summary "Method return type: void <name> ...") | |
94 | ("while" summary "while (<expr>) <stmt> | do <stmt> while (<expr>);") | |
95 | ("return" summary "return [<expr>] ;") | |
96 | ("this" summary "this") | |
97 | ("function" summary "function declaration blah blah") | |
98 | ("for" summary "for ([<init-expr>]; [<expr>]; [<update-expr>]) <stmt>") | |
99 | ("else" summary "if (<expr>) <stmt> else <stmt>") | |
100 | ("continue" summary "continue [<label>] ;") | |
101 | ("break" summary "break [<label>] ;") | |
102 | ("if" summary "if (<expr>) <stmt> [else <stmt>] (jv)"))) | |
103 | "Table of language keywords.") | |
104 | ||
105 | (defconst wisent-javascript-jv-wy--token-table | |
106 | (semantic-lex-make-type-table | |
107 | '(("<no-type>" | |
108 | (NULL_TOKEN) | |
109 | (QUERY) | |
110 | (TRUE) | |
111 | (FALSE)) | |
112 | ("number" | |
113 | (NUMBER)) | |
114 | ("string" | |
115 | (STRING)) | |
116 | ("symbol" | |
117 | (VARIABLE)) | |
118 | ("close-paren" | |
119 | (CLOSE_SQ_BRACKETS . "]") | |
120 | (END_BLOCK . "}") | |
121 | (CLOSE_PARENTHESIS . ")")) | |
122 | ("open-paren" | |
123 | (OPEN_SQ_BRACKETS . "[") | |
124 | (START_BLOCK . "{") | |
125 | (OPEN_PARENTHESIS . "(")) | |
126 | ("block" | |
127 | (BRACK_BLOCK . "(OPEN_SQ_BRACKETS CLOSE_SQ_BRACKETS)") | |
128 | (BRACE_BLOCK . "(START_BLOCK END_BLOCK)") | |
129 | (PAREN_BLOCK . "(OPEN_PARENTHESIS CLOSE_PARENTHESIS)")) | |
130 | ("punctuation" | |
131 | (ONES_COMPLIMENT . "~") | |
132 | (SEMICOLON . ";") | |
133 | (LINE_TERMINATOR . "\n") | |
134 | (LESS_THAN . "<") | |
135 | (DOT . ".") | |
136 | (COMMA . ",") | |
137 | (COLON . ":") | |
138 | (DIV . "/") | |
139 | (DECREMENT . "--") | |
140 | (INCREMENT . "++") | |
141 | (PLUS_EQUALS . "+=") | |
142 | (PLUS . "+") | |
143 | (MULTIPLY_EQUALS . "*=") | |
144 | (MULTIPLY . "*") | |
145 | (MOD_EQUALS . "%=") | |
146 | (MOD . "%") | |
147 | (MINUS_EQUALS . "-=") | |
148 | (MINUS . "-") | |
149 | (LS_EQUAL . "<=") | |
150 | (LOGICAL_NOT . "!!") | |
151 | (LOGICAL_OR . "||") | |
152 | (LOGICAL_AND . "&&") | |
153 | (GT_EQUAL . ">=") | |
154 | (GREATER_THAN . ">") | |
155 | (EQUALS . "==") | |
156 | (DIV_EQUALS . "/=") | |
157 | (NOT_EQUAL . "!=") | |
158 | (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=") | |
159 | (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>") | |
160 | (BITWISE_SHIFT_RIGHT_EQUALS . ">>=") | |
161 | (BITWISE_SHIFT_RIGHT . ">>") | |
162 | (BITWISE_SHIFT_LEFT_EQUALS . "<<=") | |
163 | (BITWISE_SHIFT_LEFT . "<<") | |
164 | (BITWISE_OR_EQUALS . "|=") | |
165 | (BITWISE_OR . "|") | |
166 | (BITWISE_EXCLUSIVE_OR_EQUALS . "^=") | |
167 | (BITWISE_EXCLUSIVE_OR . "^") | |
168 | (BITWISE_AND_EQUALS . "&=") | |
169 | (BITWISE_AND . "&") | |
170 | (ASSIGN_SYMBOL . "="))) | |
171 | '(("number" :declared t) | |
172 | ("string" :declared t) | |
173 | ("symbol" :declared t) | |
174 | ("keyword" :declared t) | |
175 | ("block" :declared t) | |
176 | ("punctuation" :declared t))) | |
177 | "Table of lexical tokens.") | |
178 | ||
179 | (defconst wisent-javascript-jv-wy--parse-table | |
180 | (progn | |
181 | (eval-when-compile | |
182 | (require 'semantic/wisent/comp)) | |
183 | (wisent-compile-grammar | |
184 | '((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) | |
185 | ((left PLUS MINUS) | |
186 | (left MULTIPLY DIV MOD) | |
187 | (nonassoc FALSE) | |
188 | (nonassoc HIGHER_THAN_FALSE) | |
189 | (nonassoc ELSE) | |
190 | (nonassoc LOWER_THAN_CLOSE_PARENTHESIS) | |
191 | (nonassoc CLOSE_PARENTHESIS)) | |
192 | (Program | |
193 | ((SourceElement))) | |
194 | (SourceElement | |
195 | ((Statement)) | |
196 | ((FunctionDeclaration))) | |
197 | (Statement | |
198 | ((Block)) | |
199 | ((VariableStatement)) | |
200 | ((EmptyStatement)) | |
201 | ((ExpressionStatement)) | |
202 | ((IfStatement)) | |
203 | ((IterationExpression)) | |
204 | ((ContinueStatement)) | |
205 | ((BreakStatement)) | |
206 | ((ReturnStatement)) | |
207 | ((WithStatement))) | |
208 | (FunctionDeclaration | |
209 | ((FUNCTION VARIABLE FormalParameterListBlock Block) | |
210 | (wisent-raw-tag | |
211 | (semantic-tag-new-function $2 nil $3)))) | |
212 | (FormalParameterListBlock | |
213 | ((PAREN_BLOCK) | |
214 | (semantic-parse-region | |
215 | (car $region1) | |
216 | (cdr $region1) | |
217 | 'FormalParameterList 1))) | |
218 | (FormalParameterList | |
219 | ((OPEN_PARENTHESIS) | |
220 | nil) | |
221 | ((VARIABLE) | |
222 | (wisent-raw-tag | |
223 | (semantic-tag-new-variable $1 nil nil))) | |
224 | ((CLOSE_PARENTHESIS) | |
225 | nil) | |
226 | ((COMMA) | |
227 | nil)) | |
228 | (StatementList | |
229 | ((Statement)) | |
230 | ((StatementList Statement))) | |
231 | (Block | |
232 | ((BRACE_BLOCK))) | |
233 | (BlockExpand | |
234 | ((START_BLOCK StatementList END_BLOCK)) | |
235 | ((START_BLOCK END_BLOCK))) | |
236 | (VariableStatement | |
237 | ((VAR VariableDeclarationList SEMICOLON) | |
238 | (wisent-raw-tag | |
239 | (semantic-tag-new-variable $2 nil nil)))) | |
240 | (VariableDeclarationList | |
241 | ((VariableDeclaration) | |
242 | (list $1)) | |
243 | ((VariableDeclarationList COMMA VariableDeclaration) | |
244 | (append $1 | |
245 | (list $3)))) | |
246 | (VariableDeclaration | |
247 | ((VARIABLE) | |
248 | (append | |
249 | (list $1 nil) | |
250 | $region)) | |
251 | ((VARIABLE Initializer) | |
252 | (append | |
253 | (cons $1 $2) | |
254 | $region))) | |
255 | (Initializer | |
256 | ((ASSIGN_SYMBOL AssignmentExpression) | |
257 | (list $2))) | |
258 | (EmptyStatement | |
259 | ((SEMICOLON))) | |
260 | (ExpressionStatement | |
261 | ((Expression SEMICOLON))) | |
262 | (IfStatement | |
263 | ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement) | |
264 | [HIGHER_THAN_FALSE]) | |
265 | ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement ELSE Statement)) | |
266 | ((IF OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement)) | |
267 | ((IF OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement))) | |
268 | (IterationExpression | |
269 | ((WHILE OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement) | |
270 | [HIGHER_THAN_FALSE]) | |
271 | ((WHILE OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement)) | |
272 | ((WHILE OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement)) | |
273 | ((FOR OPEN_PARENTHESIS OptionalExpression SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement)) | |
274 | ((FOR OPEN_PARENTHESIS VAR VariableDeclarationList SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement)) | |
275 | ((FOR OPEN_PARENTHESIS LeftHandSideExpression IN Expression CLOSE_PARENTHESIS Statement)) | |
276 | ((FOR OPEN_PARENTHESIS VAR VARIABLE OptionalInitializer IN Expression CLOSE_PARENTHESIS Statement))) | |
277 | (ContinueStatement | |
278 | ((CONTINUE SEMICOLON))) | |
279 | (BreakStatement | |
280 | ((BREAK SEMICOLON))) | |
281 | (ReturnStatement | |
282 | ((RETURN Expression SEMICOLON)) | |
283 | ((RETURN SEMICOLON))) | |
284 | (WithStatement | |
285 | ((WITH OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement))) | |
286 | (OptionalInitializer | |
287 | ((Initializer)) | |
288 | (nil)) | |
289 | (PrimaryExpression | |
290 | ((THIS)) | |
291 | ((VARIABLE)) | |
292 | ((NUMBER)) | |
293 | ((STRING)) | |
294 | ((NULL_TOKEN)) | |
295 | ((TRUE)) | |
296 | ((FALSE)) | |
297 | ((OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS))) | |
298 | (MemberExpression | |
299 | ((PrimaryExpression)) | |
300 | ((MemberExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS)) | |
301 | ((MemberExpression DOT VARIABLE)) | |
302 | ((NEW MemberExpression Arguments))) | |
303 | (NewExpression | |
304 | ((MemberExpression)) | |
305 | ((NEW NewExpression))) | |
306 | (CallExpression | |
307 | ((MemberExpression Arguments)) | |
308 | ((CallExpression Arguments)) | |
309 | ((CallExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS)) | |
310 | ((CallExpression DOT VARIABLE))) | |
311 | (Arguments | |
312 | ((OPEN_PARENTHESIS CLOSE_PARENTHESIS)) | |
313 | ((OPEN_PARENTHESIS ArgumentList CLOSE_PARENTHESIS))) | |
314 | (ArgumentList | |
315 | ((AssignmentExpression)) | |
316 | ((ArgumentList COMMA AssignmentExpression))) | |
317 | (LeftHandSideExpression | |
318 | ((NewExpression)) | |
319 | ((CallExpression))) | |
320 | (PostfixExpression | |
321 | ((LeftHandSideExpression)) | |
322 | ((LeftHandSideExpression INCREMENT)) | |
323 | ((LeftHandSideExpression DECREMENT))) | |
324 | (UnaryExpression | |
325 | ((PostfixExpression)) | |
326 | ((DELETE UnaryExpression)) | |
327 | ((VOID_SYMBOL UnaryExpression)) | |
328 | ((TYPEOF UnaryExpression)) | |
329 | ((INCREMENT UnaryExpression)) | |
330 | ((DECREMENT UnaryExpression)) | |
331 | ((PLUS UnaryExpression)) | |
332 | ((MINUS UnaryExpression)) | |
333 | ((ONES_COMPLIMENT UnaryExpression)) | |
334 | ((LOGICAL_NOT UnaryExpression))) | |
335 | (MultiplicativeExpression | |
336 | ((UnaryExpression)) | |
337 | ((MultiplicativeExpression MULTIPLY UnaryExpression)) | |
338 | ((MultiplicativeExpression DIV UnaryExpression)) | |
339 | ((MultiplicativeExpression MOD UnaryExpression))) | |
340 | (AdditiveExpression | |
341 | ((MultiplicativeExpression)) | |
342 | ((AdditiveExpression PLUS MultiplicativeExpression)) | |
343 | ((AdditiveExpression MINUS MultiplicativeExpression))) | |
344 | (ShiftExpression | |
345 | ((AdditiveExpression)) | |
346 | ((ShiftExpression BITWISE_SHIFT_LEFT AdditiveExpression)) | |
347 | ((ShiftExpression BITWISE_SHIFT_RIGHT AdditiveExpression)) | |
348 | ((ShiftExpression BITWISE_SHIFT_RIGHT_ZERO_FILL AdditiveExpression))) | |
349 | (RelationalExpression | |
350 | ((ShiftExpression)) | |
351 | ((RelationalExpression LESS_THAN ShiftExpression)) | |
352 | ((RelationalExpression GREATER_THAN ShiftExpression)) | |
353 | ((RelationalExpression LS_EQUAL ShiftExpression)) | |
354 | ((RelationalExpression GT_EQUAL ShiftExpression))) | |
355 | (EqualityExpression | |
356 | ((RelationalExpression)) | |
357 | ((EqualityExpression EQUALS RelationalExpression)) | |
358 | ((EqualityExpression NOT_EQUAL RelationalExpression))) | |
359 | (BitwiseANDExpression | |
360 | ((EqualityExpression)) | |
361 | ((BitwiseANDExpression BITWISE_AND EqualityExpression))) | |
362 | (BitwiseXORExpression | |
363 | ((BitwiseANDExpression)) | |
364 | ((BitwiseXORExpression BITWISE_EXCLUSIVE_OR BitwiseANDExpression))) | |
365 | (BitwiseORExpression | |
366 | ((BitwiseXORExpression)) | |
367 | ((BitwiseORExpression BITWISE_OR BitwiseXORExpression))) | |
368 | (LogicalANDExpression | |
369 | ((BitwiseORExpression)) | |
370 | ((LogicalANDExpression LOGICAL_AND BitwiseORExpression))) | |
371 | (LogicalORExpression | |
372 | ((LogicalANDExpression)) | |
373 | ((LogicalORExpression LOGICAL_OR LogicalANDExpression))) | |
374 | (ConditionalExpression | |
375 | ((LogicalORExpression)) | |
376 | ((LogicalORExpression QUERY AssignmentExpression COLON AssignmentExpression))) | |
377 | (AssignmentExpression | |
378 | ((ConditionalExpression)) | |
379 | ((LeftHandSideExpression AssignmentOperator AssignmentExpression) | |
380 | [LOWER_THAN_CLOSE_PARENTHESIS])) | |
381 | (AssignmentOperator | |
382 | ((ASSIGN_SYMBOL)) | |
383 | ((MULTIPLY_EQUALS)) | |
384 | ((DIV_EQUALS)) | |
385 | ((MOD_EQUALS)) | |
386 | ((PLUS_EQUALS)) | |
387 | ((MINUS_EQUALS)) | |
388 | ((BITWISE_SHIFT_LEFT_EQUALS)) | |
389 | ((BITWISE_SHIFT_RIGHT_EQUALS)) | |
390 | ((BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS)) | |
391 | ((BITWISE_AND_EQUALS)) | |
392 | ((BITWISE_EXCLUSIVE_OR_EQUALS)) | |
393 | ((BITWISE_OR_EQUALS))) | |
394 | (Expression | |
395 | ((AssignmentExpression)) | |
396 | ((Expression COMMA AssignmentExpression))) | |
397 | (OptionalExpression | |
398 | ((Expression)) | |
399 | (nil))) | |
400 | '(Program FormalParameterList))) | |
401 | "Parser table.") | |
402 | ||
403 | (defun wisent-javascript-jv-wy--install-parser () | |
404 | "Setup the Semantic Parser." | |
405 | (semantic-install-function-overrides | |
406 | '((parse-stream . wisent-parse-stream))) | |
407 | (setq semantic-parser-name "LALR" | |
408 | semantic--parse-table wisent-javascript-jv-wy--parse-table | |
78adbf9c | 409 | semantic-debug-parser-source "js.wy" |
bb051423 CY |
410 | semantic-flex-keywords-obarray wisent-javascript-jv-wy--keyword-table |
411 | semantic-lex-types-obarray wisent-javascript-jv-wy--token-table) | |
412 | ;; Collect unmatched syntax lexical tokens | |
413 | (semantic-make-local-hook 'wisent-discarding-token-functions) | |
414 | (add-hook 'wisent-discarding-token-functions | |
415 | 'wisent-collect-unmatched-syntax nil t)) | |
416 | ||
417 | \f | |
418 | ;;; Analyzers | |
bb051423 CY |
419 | |
420 | (define-lex-string-type-analyzer wisent-javascript-jv-wy--<punctuation>-string-analyzer | |
421 | "string analyzer for <punctuation> tokens." | |
422 | "\\(\\s.\\|\\s$\\|\\s'\\)+" | |
423 | '((ONES_COMPLIMENT . "~") | |
424 | (SEMICOLON . ";") | |
425 | (LINE_TERMINATOR . "\n") | |
426 | (LESS_THAN . "<") | |
427 | (DOT . ".") | |
428 | (COMMA . ",") | |
429 | (COLON . ":") | |
430 | (DIV . "/") | |
431 | (DECREMENT . "--") | |
432 | (INCREMENT . "++") | |
433 | (PLUS_EQUALS . "+=") | |
434 | (PLUS . "+") | |
435 | (MULTIPLY_EQUALS . "*=") | |
436 | (MULTIPLY . "*") | |
437 | (MOD_EQUALS . "%=") | |
438 | (MOD . "%") | |
439 | (MINUS_EQUALS . "-=") | |
440 | (MINUS . "-") | |
441 | (LS_EQUAL . "<=") | |
442 | (LOGICAL_NOT . "!!") | |
443 | (LOGICAL_OR . "||") | |
444 | (LOGICAL_AND . "&&") | |
445 | (GT_EQUAL . ">=") | |
446 | (GREATER_THAN . ">") | |
447 | (EQUALS . "==") | |
448 | (DIV_EQUALS . "/=") | |
449 | (NOT_EQUAL . "!=") | |
450 | (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=") | |
451 | (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>") | |
452 | (BITWISE_SHIFT_RIGHT_EQUALS . ">>=") | |
453 | (BITWISE_SHIFT_RIGHT . ">>") | |
454 | (BITWISE_SHIFT_LEFT_EQUALS . "<<=") | |
455 | (BITWISE_SHIFT_LEFT . "<<") | |
456 | (BITWISE_OR_EQUALS . "|=") | |
457 | (BITWISE_OR . "|") | |
458 | (BITWISE_EXCLUSIVE_OR_EQUALS . "^=") | |
459 | (BITWISE_EXCLUSIVE_OR . "^") | |
460 | (BITWISE_AND_EQUALS . "&=") | |
461 | (BITWISE_AND . "&") | |
462 | (ASSIGN_SYMBOL . "=")) | |
463 | 'punctuation) | |
464 | ||
78adbf9c CY |
465 | (define-lex-block-type-analyzer wisent-javascript-jv-wy--<block>-block-analyzer |
466 | "block analyzer for <block> tokens." | |
467 | "\\s(\\|\\s)" | |
468 | '((("(" OPEN_PARENTHESIS PAREN_BLOCK) | |
469 | ("{" START_BLOCK BRACE_BLOCK) | |
470 | ("[" OPEN_SQ_BRACKETS BRACK_BLOCK)) | |
471 | (")" CLOSE_PARENTHESIS) | |
472 | ("}" END_BLOCK) | |
473 | ("]" CLOSE_SQ_BRACKETS)) | |
474 | ) | |
475 | ||
476 | (define-lex-regex-type-analyzer wisent-javascript-jv-wy--<symbol>-regexp-analyzer | |
477 | "regexp analyzer for <symbol> tokens." | |
478 | "\\(\\sw\\|\\s_\\)+" | |
479 | nil | |
480 | 'VARIABLE) | |
481 | ||
482 | (define-lex-regex-type-analyzer wisent-javascript-jv-wy--<number>-regexp-analyzer | |
483 | "regexp analyzer for <number> tokens." | |
484 | semantic-lex-number-expression | |
485 | nil | |
486 | 'NUMBER) | |
487 | ||
488 | (define-lex-sexp-type-analyzer wisent-javascript-jv-wy--<string>-sexp-analyzer | |
489 | "sexp analyzer for <string> tokens." | |
490 | "\\s\"" | |
491 | 'STRING) | |
492 | ||
493 | (define-lex-keyword-type-analyzer wisent-javascript-jv-wy--<keyword>-keyword-analyzer | |
494 | "keyword analyzer for <keyword> tokens." | |
495 | "\\(\\sw\\|\\s_\\)+") | |
496 | ||
bb051423 CY |
497 | \f |
498 | ;;; Epilogue | |
499 | ;; | |
500 | ;;here something like: | |
501 | ;;(define-lex wisent-java-tags-lexer | |
502 | ;; should go | |
503 | (define-lex javascript-lexer-jv | |
504 | "javascript thingy" | |
505 | ;;std stuff | |
506 | semantic-lex-ignore-whitespace | |
507 | semantic-lex-ignore-newline | |
508 | semantic-lex-ignore-comments | |
509 | ||
510 | ;;stuff generated from the wy file(one for each "type" declaration) | |
511 | wisent-javascript-jv-wy--<number>-regexp-analyzer | |
512 | wisent-javascript-jv-wy--<string>-sexp-analyzer | |
513 | ||
514 | wisent-javascript-jv-wy--<keyword>-keyword-analyzer | |
515 | ||
516 | wisent-javascript-jv-wy--<symbol>-regexp-analyzer | |
517 | wisent-javascript-jv-wy--<punctuation>-string-analyzer | |
518 | wisent-javascript-jv-wy--<block>-block-analyzer | |
519 | ||
520 | ||
521 | ;;;;more std stuff | |
522 | semantic-lex-default-action | |
523 | ) | |
524 | ||
525 | (provide 'semantic/wisent/js-wy) | |
526 | ||
527 | ;;; semantic/wisent/js-wy.el ends here |