js-wy.el 17 KB

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