PageRenderTime 52ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/packages/js2-mode/js2-vars.el

http://github.com/justinlilly/jlilly_emacs
Emacs Lisp | 1149 lines | 850 code | 219 blank | 80 comment | 48 complexity | b2581b953f77d9a4277cf45c2469d73d MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0
  1. ;;; js2-vars.el -- byte-compiler support for js2-mode
  2. ;; Author: Steve Yegge (steve.yegge@gmail.com)
  3. ;; Keywords: javascript languages
  4. ;; This program is free software; you can redistribute it and/or
  5. ;; modify it under the terms of the GNU General Public License as
  6. ;; published by the Free Software Foundation; either version 2 of
  7. ;; the License, or (at your option) any later version.
  8. ;; This program is distributed in the hope that it will be
  9. ;; useful, but WITHOUT ANY WARRANTY; without even the implied
  10. ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. ;; PURPOSE. See the GNU General Public License for more details.
  12. ;; You should have received a copy of the GNU General Public
  13. ;; License along with this program; if not, write to the Free
  14. ;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  15. ;; MA 02111-1307 USA
  16. ;;; Code:
  17. (eval-when-compile
  18. (require 'cl))
  19. (eval-and-compile
  20. (require 'cc-mode) ; (only) for `c-populate-syntax-table'
  21. (require 'cc-langs) ; it's here in Emacs 21...
  22. (require 'cc-engine)) ; for `c-paragraph-start' et. al.
  23. (defvar js2-emacs22 (>= emacs-major-version 22))
  24. (defcustom js2-highlight-level 2
  25. "Amount of syntax highlighting to perform.
  26. nil, zero or negative means none.
  27. 1 adds basic syntax highlighting.
  28. 2 adds highlighting of some Ecma built-in properties.
  29. 3 adds highlighting of many Ecma built-in functions."
  30. :type 'integer
  31. :group 'js2-mode)
  32. (defvar js2-mode-dev-mode-p t
  33. "Non-nil if running in development mode. Normally nil.")
  34. (defgroup js2-mode nil
  35. "An improved JavaScript mode."
  36. :group 'languages)
  37. (defcustom js2-basic-offset (if (and (boundp 'c-basic-offset)
  38. (numberp c-basic-offset))
  39. c-basic-offset
  40. 2)
  41. "Number of spaces to indent nested statements.
  42. Similar to `c-basic-offset'."
  43. :group 'js2-mode
  44. :type 'integer)
  45. (make-variable-buffer-local 'js2-basic-offset)
  46. (defcustom js2-cleanup-whitespace t
  47. "Non-nil to invoke `delete-trailing-whitespace' before saves."
  48. :type 'boolean
  49. :group 'js2-mode)
  50. (defcustom js2-move-point-on-right-click t
  51. "Non-nil to move insertion point when you right-click.
  52. This makes right-click context menu behavior a bit more intuitive,
  53. since menu operations generally apply to the point. The exception
  54. is if there is a region selection, in which case the point does -not-
  55. move, so cut/copy/paste etc. can work properly.
  56. Note that IntelliJ moves the point, and Eclipse leaves it alone,
  57. so this behavior is customizable."
  58. :group 'js2-mode
  59. :type 'boolean)
  60. (defcustom js2-mirror-mode t
  61. "Non-nil to insert closing brackets, parens, etc. automatically."
  62. :group 'js2-mode
  63. :type 'boolean)
  64. (defcustom js2-auto-indent-flag t
  65. "Automatic indentation with punctuation characters. If non-nil, the
  66. current line is indented when certain punctuations are inserted."
  67. :group 'js2-mode
  68. :type 'boolean)
  69. (defcustom js2-bounce-indent-flag t
  70. "Non-nil to have indent-line function choose among alternatives.
  71. If nil, the indent-line function will indent to a predetermined column
  72. based on heuristic guessing. If non-nil, then if the current line is
  73. already indented to that predetermined column, indenting will choose
  74. another likely column and indent to that spot. Repeated invocation of
  75. the indent-line function will cycle among the computed alternatives.
  76. See the function `js2-bounce-indent' for details."
  77. :type 'boolean
  78. :group 'js2-mode)
  79. (defcustom js2-indent-on-enter-key nil
  80. "Non-nil to have Enter/Return key indent the line.
  81. This is unusual for Emacs modes but common in IDEs like Eclipse."
  82. :type 'boolean
  83. :group 'js2-mode)
  84. (defcustom js2-enter-indents-newline t
  85. "Non-nil to have Enter/Return key indent the newly-inserted line.
  86. This is unusual for Emacs modes but common in IDEs like Eclipse."
  87. :type 'boolean
  88. :group 'js2-mode)
  89. (defcustom js2-rebind-eol-bol-keys t
  90. "Non-nil to rebind beginning-of-line and end-of-line keys.
  91. If non-nil, bounce between bol/eol and first/last non-whitespace char."
  92. :group 'js2-mode
  93. :type 'boolean)
  94. (defcustom js2-electric-keys '("{" "}" "(" ")" "[" "]" ":" ";" "," "*")
  95. "Keys that auto-indent when `js2-auto-indent-flag' is non-nil.
  96. Each value in the list is passed to `define-key'."
  97. :type 'list
  98. :group 'js2-mode)
  99. (defcustom js2-idle-timer-delay 0.2
  100. "Delay in secs before re-parsing after user makes changes.
  101. Multiplied by `js2-dynamic-idle-timer-adjust', which see."
  102. :type 'number
  103. :group 'js2-mode)
  104. (make-variable-buffer-local 'js2-idle-timer-delay)
  105. (defcustom js2-dynamic-idle-timer-adjust 0
  106. "Positive to adjust `js2-idle-timer-delay' based on file size.
  107. The idea is that for short files, parsing is faster so we can be
  108. more responsive to user edits without interfering with editing.
  109. The buffer length in characters (typically bytes) is divided by
  110. this value and used to multiply `js2-idle-timer-delay' for the
  111. buffer. For example, a 21k file and 10k adjust yields 21k/10k
  112. == 2, so js2-idle-timer-delay is multiplied by 2.
  113. If `js2-dynamic-idle-timer-adjust' is 0 or negative,
  114. `js2-idle-timer-delay' is not dependent on the file size."
  115. :type 'number
  116. :group 'js2-mode)
  117. (defcustom js2-mode-escape-quotes t
  118. "Non-nil to disable automatic quote-escaping inside strings."
  119. :type 'boolean
  120. :group 'js2-mode)
  121. (defcustom js2-mode-squeeze-spaces t
  122. "Non-nil to normalize whitespace when filling in comments.
  123. Multiple runs of spaces are converted to a single space."
  124. :type 'boolean
  125. :group 'js2-mode)
  126. (defcustom js2-mode-show-parse-errors t
  127. "True to highlight parse errors."
  128. :type 'boolean
  129. :group 'js2-mode)
  130. (defcustom js2-mode-show-strict-warnings t
  131. "Non-nil to emit Ecma strict-mode warnings.
  132. Some of the warnings can be individually disabled by other flags,
  133. even if this flag is non-nil."
  134. :type 'boolean
  135. :group 'js2-mode)
  136. (defcustom js2-strict-trailing-comma-warning t
  137. "Non-nil to warn about trailing commas in array literals.
  138. Ecma-262 forbids them, but many browsers permit them. IE is the
  139. big exception, and can produce bugs if you have trailing commas."
  140. :type 'boolean
  141. :group 'js2-mode)
  142. (defcustom js2-strict-missing-semi-warning t
  143. "Non-nil to warn about semicolon auto-insertion after statement.
  144. Technically this is legal per Ecma-262, but some style guides disallow
  145. depending on it."
  146. :type 'boolean
  147. :group 'js2-mode)
  148. (defcustom js2-missing-semi-one-line-override nil
  149. "Non-nil to permit missing semicolons in one-line functions.
  150. In one-liner functions such as `function identity(x) {return x}'
  151. people often omit the semicolon for a cleaner look. If you are
  152. such a person, you can suppress the missing-semicolon warning
  153. by setting this variable to t."
  154. :type 'boolean
  155. :group 'js2-mode)
  156. (defcustom js2-strict-inconsistent-return-warning t
  157. "Non-nil to warn about mixing returns with value-returns.
  158. It's perfectly legal to have a `return' and a `return foo' in the
  159. same function, but it's often an indicator of a bug, and it also
  160. interferes with type inference (in systems that support it.)"
  161. :type 'boolean
  162. :group 'js2-mode)
  163. (defcustom js2-strict-cond-assign-warning t
  164. "Non-nil to warn about expressions like if (a = b).
  165. This often should have been '==' instead of '='. If the warning
  166. is enabled, you can suppress it on a per-expression basis by
  167. parenthesizing the expression, e.g. if ((a = b)) ..."
  168. :type 'boolean
  169. :group 'js2-mode)
  170. (defcustom js2-strict-cond-assign-warning t
  171. "Non-nil to warn about expressions like if (a = b).
  172. This often should have been '==' instead of '='. If the warning
  173. is enabled, you can suppress it on a per-expression basis by
  174. parenthesizing the expression, e.g. if ((a = b)) ..."
  175. :type 'boolean
  176. :group 'js2-mode)
  177. (defcustom js2-strict-var-redeclaration-warning t
  178. "Non-nil to warn about redeclaring variables in a script or function."
  179. :type 'boolean
  180. :group 'js2-mode)
  181. (defcustom js2-strict-var-hides-function-arg-warning t
  182. "Non-nil to warn about a var decl hiding a function argument."
  183. :type 'boolean
  184. :group 'js2-mode)
  185. (defcustom js2-skip-preprocessor-directives nil
  186. "Non-nil to treat lines beginning with # as comments.
  187. Useful for viewing Mozilla JavaScript source code."
  188. :type 'boolean
  189. :group 'js2-mode)
  190. (defcustom js2-basic-offset c-basic-offset
  191. "Functions like `c-basic-offset' in js2-mode buffers."
  192. :type 'integer
  193. :group 'js2-mode)
  194. (make-variable-buffer-local 'js2-basic-offset)
  195. (defcustom js2-language-version 170
  196. "Configures what JavaScript language version to recognize.
  197. Currently only 150, 160 and 170 are supported, corresponding
  198. to JavaScript 1.5, 1.6 and 1.7, respectively. In a nutshell,
  199. 1.6 adds E4X support, and 1.7 adds let, yield, and Array
  200. comprehensions."
  201. :type 'integer
  202. :group 'js2-mode)
  203. (defcustom js2-allow-keywords-as-property-names t
  204. "If non-nil, you can use JavaScript keywords as object property names.
  205. Examples:
  206. var foo = {int: 5, while: 6, continue: 7};
  207. foo.return = 8;
  208. Ecma-262 forbids this syntax, but many browsers support it."
  209. :type 'boolean
  210. :group 'js2-mode)
  211. (defcustom js2-instanceof-has-side-effects nil
  212. "If non-nil, treats the instanceof operator as having side effects.
  213. This is useful for xulrunner apps."
  214. :type 'boolean
  215. :group 'js2-mode)
  216. (defcustom js2-allow-rhino-new-expr-initializer t
  217. "Non-nil to support a Rhino's experimental syntactic construct.
  218. Rhino supports the ability to follow a `new' expression with an object
  219. literal, which is used to set additional properties on the new object
  220. after calling its constructor. Syntax:
  221. new <expr> [ ( arglist ) ] [initializer]
  222. Hence, this expression:
  223. new Object {a: 1, b: 2}
  224. results in an Object with properties a=1 and b=2. This syntax is
  225. apparently not configurable in Rhino - it's currently always enabled,
  226. as of Rhino version 1.7R2."
  227. :type 'boolean
  228. :group 'js2-mode)
  229. (defcustom js2-allow-member-expr-as-function-name nil
  230. "Non-nil to support experimental Rhino syntax for function names.
  231. Rhino supports an experimental syntax configured via the Rhino Context
  232. setting `allowMemberExprAsFunctionName'. The experimental syntax is:
  233. function <member-expr> ( [ arg-list ] ) { <body> }
  234. Where member-expr is a non-parenthesized 'member expression', which
  235. is anything at the grammar level of a new-expression or lower, meaning
  236. any expression that does not involve infix or unary operators.
  237. When <member-expr> is not a simple identifier, then it is syntactic
  238. sugar for assigning the anonymous function to the <member-expr>. Hence,
  239. this code:
  240. function a.b().c[2] (x, y) { ... }
  241. is rewritten as:
  242. a.b().c[2] = function(x, y) {...}
  243. which doesn't seem particularly useful, but Rhino permits it."
  244. :type 'boolean
  245. :group 'js2-mode)
  246. (defvar js2-mode-version 20080322
  247. "Release number for `js2-mode'.")
  248. ;; scanner variables
  249. ;; We record the start and end position of each token.
  250. (defvar js2-token-beg 1)
  251. (make-variable-buffer-local 'js2-token-beg)
  252. (defvar js2-token-end -1)
  253. (make-variable-buffer-local 'js2-token-end)
  254. (defvar js2-EOF_CHAR -1
  255. "Represents end of stream. Distinct from js2-EOF token type.")
  256. ;; I originally used symbols to represent tokens, but Rhino uses
  257. ;; ints and then sets various flag bits in them, so ints it is.
  258. ;; The upshot is that we need a `js2-' prefix in front of each name.
  259. (defvar js2-ERROR -1)
  260. (defvar js2-EOF 0)
  261. (defvar js2-EOL 1)
  262. (defvar js2-ENTERWITH 2) ; begin interpreter bytecodes
  263. (defvar js2-LEAVEWITH 3)
  264. (defvar js2-RETURN 4)
  265. (defvar js2-GOTO 5)
  266. (defvar js2-IFEQ 6)
  267. (defvar js2-IFNE 7)
  268. (defvar js2-SETNAME 8)
  269. (defvar js2-BITOR 9)
  270. (defvar js2-BITXOR 10)
  271. (defvar js2-BITAND 11)
  272. (defvar js2-EQ 12)
  273. (defvar js2-NE 13)
  274. (defvar js2-LT 14)
  275. (defvar js2-LE 15)
  276. (defvar js2-GT 16)
  277. (defvar js2-GE 17)
  278. (defvar js2-LSH 18)
  279. (defvar js2-RSH 19)
  280. (defvar js2-URSH 20)
  281. (defvar js2-ADD 21) ; infix plus
  282. (defvar js2-SUB 22) ; infix minus
  283. (defvar js2-MUL 23)
  284. (defvar js2-DIV 24)
  285. (defvar js2-MOD 25)
  286. (defvar js2-NOT 26)
  287. (defvar js2-BITNOT 27)
  288. (defvar js2-POS 28) ; unary plus
  289. (defvar js2-NEG 29) ; unary minus
  290. (defvar js2-NEW 30)
  291. (defvar js2-DELPROP 31)
  292. (defvar js2-TYPEOF 32)
  293. (defvar js2-GETPROP 33)
  294. (defvar js2-GETPROPNOWARN 34)
  295. (defvar js2-SETPROP 35)
  296. (defvar js2-GETELEM 36)
  297. (defvar js2-SETELEM 37)
  298. (defvar js2-CALL 38)
  299. (defvar js2-NAME 39) ; an identifier
  300. (defvar js2-NUMBER 40)
  301. (defvar js2-STRING 41)
  302. (defvar js2-NULL 42)
  303. (defvar js2-THIS 43)
  304. (defvar js2-FALSE 44)
  305. (defvar js2-TRUE 45)
  306. (defvar js2-SHEQ 46) ; shallow equality (===)
  307. (defvar js2-SHNE 47) ; shallow inequality (!==)
  308. (defvar js2-REGEXP 48)
  309. (defvar js2-BINDNAME 49)
  310. (defvar js2-THROW 50)
  311. (defvar js2-RETHROW 51) ; rethrow caught exception: catch (e if ) uses it
  312. (defvar js2-IN 52)
  313. (defvar js2-INSTANCEOF 53)
  314. (defvar js2-LOCAL_LOAD 54)
  315. (defvar js2-GETVAR 55)
  316. (defvar js2-SETVAR 56)
  317. (defvar js2-CATCH_SCOPE 57)
  318. (defvar js2-ENUM_INIT_KEYS 58)
  319. (defvar js2-ENUM_INIT_VALUES 59)
  320. (defvar js2-ENUM_INIT_ARRAY 60)
  321. (defvar js2-ENUM_NEXT 61)
  322. (defvar js2-ENUM_ID 62)
  323. (defvar js2-THISFN 63)
  324. (defvar js2-RETURN_RESULT 64) ; to return previously stored return result
  325. (defvar js2-ARRAYLIT 65) ; array literal
  326. (defvar js2-OBJECTLIT 66) ; object literal
  327. (defvar js2-GET_REF 67) ; *reference
  328. (defvar js2-SET_REF 68) ; *reference = something
  329. (defvar js2-DEL_REF 69) ; delete reference
  330. (defvar js2-REF_CALL 70) ; f(args) = something or f(args)++
  331. (defvar js2-REF_SPECIAL 71) ; reference for special properties like __proto
  332. (defvar js2-YIELD 72) ; JS 1.7 yield pseudo keyword
  333. ;; XML support
  334. (defvar js2-DEFAULTNAMESPACE 73)
  335. (defvar js2-ESCXMLATTR 74)
  336. (defvar js2-ESCXMLTEXT 75)
  337. (defvar js2-REF_MEMBER 76) ; Reference for x.@y, x..y etc.
  338. (defvar js2-REF_NS_MEMBER 77) ; Reference for x.ns::y, x..ns::y etc.
  339. (defvar js2-REF_NAME 78) ; Reference for @y, @[y] etc.
  340. (defvar js2-REF_NS_NAME 79) ; Reference for ns::y, @ns::y@[y] etc.
  341. (defvar js2-first-bytecode js2-ENTERWITH)
  342. (defvar js2-last-bytecode js2-REF_NS_NAME)
  343. (defvar js2-TRY 80)
  344. (defvar js2-SEMI 81) ; semicolon
  345. (defvar js2-LB 82) ; left and right brackets
  346. (defvar js2-RB 83)
  347. (defvar js2-LC 84) ; left and right curly-braces
  348. (defvar js2-RC 85)
  349. (defvar js2-LP 86) ; left and right parens
  350. (defvar js2-RP 87)
  351. (defvar js2-COMMA 88) ; comma operator
  352. (defvar js2-ASSIGN 89) ; simple assignment (=)
  353. (defvar js2-ASSIGN_BITOR 90) ; |=
  354. (defvar js2-ASSIGN_BITXOR 91) ; ^=
  355. (defvar js2-ASSIGN_BITAND 92) ; &=
  356. (defvar js2-ASSIGN_LSH 93) ; <<=
  357. (defvar js2-ASSIGN_RSH 94) ; >>=
  358. (defvar js2-ASSIGN_URSH 95) ; >>>=
  359. (defvar js2-ASSIGN_ADD 96) ; +=
  360. (defvar js2-ASSIGN_SUB 97) ; -=
  361. (defvar js2-ASSIGN_MUL 98) ; *=
  362. (defvar js2-ASSIGN_DIV 99) ; /=
  363. (defvar js2-ASSIGN_MOD 100) ; %=
  364. (defvar js2-first-assign js2-ASSIGN)
  365. (defvar js2-last-assign js2-ASSIGN_MOD)
  366. (defvar js2-HOOK 101) ; conditional (?:)
  367. (defvar js2-COLON 102)
  368. (defvar js2-OR 103) ; logical or (||)
  369. (defvar js2-AND 104) ; logical and (&&)
  370. (defvar js2-INC 105) ; increment/decrement (++ --)
  371. (defvar js2-DEC 106)
  372. (defvar js2-DOT 107) ; member operator (.)
  373. (defvar js2-FUNCTION 108) ; function keyword
  374. (defvar js2-EXPORT 109) ; export keyword
  375. (defvar js2-IMPORT 110) ; import keyword
  376. (defvar js2-IF 111) ; if keyword
  377. (defvar js2-ELSE 112) ; else keyword
  378. (defvar js2-SWITCH 113) ; switch keyword
  379. (defvar js2-CASE 114) ; case keyword
  380. (defvar js2-DEFAULT 115) ; default keyword
  381. (defvar js2-WHILE 116) ; while keyword
  382. (defvar js2-DO 117) ; do keyword
  383. (defvar js2-FOR 118) ; for keyword
  384. (defvar js2-BREAK 119) ; break keyword
  385. (defvar js2-CONTINUE 120) ; continue keyword
  386. (defvar js2-VAR 121) ; var keyword
  387. (defvar js2-WITH 122) ; with keyword
  388. (defvar js2-CATCH 123) ; catch keyword
  389. (defvar js2-FINALLY 124) ; finally keyword
  390. (defvar js2-VOID 125) ; void keyword
  391. (defvar js2-RESERVED 126) ; reserved keywords
  392. (defvar js2-EMPTY 127)
  393. ;; Types used for the parse tree - never returned by scanner.
  394. (defvar js2-BLOCK 128) ; statement block
  395. (defvar js2-LABEL 129) ; label
  396. (defvar js2-TARGET 130)
  397. (defvar js2-LOOP 131)
  398. (defvar js2-EXPR_VOID 132) ; expression statement in functions
  399. (defvar js2-EXPR_RESULT 133) ; expression statement in scripts
  400. (defvar js2-JSR 134)
  401. (defvar js2-SCRIPT 135) ; top-level node for entire script
  402. (defvar js2-TYPEOFNAME 136) ; for typeof(simple-name)
  403. (defvar js2-USE_STACK 137)
  404. (defvar js2-SETPROP_OP 138) ; x.y op= something
  405. (defvar js2-SETELEM_OP 139) ; x[y] op= something
  406. (defvar js2-LOCAL_BLOCK 140)
  407. (defvar js2-SET_REF_OP 141) ; *reference op= something
  408. ;; For XML support:
  409. (defvar js2-DOTDOT 142) ; member operator (..)
  410. (defvar js2-COLONCOLON 143) ; namespace::name
  411. (defvar js2-XML 144) ; XML type
  412. (defvar js2-DOTQUERY 145) ; .() -- e.g., x.emps.emp.(name == "terry")
  413. (defvar js2-XMLATTR 146) ; @
  414. (defvar js2-XMLEND 147)
  415. ;; Optimizer-only tokens
  416. (defvar js2-TO_OBJECT 148)
  417. (defvar js2-TO_DOUBLE 149)
  418. (defvar js2-GET 150) ; JS 1.5 get pseudo keyword
  419. (defvar js2-SET 151) ; JS 1.5 set pseudo keyword
  420. (defvar js2-LET 152) ; JS 1.7 let pseudo keyword
  421. (defvar js2-CONST 153)
  422. (defvar js2-SETCONST 154)
  423. (defvar js2-SETCONSTVAR 155)
  424. (defvar js2-ARRAYCOMP 156)
  425. (defvar js2-LETEXPR 157)
  426. (defvar js2-WITHEXPR 158)
  427. (defvar js2-DEBUGGER 159)
  428. (defvar js2-COMMENT 160) ; not yet in Rhino
  429. (defvar js2-num-tokens (1+ js2-COMMENT))
  430. (defconst js2-debug-print-trees nil)
  431. ;; Rhino accepts any string or stream as input.
  432. ;; Emacs character processing works best in buffers, so we'll
  433. ;; assume the input is a buffer. JavaScript strings can be
  434. ;; copied into temp buffers before scanning them.
  435. (defmacro deflocal (name value comment)
  436. `(progn
  437. (defvar ,name ,value ,comment)
  438. (make-variable-buffer-local ',name)))
  439. ;; Buffer-local variables yield much cleaner code than using `defstruct'.
  440. ;; They're the Emacs equivalent of instance variables, more or less.
  441. (deflocal js2-ts-dirty-line nil
  442. "Token stream buffer-local variable.
  443. Indicates stuff other than whitespace since start of line.")
  444. (deflocal js2-ts-regexp-flags nil
  445. "Token stream buffer-local variable.")
  446. (deflocal js2-ts-string ""
  447. "Token stream buffer-local variable.
  448. Last string scanned.")
  449. (deflocal js2-ts-number nil
  450. "Token stream buffer-local variable.
  451. Last literal number scanned.")
  452. (deflocal js2-ts-hit-eof nil
  453. "Token stream buffer-local variable.")
  454. (deflocal js2-ts-line-start 0
  455. "Token stream buffer-local variable.")
  456. (deflocal js2-ts-lineno 1
  457. "Token stream buffer-local variable.")
  458. (deflocal js2-ts-line-end-char -1
  459. "Token stream buffer-local variable.")
  460. (deflocal js2-ts-cursor 1 ; emacs buffers are 1-indexed
  461. "Token stream buffer-local variable.
  462. Current scan position.")
  463. (deflocal js2-ts-is-xml-attribute nil
  464. "Token stream buffer-local variable.")
  465. (deflocal js2-ts-xml-is-tag-content nil
  466. "Token stream buffer-local variable.")
  467. (deflocal js2-ts-xml-open-tags-count 0
  468. "Token stream buffer-local variable.")
  469. (deflocal js2-ts-string-buffer nil
  470. "Token stream buffer-local variable.
  471. List of chars built up while scanning various tokens.")
  472. (deflocal js2-ts-comment-type nil
  473. "Token stream buffer-local variable.")
  474. ;;; Parser variables
  475. (defvar js2-parsed-errors nil
  476. "List of errors produced during scanning/parsing.")
  477. (make-variable-buffer-local 'js2-parsed-errors)
  478. (defvar js2-parsed-warnings nil
  479. "List of warnings produced during scanning/parsing.")
  480. (make-variable-buffer-local 'js2-parsed-warnings)
  481. (defvar js2-recover-from-parse-errors t
  482. "Non-nil to continue parsing after a syntax error.
  483. In recovery mode, the AST will be built in full, and any error
  484. nodes will be flagged with appropriate error information. If
  485. this flag is nil, a syntax error will result in an error being
  486. signaled.
  487. The variable is automatically buffer-local, because different
  488. modes that use the parser will need different settings.")
  489. (make-variable-buffer-local 'js2-recover-from-parse-errors)
  490. (defvar js2-parse-hook nil
  491. "List of callbacks for receiving parsing progress.")
  492. (make-variable-buffer-local 'js2-parse-hook)
  493. (defvar js2-parse-finished-hook nil
  494. "List of callbacks to notify when parsing finishes.
  495. Not called if parsing was interrupted.")
  496. (defvar js2-is-eval-code nil
  497. "True if we're evaluating code in a string.
  498. If non-nil, the tokenizer will record the token text, and the AST nodes
  499. will record their source text. Off by default for IDE modes, since the
  500. text is available in the buffer.")
  501. (make-variable-buffer-local 'js2-is-eval-code)
  502. (defvar js2-parse-ide-mode t
  503. "Non-nil if the parser is being used for `js2-mode'.
  504. If non-nil, the parser will set text properties for fontification
  505. and the syntax-table. The value should be nil when using the
  506. parser as a frontend to an interpreter or byte compiler.")
  507. ;;; Parser instance variables (buffer-local vars for js2-parse)
  508. (defconst js2-clear-ti-mask #xFFFF
  509. "Mask to clear token information bits.")
  510. (defconst js2-ti-after-eol (lsh 1 16)
  511. "Flag: first token of the source line.")
  512. (defconst js2-ti-check-label (lsh 1 17)
  513. "Flag: indicates to check for label.")
  514. ;; Inline Rhino's CompilerEnvirons vars as buffer-locals.
  515. (defvar js2-compiler-generate-debug-info t)
  516. (make-variable-buffer-local 'js2-compiler-generate-debug-info)
  517. (defvar js2-compiler-use-dynamic-scope nil)
  518. (make-variable-buffer-local 'js2-compiler-use-dynamic-scope)
  519. (defvar js2-compiler-reserved-keywords-as-identifier nil)
  520. (make-variable-buffer-local 'js2-compiler-reserved-keywords-as-identifier)
  521. (defvar js2-compiler-xml-available t)
  522. (make-variable-buffer-local 'js2-compiler-xml-available)
  523. (defvar js2-compiler-optimization-level 0)
  524. (make-variable-buffer-local 'js2-compiler-optimization-level)
  525. (defvar js2-compiler-generating-source t)
  526. (make-variable-buffer-local 'js2-compiler-generating-source)
  527. (defvar js2-compiler-strict-mode nil)
  528. (make-variable-buffer-local 'js2-compiler-strict-mode)
  529. (defvar js2-compiler-report-warning-as-error nil)
  530. (make-variable-buffer-local 'js2-compiler-report-warning-as-error)
  531. (defvar js2-compiler-generate-observer-count nil)
  532. (make-variable-buffer-local 'js2-compiler-generate-observer-count)
  533. (defvar js2-compiler-activation-names nil)
  534. (make-variable-buffer-local 'js2-compiler-activation-names)
  535. ;; SKIP: sourceURI
  536. ;; There's a compileFunction method in Context.java - may need it.
  537. (defvar js2-called-by-compile-function nil
  538. "True if `js2-parse' was called by `js2-compile-function'.
  539. Will only be used when we finish implementing the interpreter.")
  540. (make-variable-buffer-local 'js2-called-by-compile-function)
  541. ;; SKIP: ts (we just call `js2-init-scanner' and use its vars)
  542. (defvar js2-current-flagged-token js2-EOF)
  543. (make-variable-buffer-local 'js2-current-flagged-token)
  544. (defvar js2-current-token js2-EOF)
  545. (make-variable-buffer-local 'js2-current-token)
  546. ;; SKIP: node factory - we're going to just call functions directly,
  547. ;; and eventually go to a unified AST format.
  548. (defvar js2-nesting-of-function 0)
  549. (make-variable-buffer-local 'js2-nesting-of-function)
  550. (defvar js2-recorded-assignments nil)
  551. (make-variable-buffer-local 'js2-assignments-from-parse)
  552. ;; SKIP: decompiler
  553. ;; SKIP: encoded-source
  554. ;;; These variables are per-function and should be saved/restored
  555. ;;; during function parsing.
  556. (defvar js2-current-script-or-fn nil)
  557. (make-variable-buffer-local 'js2-current-script-or-fn)
  558. (defvar js2-current-scope nil)
  559. (make-variable-buffer-local 'js2-current-scope)
  560. (defvar js2-nesting-of-with 0)
  561. (make-variable-buffer-local 'js2-nesting-of-with)
  562. (defvar js2-label-set nil
  563. "An alist mapping label names to nodes.")
  564. (make-variable-buffer-local 'js2-label-set)
  565. (defvar js2-loop-set nil)
  566. (make-variable-buffer-local 'js2-loop-set)
  567. (defvar js2-loop-and-switch-set nil)
  568. (make-variable-buffer-local 'js2-loop-and-switch-set)
  569. (defvar js2-has-return-value nil)
  570. (make-variable-buffer-local 'js2-has-return-value)
  571. (defvar js2-end-flags 0)
  572. (make-variable-buffer-local 'js2-end-flags)
  573. ;;; end of per function variables
  574. ;; Without 2-token lookahead, labels are a problem.
  575. ;; These vars store the token info of the last matched name,
  576. ;; iff it wasn't the last matched token. Only valid in some contexts.
  577. (defvar js2-prev-name-token-start nil)
  578. (defvar js2-prev-name-token-string nil)
  579. (defsubst js2-save-name-token-data (pos name)
  580. (setq js2-prev-name-token-start pos
  581. js2-prev-name-token-string name))
  582. ;; These flags enumerate the possible ways a statement/function can
  583. ;; terminate. These flags are used by endCheck() and by the Parser to
  584. ;; detect inconsistent return usage.
  585. ;;
  586. ;; END_UNREACHED is reserved for code paths that are assumed to always be
  587. ;; able to execute (example: throw, continue)
  588. ;;
  589. ;; END_DROPS_OFF indicates if the statement can transfer control to the
  590. ;; next one. Statement such as return dont. A compound statement may have
  591. ;; some branch that drops off control to the next statement.
  592. ;;
  593. ;; END_RETURNS indicates that the statement can return (without arguments)
  594. ;; END_RETURNS_VALUE indicates that the statement can return a value.
  595. ;;
  596. ;; A compound statement such as
  597. ;; if (condition) {
  598. ;; return value;
  599. ;; }
  600. ;; Will be detected as (END_DROPS_OFF | END_RETURN_VALUE) by endCheck()
  601. (defconst js2-end-unreached #x0)
  602. (defconst js2-end-drops-off #x1)
  603. (defconst js2-end-returns #x2)
  604. (defconst js2-end-returns-value #x4)
  605. (defconst js2-end-yields #x8)
  606. ;; Rhino awkwardly passes a statementLabel parameter to the
  607. ;; statementHelper() function, the main statement parser, which
  608. ;; is then used by quite a few of the sub-parsers. We just make
  609. ;; it a buffer-local variable and make sure it's cleaned up properly.
  610. (defvar js2-labeled-stmt nil) ; type `js2-labeled-stmt-node'
  611. (make-variable-buffer-local 'js2-labeled-stmt)
  612. ;; Similarly, Rhino passes an inForInit boolean through about half
  613. ;; the expression parsers. We use a dynamically-scoped variable,
  614. ;; which makes it easier to funcall the parsers individually without
  615. ;; worrying about whether they take the parameter or not.
  616. (defvar js2-in-for-init nil)
  617. (make-variable-buffer-local 'js2-in-for-init)
  618. (defvar js2-temp-name-counter 0)
  619. (make-variable-buffer-local 'js2-temp-name-counter)
  620. (defvar js2-parse-stmt-count 0)
  621. (make-variable-buffer-local 'js2-parse-stmt-count)
  622. (defsubst js2-get-next-temp-name ()
  623. (format "$%d" (incf js2-temp-name-counter)))
  624. (defvar js2-parse-interruptable-p t
  625. "Set this to nil to force parse to continue until finished.
  626. This will mostly be useful for interpreters.")
  627. (defvar js2-statements-per-pause 50
  628. "Pause after this many statements to check for user input.
  629. If user input is pending, stop the parse and discard the tree.
  630. This makes for a smoother user experience for large files.
  631. You may have to wait a second or two before the highlighting
  632. and error-reporting appear, but you can always type ahead if
  633. you wish. This appears to be more or less how Eclipse, IntelliJ
  634. and other editors work.")
  635. (defvar js2-record-comments t
  636. "Instructs the scanner to record comments in `js2-scanned-comments'.")
  637. (make-variable-buffer-local 'js2-record-comments)
  638. (defvar js2-scanned-comments nil
  639. "List of all comments from the current parse.")
  640. (make-variable-buffer-local 'js2-scanned-comments)
  641. (defun js2-underline-color (color)
  642. "Return a legal value for the :underline face attribute based on COLOR."
  643. ;; In XEmacs the :underline attribute can only be a boolean.
  644. ;; In GNU it can be the name of a colour.
  645. (if (featurep 'xemacs)
  646. (if color t nil)
  647. color))
  648. (defcustom js2-mode-indent-inhibit-undo nil
  649. "Non-nil to disable collection of Undo information when indenting lines.
  650. Some users have requested this behavior. It's nil by default because
  651. other Emacs modes don't work this way."
  652. :type 'boolean
  653. :group 'js2-mode)
  654. (defcustom js2-mode-indent-ignore-first-tab nil
  655. "If non-nil, ignore first TAB keypress if we look indented properly.
  656. It's fairly common for users to navigate to an already-indented line
  657. and press TAB for reassurance that it's been indented. For this class
  658. of users, we want the first TAB press on a line to be ignored if the
  659. line is already indented to one of the precomputed alternatives.
  660. This behavior is only partly implemented. If you TAB-indent a line,
  661. navigate to another line, and then navigate back, it fails to clear
  662. the last-indented variable, so it thinks you've already hit TAB once,
  663. and performs the indent. A full solution would involve getting on the
  664. point-motion hooks for the entire buffer. If we come across another
  665. use cases that requires watching point motion, I'll consider doing it.
  666. If you set this variable to nil, then the TAB key will always change
  667. the indentation of the current line, if more than one alternative
  668. indentation spot exists."
  669. :type 'boolean
  670. :group 'js2-mode)
  671. (defvar js2-indent-hook nil
  672. "A hook for user-defined indentation rules.
  673. Functions on this hook should expect two arguments: (LIST INDEX)
  674. The LIST argument is the list of computed indentation points for
  675. the current line. INDEX is the list index of the indentation point
  676. that `js2-bounce-indent' plans to use. If INDEX is nil, then the
  677. indent function is not going to change the current line indentation.
  678. If a hook function on this list returns a non-nil value, then
  679. `js2-bounce-indent' assumes the hook function has performed its own
  680. indentation, and will do nothing. If all hook functions on the list
  681. return nil, then `js2-bounce-indent' will use its computed indentation
  682. and reindent the line.
  683. When hook functions on this hook list are called, the variable
  684. `js2-mode-ast' may or may not be set, depending on whether the
  685. parse tree is available. If the variable is nil, you can pass a
  686. callback to `js2-mode-wait-for-parse', and your callback will be
  687. called after the new parse tree is built. This can take some time
  688. in large files.")
  689. (defface js2-warning-face
  690. `((((class color) (background light))
  691. (:underline ,(js2-underline-color "orange")))
  692. (((class color) (background dark))
  693. (:underline ,(js2-underline-color "orange")))
  694. (t (:underline t)))
  695. "Face for JavaScript warnings."
  696. :group 'js2-mode)
  697. (defface js2-error-face
  698. `((((class color) (background light))
  699. (:foreground "red"))
  700. (((class color) (background dark))
  701. (:foreground "red"))
  702. (t (:foreground "red")))
  703. "Face for JavaScript errors."
  704. :group 'js2-mode)
  705. (defface js2-jsdoc-tag-face
  706. '((t :foreground "SlateGray"))
  707. "Face used to highlight @whatever tags in jsdoc comments."
  708. :group 'js2-mode)
  709. (defface js2-jsdoc-type-face
  710. '((t :foreground "SteelBlue"))
  711. "Face used to highlight {FooBar} types in jsdoc comments."
  712. :group 'js2-mode)
  713. (defface js2-jsdoc-value-face
  714. '((t :foreground "PeachPuff3"))
  715. "Face used to highlight tag values in jsdoc comments."
  716. :group 'js2-mode)
  717. (defface js2-function-param-face
  718. '((t :foreground "SeaGreen"))
  719. "Face used to highlight function parameters in javascript."
  720. :group 'js2-mode)
  721. (defface js2-instance-member-face
  722. '((t :foreground "DarkOrchid"))
  723. "Face used to highlight instance variables in javascript.
  724. Not currently used."
  725. :group 'js2-mode)
  726. (defface js2-private-member-face
  727. '((t :foreground "PeachPuff3"))
  728. "Face used to highlight calls to private methods in javascript.
  729. Not currently used."
  730. :group 'js2-mode)
  731. (defface js2-private-function-call-face
  732. '((t :foreground "goldenrod"))
  733. "Face used to highlight calls to private functions in javascript.
  734. Not currently used."
  735. :group 'js2-mode)
  736. (defface js2-jsdoc-html-tag-name-face
  737. (if js2-emacs22
  738. '((((class color) (min-colors 88) (background light))
  739. (:foreground "rosybrown"))
  740. (((class color) (min-colors 8) (background dark))
  741. (:foreground "yellow"))
  742. (((class color) (min-colors 8) (background light))
  743. (:foreground "magenta")))
  744. '((((type tty pc) (class color) (background light))
  745. (:foreground "magenta"))
  746. (((type tty pc) (class color) (background dark))
  747. (:foreground "yellow"))
  748. (t (:foreground "RosyBrown"))))
  749. "Face used to highlight jsdoc html tag names"
  750. :group 'js2-mode)
  751. (defface js2-jsdoc-html-tag-delimiter-face
  752. (if js2-emacs22
  753. '((((class color) (min-colors 88) (background light))
  754. (:foreground "dark khaki"))
  755. (((class color) (min-colors 8) (background dark))
  756. (:foreground "green"))
  757. (((class color) (min-colors 8) (background light))
  758. (:foreground "green")))
  759. '((((type tty pc) (class color) (background light))
  760. (:foreground "green"))
  761. (((type tty pc) (class color) (background dark))
  762. (:foreground "green"))
  763. (t (:foreground "dark khaki"))))
  764. "Face used to highlight brackets in jsdoc html tags."
  765. :group 'js2-mode)
  766. (defface js2-external-variable-face
  767. '((t :foreground "orange"))
  768. "Face used to highlight assignments to undeclared variables.
  769. An undeclared variable is any variable not declared with var or let
  770. in the current scope or any lexically enclosing scope. If you assign
  771. to such a variable, then you are either expecting it to originate from
  772. another file, or you've got a potential bug."
  773. :group 'js2-mode)
  774. (defcustom js2-highlight-external-variables t
  775. "Non-nil to higlight assignments to undeclared variables."
  776. :type 'boolean
  777. :group 'js2-mode)
  778. (defvar js2-mode-map
  779. (let ((map (make-sparse-keymap))
  780. keys)
  781. (define-key map [mouse-1] #'js2-mode-show-node)
  782. (define-key map "\C-m" #'js2-enter-key)
  783. (when js2-rebind-eol-bol-keys
  784. (define-key map "\C-a" #'js2-beginning-of-line)
  785. (define-key map "\C-e" #'js2-end-of-line))
  786. (define-key map "\C-c\C-e" #'js2-mode-hide-element)
  787. (define-key map "\C-c\C-s" #'js2-mode-show-element)
  788. (define-key map "\C-c\C-a" #'js2-mode-show-all)
  789. (define-key map "\C-c\C-f" #'js2-mode-toggle-hide-functions)
  790. (define-key map "\C-c\C-t" #'js2-mode-toggle-hide-comments)
  791. (define-key map "\C-c\C-o" #'js2-mode-toggle-element)
  792. (define-key map "\C-c\C-w" #'js2-mode-toggle-warnings-and-errors)
  793. (define-key map (kbd "C-c C-'") #'js2-next-error)
  794. ;; also define user's preference for next-error, if available
  795. (if (setq keys (where-is-internal #'next-error))
  796. (define-key map (car keys) #'js2-next-error))
  797. (define-key map (or (car (where-is-internal #'mark-defun))
  798. (kbd "M-C-h"))
  799. #'js2-mark-defun)
  800. (define-key map (or (car (where-is-internal #'narrow-to-defun))
  801. (kbd "C-x nd"))
  802. #'js2-narrow-to-defun)
  803. (define-key map [down-mouse-3] #'js2-mouse-3)
  804. (when js2-auto-indent-flag
  805. (mapc (lambda (key)
  806. (define-key map key #'js2-insert-and-indent))
  807. js2-electric-keys))
  808. (define-key map [menu-bar javascript]
  809. (cons "JavaScript" (make-sparse-keymap "JavaScript")))
  810. (define-key map [menu-bar javascript customize-js2-mode]
  811. '(menu-item "Customize js2-mode" js2-mode-customize
  812. :help "Customize the behavior of this mode"))
  813. (define-key map [menu-bar javascript js2-force-refresh]
  814. '(menu-item "Force buffer refresh" js2-mode-reset
  815. :help "Re-parse the buffer from scratch"))
  816. (define-key map [menu-bar javascript separator-2]
  817. '("--"))
  818. (define-key map [menu-bar javascript next-error]
  819. '(menu-item "Next warning or error" js2-next-error
  820. :enabled (and js2-mode-ast
  821. (or (js2-ast-root-errors js2-mode-ast)
  822. (js2-ast-root-warnings js2-mode-ast)))
  823. :help "Move to next warning or error"))
  824. (define-key map [menu-bar javascript display-errors]
  825. '(menu-item "Show errors and warnings" js2-mode-display-warnings-and-errors
  826. :visible (not js2-mode-show-parse-errors)
  827. :help "Turn on display of warnings and errors"))
  828. (define-key map [menu-bar javascript hide-errors]
  829. '(menu-item "Hide errors and warnings" js2-mode-hide-warnings-and-errors
  830. :visible js2-mode-show-parse-errors
  831. :help "Turn off display of warnings and errors"))
  832. (define-key map [menu-bar javascript separator-1]
  833. '("--"))
  834. (define-key map [menu-bar javascript js2-toggle-function]
  835. '(menu-item "Show/collapse element" js2-mode-toggle-element
  836. :help "Hide or show function body or comment"))
  837. (define-key map [menu-bar javascript show-comments]
  838. '(menu-item "Show block comments" js2-mode-toggle-hide-comments
  839. :visible js2-mode-comments-hidden
  840. :help "Expand all hidden block comments"))
  841. (define-key map [menu-bar javascript hide-comments]
  842. '(menu-item "Hide block comments" js2-mode-toggle-hide-comments
  843. :visible (not js2-mode-comments-hidden)
  844. :help "Show block comments as /*...*/"))
  845. (define-key map [menu-bar javascript show-all-functions]
  846. '(menu-item "Show function bodies" js2-mode-toggle-hide-functions
  847. :visible js2-mode-functions-hidden
  848. :help "Expand all hidden function bodies"))
  849. (define-key map [menu-bar javascript hide-all-functions]
  850. '(menu-item "Hide function bodies" js2-mode-toggle-hide-functions
  851. :visible (not js2-mode-functions-hidden)
  852. :help "Show {...} for all top-level function bodies"))
  853. map)
  854. "Keymap used in `js2-mode' buffers.")
  855. (defconst js2-mode-identifier-re "[a-zA-Z_$][a-zA-Z0-9_$]*")
  856. (defvar js2-mode-//-comment-re "^\\(\\s-*\\)//.+"
  857. "Matches a //-comment line. Must be first non-whitespace on line.
  858. First match-group is the leading whitespace.")
  859. (defvar js2-mode-ast nil "Private variable.")
  860. (make-variable-buffer-local 'js2-mode-ast)
  861. (defvar js2-mode-hook nil)
  862. (defvar js2-mode-parse-timer nil "Private variable.")
  863. (make-variable-buffer-local 'js2-mode-parse-timer)
  864. (defvar js2-mode-buffer-dirty-p nil "Private variable.")
  865. (make-variable-buffer-local 'js2-mode-buffer-dirty-p)
  866. (defvar js2-mode-parsing nil "Private variable.")
  867. (make-variable-buffer-local 'js2-mode-parsing)
  868. (defvar js2-mode-node-overlay nil)
  869. (make-variable-buffer-local 'js2-mode-node-overlay)
  870. (defvar js2-mode-show-overlay js2-mode-dev-mode-p
  871. "Debug: Non-nil to highlight AST nodes on mouse-down.")
  872. (defvar js2-mode-fontifications nil "Private variable")
  873. (make-variable-buffer-local 'js2-mode-fontifications)
  874. (defvar js2-mode-deferred-properties nil "Private variable")
  875. (make-variable-buffer-local 'js2-mode-deferred-properties)
  876. (defvar js2-imenu-recorder nil "Private variable")
  877. (make-variable-buffer-local 'js2-imenu-recorder)
  878. (defvar js2-imenu-function-map nil "Private variable")
  879. (make-variable-buffer-local 'js2-imenu-function-map)
  880. (defvar js2-paragraph-start
  881. "\\(@[a-zA-Z]+\\>\\|$\\)")
  882. ;; Note that we also set a 'c-in-sws text property in html comments,
  883. ;; so that `c-forward-sws' and `c-backward-sws' work properly.
  884. (defvar js2-syntactic-ws-start
  885. "\\s \\|/[*/]\\|[\n\r]\\|\\\\[\n\r]\\|\\s!\\|<!--\\|^\\s-*-->")
  886. (defvar js2-syntactic-ws-end
  887. "\\s \\|[\n\r/]\\|\\s!")
  888. (defvar js2-syntactic-eol
  889. (concat "\\s *\\(/\\*[^*\n\r]*"
  890. "\\(\\*+[^*\n\r/][^*\n\r]*\\)*"
  891. "\\*+/\\s *\\)*"
  892. "\\(//\\|/\\*[^*\n\r]*"
  893. "\\(\\*+[^*\n\r/][^*\n\r]*\\)*$"
  894. "\\|\\\\$\\|$\\)")
  895. "Copied from java-mode. Needed for some cc-engine functions.")
  896. (defvar js2-comment-prefix-regexp
  897. "//+\\|\\**")
  898. (defvar js2-comment-start-skip
  899. "\\(//+\\|/\\*+\\)\\s *")
  900. (defvar js2-mode-verbose-parse-p js2-mode-dev-mode-p
  901. "Non-nil to emit status messages during parsing.")
  902. (defvar js2-mode-functions-hidden nil "private variable")
  903. (defvar js2-mode-comments-hidden nil "private variable")
  904. (defvar js2-mode-syntax-table
  905. (let ((table (make-syntax-table)))
  906. (c-populate-syntax-table table)
  907. table)
  908. "Syntax table used in js2-mode buffers.")
  909. (defvar js2-mode-abbrev-table nil
  910. "Abbrev table in use in `js2-mode' buffers.")
  911. (define-abbrev-table 'js2-mode-abbrev-table ())
  912. (defvar js2-mode-must-byte-compile (not js2-mode-dev-mode-p)
  913. "Non-nil to have `js2-mode' signal an error if not byte-compiled.")
  914. (defvar js2-mode-pending-parse-callbacks nil
  915. "List of functions waiting to be notified that parse is finished.")
  916. (defvar js2-mode-last-indented-line -1)
  917. (eval-when-compile
  918. (defvar c-paragraph-start nil)
  919. (defvar c-paragraph-separate nil)
  920. (defvar c-syntactic-ws-start nil)
  921. (defvar c-syntactic-ws-end nil)
  922. (defvar c-syntactic-eol nil)
  923. (defvar running-xemacs nil)
  924. (defvar font-lock-mode nil)
  925. (defvar font-lock-keywords nil))
  926. (eval-when-compile
  927. (if (< emacs-major-version 22)
  928. (defun c-setup-paragraph-variables () nil)))
  929. (provide 'js2-vars)
  930. ;;; js2-vars.el ends here