1 ;;; semantic/wisent/js-wy.el --- Generated parser support file
3 ;; Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 ;; This file was generated from the grammar file
23 ;; semantic/wisent/wisent-javascript-jv.wy in the CEDET repository.
26 (require 'semantic/lex)
33 (defconst wisent-javascript-jv-wy--keyword-table
34 (semantic-lex-make-keyword-table
37 ("continue" . CONTINUE)
40 ("function" . FUNCTION)
44 ("void" . VOID_SYMBOL)
51 '(("in" summary "in something")
52 ("typeof" summary "typeof ")
53 ("with" summary "with ")
54 ("var" summary "var <variablename> [= value];")
55 ("delete" summary "delete(<objectreference>) - Deletes the object.")
56 ("new" summary "new <objecttype> - Creates a new object.")
57 ("void" summary "Method return type: void <name> ...")
58 ("while" summary "while (<expr>) <stmt> | do <stmt> while (<expr>);")
59 ("return" summary "return [<expr>] ;")
60 ("this" summary "this")
61 ("function" summary "function declaration blah blah")
62 ("for" summary "for ([<init-expr>]; [<expr>]; [<update-expr>]) <stmt>")
63 ("else" summary "if (<expr>) <stmt> else <stmt>")
64 ("continue" summary "continue [<label>] ;")
65 ("break" summary "break [<label>] ;")
66 ("if" summary "if (<expr>) <stmt> [else <stmt>] (jv)")))
67 "Table of language keywords.")
69 (defconst wisent-javascript-jv-wy--token-table
70 (semantic-lex-make-type-table
83 (CLOSE_SQ_BRACKETS . "]")
85 (CLOSE_PARENTHESIS . ")"))
87 (OPEN_SQ_BRACKETS . "[")
89 (OPEN_PARENTHESIS . "("))
91 (BRACK_BLOCK . "(OPEN_SQ_BRACKETS CLOSE_SQ_BRACKETS)")
92 (BRACE_BLOCK . "(START_BLOCK END_BLOCK)")
93 (PAREN_BLOCK . "(OPEN_PARENTHESIS CLOSE_PARENTHESIS)"))
95 (ONES_COMPLIMENT . "~")
97 (LINE_TERMINATOR . "\n")
107 (MULTIPLY_EQUALS . "*=")
111 (MINUS_EQUALS . "-=")
122 (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=")
123 (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>")
124 (BITWISE_SHIFT_RIGHT_EQUALS . ">>=")
125 (BITWISE_SHIFT_RIGHT . ">>")
126 (BITWISE_SHIFT_LEFT_EQUALS . "<<=")
127 (BITWISE_SHIFT_LEFT . "<<")
128 (BITWISE_OR_EQUALS . "|=")
130 (BITWISE_EXCLUSIVE_OR_EQUALS . "^=")
131 (BITWISE_EXCLUSIVE_OR . "^")
132 (BITWISE_AND_EQUALS . "&=")
134 (ASSIGN_SYMBOL . "=")))
135 '(("number" :declared t)
136 ("string" :declared t)
137 ("symbol" :declared t)
138 ("keyword" :declared t)
139 ("block" :declared t)
140 ("punctuation" :declared t)))
141 "Table of lexical tokens.")
143 (defconst wisent-javascript-jv-wy--parse-table
146 (require 'semantic/wisent/comp))
147 (wisent-compile-grammar
148 '((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)
150 (left MULTIPLY DIV MOD)
152 (nonassoc HIGHER_THAN_FALSE)
154 (nonassoc LOWER_THAN_CLOSE_PARENTHESIS)
155 (nonassoc CLOSE_PARENTHESIS))
160 ((FunctionDeclaration)))
163 ((VariableStatement))
165 ((ExpressionStatement))
167 ((IterationExpression))
168 ((ContinueStatement))
173 ((FUNCTION VARIABLE FormalParameterListBlock Block)
175 (semantic-tag-new-function $2 nil $3))))
176 (FormalParameterListBlock
178 (semantic-parse-region
181 'FormalParameterList 1)))
187 (semantic-tag-new-variable $1 nil nil)))
194 ((StatementList Statement)))
198 ((START_BLOCK StatementList END_BLOCK))
199 ((START_BLOCK END_BLOCK)))
201 ((VAR VariableDeclarationList SEMICOLON)
203 (semantic-tag-new-variable $2 nil nil))))
204 (VariableDeclarationList
205 ((VariableDeclaration)
207 ((VariableDeclarationList COMMA VariableDeclaration)
215 ((VARIABLE Initializer)
220 ((ASSIGN_SYMBOL AssignmentExpression)
225 ((Expression SEMICOLON)))
227 ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement)
229 ((IF OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement ELSE Statement))
230 ((IF OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement))
231 ((IF OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement)))
233 ((WHILE OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement)
235 ((WHILE OPEN_PARENTHESIS FALSE CLOSE_PARENTHESIS Statement))
236 ((WHILE OPEN_PARENTHESIS LeftHandSideExpression AssignmentOperator AssignmentExpression CLOSE_PARENTHESIS Statement))
237 ((FOR OPEN_PARENTHESIS OptionalExpression SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement))
238 ((FOR OPEN_PARENTHESIS VAR VariableDeclarationList SEMICOLON OptionalExpression SEMICOLON OptionalExpression CLOSE_PARENTHESIS Statement))
239 ((FOR OPEN_PARENTHESIS LeftHandSideExpression IN Expression CLOSE_PARENTHESIS Statement))
240 ((FOR OPEN_PARENTHESIS VAR VARIABLE OptionalInitializer IN Expression CLOSE_PARENTHESIS Statement)))
242 ((CONTINUE SEMICOLON)))
246 ((RETURN Expression SEMICOLON))
247 ((RETURN SEMICOLON)))
249 ((WITH OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS Statement)))
261 ((OPEN_PARENTHESIS Expression CLOSE_PARENTHESIS)))
263 ((PrimaryExpression))
264 ((MemberExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS))
265 ((MemberExpression DOT VARIABLE))
266 ((NEW MemberExpression Arguments)))
269 ((NEW NewExpression)))
271 ((MemberExpression Arguments))
272 ((CallExpression Arguments))
273 ((CallExpression OPEN_SQ_BRACKETS Expression CLOSE_SQ_BRACKETS))
274 ((CallExpression DOT VARIABLE)))
276 ((OPEN_PARENTHESIS CLOSE_PARENTHESIS))
277 ((OPEN_PARENTHESIS ArgumentList CLOSE_PARENTHESIS)))
279 ((AssignmentExpression))
280 ((ArgumentList COMMA AssignmentExpression)))
281 (LeftHandSideExpression
285 ((LeftHandSideExpression))
286 ((LeftHandSideExpression INCREMENT))
287 ((LeftHandSideExpression DECREMENT)))
289 ((PostfixExpression))
290 ((DELETE UnaryExpression))
291 ((VOID_SYMBOL UnaryExpression))
292 ((TYPEOF UnaryExpression))
293 ((INCREMENT UnaryExpression))
294 ((DECREMENT UnaryExpression))
295 ((PLUS UnaryExpression))
296 ((MINUS UnaryExpression))
297 ((ONES_COMPLIMENT UnaryExpression))
298 ((LOGICAL_NOT UnaryExpression)))
299 (MultiplicativeExpression
301 ((MultiplicativeExpression MULTIPLY UnaryExpression))
302 ((MultiplicativeExpression DIV UnaryExpression))
303 ((MultiplicativeExpression MOD UnaryExpression)))
305 ((MultiplicativeExpression))
306 ((AdditiveExpression PLUS MultiplicativeExpression))
307 ((AdditiveExpression MINUS MultiplicativeExpression)))
309 ((AdditiveExpression))
310 ((ShiftExpression BITWISE_SHIFT_LEFT AdditiveExpression))
311 ((ShiftExpression BITWISE_SHIFT_RIGHT AdditiveExpression))
312 ((ShiftExpression BITWISE_SHIFT_RIGHT_ZERO_FILL AdditiveExpression)))
313 (RelationalExpression
315 ((RelationalExpression LESS_THAN ShiftExpression))
316 ((RelationalExpression GREATER_THAN ShiftExpression))
317 ((RelationalExpression LS_EQUAL ShiftExpression))
318 ((RelationalExpression GT_EQUAL ShiftExpression)))
320 ((RelationalExpression))
321 ((EqualityExpression EQUALS RelationalExpression))
322 ((EqualityExpression NOT_EQUAL RelationalExpression)))
323 (BitwiseANDExpression
324 ((EqualityExpression))
325 ((BitwiseANDExpression BITWISE_AND EqualityExpression)))
326 (BitwiseXORExpression
327 ((BitwiseANDExpression))
328 ((BitwiseXORExpression BITWISE_EXCLUSIVE_OR BitwiseANDExpression)))
330 ((BitwiseXORExpression))
331 ((BitwiseORExpression BITWISE_OR BitwiseXORExpression)))
332 (LogicalANDExpression
333 ((BitwiseORExpression))
334 ((LogicalANDExpression LOGICAL_AND BitwiseORExpression)))
336 ((LogicalANDExpression))
337 ((LogicalORExpression LOGICAL_OR LogicalANDExpression)))
338 (ConditionalExpression
339 ((LogicalORExpression))
340 ((LogicalORExpression QUERY AssignmentExpression COLON AssignmentExpression)))
341 (AssignmentExpression
342 ((ConditionalExpression))
343 ((LeftHandSideExpression AssignmentOperator AssignmentExpression)
344 [LOWER_THAN_CLOSE_PARENTHESIS]))
352 ((BITWISE_SHIFT_LEFT_EQUALS))
353 ((BITWISE_SHIFT_RIGHT_EQUALS))
354 ((BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS))
355 ((BITWISE_AND_EQUALS))
356 ((BITWISE_EXCLUSIVE_OR_EQUALS))
357 ((BITWISE_OR_EQUALS)))
359 ((AssignmentExpression))
360 ((Expression COMMA AssignmentExpression)))
364 '(Program FormalParameterList)))
367 (defun wisent-javascript-jv-wy--install-parser ()
368 "Setup the Semantic Parser."
369 (semantic-install-function-overrides
370 '((parse-stream . wisent-parse-stream)))
371 (setq semantic-parser-name "LALR"
372 semantic--parse-table wisent-javascript-jv-wy--parse-table
373 semantic-debug-parser-source "wisent-javascript-jv.wy"
374 semantic-flex-keywords-obarray wisent-javascript-jv-wy--keyword-table
375 semantic-lex-types-obarray wisent-javascript-jv-wy--token-table)
376 ;; Collect unmatched syntax lexical tokens
377 (semantic-make-local-hook 'wisent-discarding-token-functions)
378 (add-hook 'wisent-discarding-token-functions
379 'wisent-collect-unmatched-syntax nil t))
384 (define-lex-keyword-type-analyzer wisent-javascript-jv-wy--<keyword>-keyword-analyzer
385 "keyword analyzer for <keyword> tokens."
386 "\\(\\sw\\|\\s_\\)+")
388 (define-lex-block-type-analyzer wisent-javascript-jv-wy--<block>-block-analyzer
389 "block analyzer for <block> tokens."
391 '((("(" OPEN_PARENTHESIS PAREN_BLOCK)
392 ("{" START_BLOCK BRACE_BLOCK)
393 ("[" OPEN_SQ_BRACKETS BRACK_BLOCK))
394 (")" CLOSE_PARENTHESIS)
396 ("]" CLOSE_SQ_BRACKETS))
399 (define-lex-regex-type-analyzer wisent-javascript-jv-wy--<symbol>-regexp-analyzer
400 "regexp analyzer for <symbol> tokens."
405 (define-lex-sexp-type-analyzer wisent-javascript-jv-wy--<string>-sexp-analyzer
406 "sexp analyzer for <string> tokens."
410 (define-lex-regex-type-analyzer wisent-javascript-jv-wy--<number>-regexp-analyzer
411 "regexp analyzer for <number> tokens."
412 semantic-lex-number-expression
416 (define-lex-string-type-analyzer wisent-javascript-jv-wy--<punctuation>-string-analyzer
417 "string analyzer for <punctuation> tokens."
418 "\\(\\s.\\|\\s$\\|\\s'\\)+"
419 '((ONES_COMPLIMENT . "~")
421 (LINE_TERMINATOR . "\n")
431 (MULTIPLY_EQUALS . "*=")
435 (MINUS_EQUALS . "-=")
446 (BITWISE_SHIFT_RIGHT_ZERO_FILL_EQUALS . ">>>=")
447 (BITWISE_SHIFT_RIGHT_ZERO_FILL . ">>>")
448 (BITWISE_SHIFT_RIGHT_EQUALS . ">>=")
449 (BITWISE_SHIFT_RIGHT . ">>")
450 (BITWISE_SHIFT_LEFT_EQUALS . "<<=")
451 (BITWISE_SHIFT_LEFT . "<<")
452 (BITWISE_OR_EQUALS . "|=")
454 (BITWISE_EXCLUSIVE_OR_EQUALS . "^=")
455 (BITWISE_EXCLUSIVE_OR . "^")
456 (BITWISE_AND_EQUALS . "&=")
458 (ASSIGN_SYMBOL . "="))
464 ;;here something like:
465 ;;(define-lex wisent-java-tags-lexer
467 (define-lex javascript-lexer-jv
470 semantic-lex-ignore-whitespace
471 semantic-lex-ignore-newline
472 semantic-lex-ignore-comments
474 ;;stuff generated from the wy file(one for each "type" declaration)
475 wisent-javascript-jv-wy--<number>-regexp-analyzer
476 wisent-javascript-jv-wy--<string>-sexp-analyzer
478 wisent-javascript-jv-wy--<keyword>-keyword-analyzer
480 wisent-javascript-jv-wy--<symbol>-regexp-analyzer
481 wisent-javascript-jv-wy--<punctuation>-string-analyzer
482 wisent-javascript-jv-wy--<block>-block-analyzer
486 semantic-lex-default-action
489 (provide 'semantic/wisent/js-wy)
491 ;;; semantic/wisent/js-wy.el ends here