@quirekit/cm-legacy-modes 0.0.0-stage → 0.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -2
  3. package/README.zh-CN.md +28 -0
  4. package/THIRD_PARTY_NOTICES.md +141 -0
  5. package/UPSTREAM.json +16 -0
  6. package/dist/mode/README.md +52 -0
  7. package/dist/mode/apl.d.ts +2 -0
  8. package/dist/mode/apl.js +140 -0
  9. package/dist/mode/asciiarmor.d.ts +2 -0
  10. package/dist/mode/asciiarmor.js +54 -0
  11. package/dist/mode/asn1.d.ts +12 -0
  12. package/dist/mode/asn1.js +190 -0
  13. package/dist/mode/asterisk.d.ts +2 -0
  14. package/dist/mode/asterisk.js +186 -0
  15. package/dist/mode/brainfuck.d.ts +2 -0
  16. package/dist/mode/brainfuck.js +68 -0
  17. package/dist/mode/clike.d.ts +35 -0
  18. package/dist/mode/clike.js +1019 -0
  19. package/dist/mode/clojure.d.ts +2 -0
  20. package/dist/mode/clojure.js +272 -0
  21. package/dist/mode/cmake.d.ts +2 -0
  22. package/dist/mode/cmake.js +80 -0
  23. package/dist/mode/cobol.d.ts +2 -0
  24. package/dist/mode/cobol.js +234 -0
  25. package/dist/mode/coffeescript.d.ts +2 -0
  26. package/dist/mode/coffeescript.js +327 -0
  27. package/dist/mode/commonlisp.d.ts +2 -0
  28. package/dist/mode/commonlisp.js +107 -0
  29. package/dist/mode/crystal.d.ts +2 -0
  30. package/dist/mode/crystal.js +417 -0
  31. package/dist/mode/css.d.ts +5 -0
  32. package/dist/mode/css.js +846 -0
  33. package/dist/mode/cypher.d.ts +2 -0
  34. package/dist/mode/cypher.js +120 -0
  35. package/dist/mode/d.d.ts +2 -0
  36. package/dist/mode/d.js +203 -0
  37. package/dist/mode/diff.d.ts +2 -0
  38. package/dist/mode/diff.js +29 -0
  39. package/dist/mode/dockerfile.d.ts +2 -0
  40. package/dist/mode/dockerfile.js +198 -0
  41. package/dist/mode/dtd.d.ts +2 -0
  42. package/dist/mode/dtd.js +120 -0
  43. package/dist/mode/dylan.d.ts +2 -0
  44. package/dist/mode/dylan.js +336 -0
  45. package/dist/mode/ebnf.d.ts +2 -0
  46. package/dist/mode/ebnf.js +149 -0
  47. package/dist/mode/ecl.d.ts +2 -0
  48. package/dist/mode/ecl.js +188 -0
  49. package/dist/mode/eiffel.d.ts +2 -0
  50. package/dist/mode/eiffel.js +145 -0
  51. package/dist/mode/elm.d.ts +2 -0
  52. package/dist/mode/elm.js +228 -0
  53. package/dist/mode/erlang.d.ts +2 -0
  54. package/dist/mode/erlang.js +580 -0
  55. package/dist/mode/factor.d.ts +2 -0
  56. package/dist/mode/factor.js +63 -0
  57. package/dist/mode/fcl.d.ts +2 -0
  58. package/dist/mode/fcl.js +153 -0
  59. package/dist/mode/forth.d.ts +2 -0
  60. package/dist/mode/forth.js +162 -0
  61. package/dist/mode/fortran.d.ts +2 -0
  62. package/dist/mode/fortran.js +171 -0
  63. package/dist/mode/gas.d.ts +3 -0
  64. package/dist/mode/gas.js +342 -0
  65. package/dist/mode/gherkin.d.ts +2 -0
  66. package/dist/mode/gherkin.js +146 -0
  67. package/dist/mode/go.d.ts +2 -0
  68. package/dist/mode/go.js +163 -0
  69. package/dist/mode/groovy.d.ts +2 -0
  70. package/dist/mode/groovy.js +226 -0
  71. package/dist/mode/haskell.d.ts +2 -0
  72. package/dist/mode/haskell.js +238 -0
  73. package/dist/mode/haxe.d.ts +3 -0
  74. package/dist/mode/haxe.js +490 -0
  75. package/dist/mode/http.d.ts +2 -0
  76. package/dist/mode/http.js +87 -0
  77. package/dist/mode/idl.d.ts +2 -0
  78. package/dist/mode/idl.js +274 -0
  79. package/dist/mode/javascript.d.ts +5 -0
  80. package/dist/mode/javascript.js +922 -0
  81. package/dist/mode/jinja2.d.ts +2 -0
  82. package/dist/mode/jinja2.js +170 -0
  83. package/dist/mode/julia.d.ts +2 -0
  84. package/dist/mode/julia.js +367 -0
  85. package/dist/mode/livescript.d.ts +2 -0
  86. package/dist/mode/livescript.js +257 -0
  87. package/dist/mode/lua.d.ts +2 -0
  88. package/dist/mode/lua.js +135 -0
  89. package/dist/mode/mathematica.d.ts +2 -0
  90. package/dist/mode/mathematica.js +153 -0
  91. package/dist/mode/mbox.d.ts +2 -0
  92. package/dist/mode/mbox.js +114 -0
  93. package/dist/mode/mirc.d.ts +2 -0
  94. package/dist/mode/mirc.js +174 -0
  95. package/dist/mode/mllike.d.ts +4 -0
  96. package/dist/mode/mllike.js +346 -0
  97. package/dist/mode/modelica.d.ts +2 -0
  98. package/dist/mode/modelica.js +190 -0
  99. package/dist/mode/mscgen.d.ts +4 -0
  100. package/dist/mode/mscgen.js +147 -0
  101. package/dist/mode/mumps.d.ts +2 -0
  102. package/dist/mode/mumps.js +127 -0
  103. package/dist/mode/nginx.d.ts +2 -0
  104. package/dist/mode/nginx.js +161 -0
  105. package/dist/mode/nsis.d.ts +2 -0
  106. package/dist/mode/nsis.js +78 -0
  107. package/dist/mode/ntriples.d.ts +2 -0
  108. package/dist/mode/ntriples.js +139 -0
  109. package/dist/mode/octave.d.ts +2 -0
  110. package/dist/mode/octave.js +123 -0
  111. package/dist/mode/oz.d.ts +2 -0
  112. package/dist/mode/oz.js +233 -0
  113. package/dist/mode/pascal.d.ts +2 -0
  114. package/dist/mode/pascal.js +122 -0
  115. package/dist/mode/pegjs.d.ts +2 -0
  116. package/dist/mode/pegjs.js +85 -0
  117. package/dist/mode/perl.d.ts +2 -0
  118. package/dist/mode/perl.js +818 -0
  119. package/dist/mode/pig.d.ts +2 -0
  120. package/dist/mode/pig.js +147 -0
  121. package/dist/mode/powershell.d.ts +2 -0
  122. package/dist/mode/powershell.js +379 -0
  123. package/dist/mode/properties.d.ts +2 -0
  124. package/dist/mode/properties.js +60 -0
  125. package/dist/mode/protobuf.d.ts +2 -0
  126. package/dist/mode/protobuf.js +55 -0
  127. package/dist/mode/pug.d.ts +2 -0
  128. package/dist/mode/pug.js +502 -0
  129. package/dist/mode/puppet.d.ts +2 -0
  130. package/dist/mode/puppet.js +203 -0
  131. package/dist/mode/python.d.ts +3 -0
  132. package/dist/mode/python.js +388 -0
  133. package/dist/mode/q.d.ts +2 -0
  134. package/dist/mode/q.js +124 -0
  135. package/dist/mode/r.d.ts +2 -0
  136. package/dist/mode/r.js +172 -0
  137. package/dist/mode/rpm.d.ts +3 -0
  138. package/dist/mode/rpm.js +88 -0
  139. package/dist/mode/ruby.d.ts +2 -0
  140. package/dist/mode/ruby.js +287 -0
  141. package/dist/mode/rust.d.ts +2 -0
  142. package/dist/mode/rust.js +54 -0
  143. package/dist/mode/sas.d.ts +2 -0
  144. package/dist/mode/sas.js +266 -0
  145. package/dist/mode/sass.d.ts +2 -0
  146. package/dist/mode/sass.js +427 -0
  147. package/dist/mode/scheme.d.ts +2 -0
  148. package/dist/mode/scheme.js +261 -0
  149. package/dist/mode/shell.d.ts +2 -0
  150. package/dist/mode/shell.js +146 -0
  151. package/dist/mode/sieve.d.ts +2 -0
  152. package/dist/mode/sieve.js +176 -0
  153. package/dist/mode/simple-mode.d.ts +14 -0
  154. package/dist/mode/simple-mode.js +136 -0
  155. package/dist/mode/smalltalk.d.ts +2 -0
  156. package/dist/mode/smalltalk.js +151 -0
  157. package/dist/mode/solr.d.ts +2 -0
  158. package/dist/mode/solr.js +78 -0
  159. package/dist/mode/sparql.d.ts +2 -0
  160. package/dist/mode/sparql.js +169 -0
  161. package/dist/mode/spreadsheet.d.ts +2 -0
  162. package/dist/mode/spreadsheet.js +96 -0
  163. package/dist/mode/sql.d.ts +27 -0
  164. package/dist/mode/sql.js +481 -0
  165. package/dist/mode/stex.d.ts +3 -0
  166. package/dist/mode/stex.js +245 -0
  167. package/dist/mode/stylus.d.ts +2 -0
  168. package/dist/mode/stylus.js +747 -0
  169. package/dist/mode/swift.d.ts +2 -0
  170. package/dist/mode/swift.js +200 -0
  171. package/dist/mode/tcl.d.ts +2 -0
  172. package/dist/mode/tcl.js +123 -0
  173. package/dist/mode/textile.d.ts +2 -0
  174. package/dist/mode/textile.js +440 -0
  175. package/dist/mode/tiddlywiki.d.ts +2 -0
  176. package/dist/mode/tiddlywiki.js +277 -0
  177. package/dist/mode/tiki.d.ts +2 -0
  178. package/dist/mode/tiki.js +291 -0
  179. package/dist/mode/toml.d.ts +2 -0
  180. package/dist/mode/toml.js +74 -0
  181. package/dist/mode/troff.d.ts +2 -0
  182. package/dist/mode/troff.js +63 -0
  183. package/dist/mode/ttcn-cfg.d.ts +2 -0
  184. package/dist/mode/ttcn-cfg.js +199 -0
  185. package/dist/mode/ttcn.d.ts +2 -0
  186. package/dist/mode/ttcn.js +255 -0
  187. package/dist/mode/turtle.d.ts +2 -0
  188. package/dist/mode/turtle.js +145 -0
  189. package/dist/mode/vb.d.ts +2 -0
  190. package/dist/mode/vb.js +254 -0
  191. package/dist/mode/vbscript.d.ts +3 -0
  192. package/dist/mode/vbscript.js +320 -0
  193. package/dist/mode/velocity.d.ts +2 -0
  194. package/dist/mode/velocity.js +184 -0
  195. package/dist/mode/verilog.d.ts +3 -0
  196. package/dist/mode/verilog.js +601 -0
  197. package/dist/mode/vhdl.d.ts +2 -0
  198. package/dist/mode/vhdl.js +172 -0
  199. package/dist/mode/wast.d.ts +2 -0
  200. package/dist/mode/wast.js +119 -0
  201. package/dist/mode/webidl.d.ts +2 -0
  202. package/dist/mode/webidl.js +179 -0
  203. package/dist/mode/xml.d.ts +3 -0
  204. package/dist/mode/xml.js +397 -0
  205. package/dist/mode/xquery.d.ts +2 -0
  206. package/dist/mode/xquery.js +415 -0
  207. package/dist/mode/yacas.d.ts +2 -0
  208. package/dist/mode/yacas.js +181 -0
  209. package/dist/mode/yaml.d.ts +2 -0
  210. package/dist/mode/yaml.js +101 -0
  211. package/dist/mode/z80.d.ts +3 -0
  212. package/dist/mode/z80.js +101 -0
  213. package/mode/README.md +52 -0
  214. package/mode/apl.d.ts +2 -0
  215. package/mode/apl.js +140 -0
  216. package/mode/asciiarmor.d.ts +2 -0
  217. package/mode/asciiarmor.js +54 -0
  218. package/mode/asn1.d.ts +12 -0
  219. package/mode/asn1.js +190 -0
  220. package/mode/asterisk.d.ts +2 -0
  221. package/mode/asterisk.js +186 -0
  222. package/mode/brainfuck.d.ts +2 -0
  223. package/mode/brainfuck.js +68 -0
  224. package/mode/clike.d.ts +35 -0
  225. package/mode/clike.js +1019 -0
  226. package/mode/clojure.d.ts +2 -0
  227. package/mode/clojure.js +272 -0
  228. package/mode/cmake.d.ts +2 -0
  229. package/mode/cmake.js +80 -0
  230. package/mode/cobol.d.ts +2 -0
  231. package/mode/cobol.js +234 -0
  232. package/mode/coffeescript.d.ts +2 -0
  233. package/mode/coffeescript.js +327 -0
  234. package/mode/commonlisp.d.ts +2 -0
  235. package/mode/commonlisp.js +107 -0
  236. package/mode/crystal.d.ts +2 -0
  237. package/mode/crystal.js +417 -0
  238. package/mode/css.d.ts +5 -0
  239. package/mode/css.js +846 -0
  240. package/mode/cypher.d.ts +2 -0
  241. package/mode/cypher.js +120 -0
  242. package/mode/d.d.ts +2 -0
  243. package/mode/d.js +203 -0
  244. package/mode/diff.d.ts +2 -0
  245. package/mode/diff.js +29 -0
  246. package/mode/dockerfile.d.ts +2 -0
  247. package/mode/dockerfile.js +198 -0
  248. package/mode/dtd.d.ts +2 -0
  249. package/mode/dtd.js +120 -0
  250. package/mode/dylan.d.ts +2 -0
  251. package/mode/dylan.js +336 -0
  252. package/mode/ebnf.d.ts +2 -0
  253. package/mode/ebnf.js +149 -0
  254. package/mode/ecl.d.ts +2 -0
  255. package/mode/ecl.js +188 -0
  256. package/mode/eiffel.d.ts +2 -0
  257. package/mode/eiffel.js +145 -0
  258. package/mode/elm.d.ts +2 -0
  259. package/mode/elm.js +228 -0
  260. package/mode/erlang.d.ts +2 -0
  261. package/mode/erlang.js +580 -0
  262. package/mode/factor.d.ts +2 -0
  263. package/mode/factor.js +63 -0
  264. package/mode/fcl.d.ts +2 -0
  265. package/mode/fcl.js +153 -0
  266. package/mode/forth.d.ts +2 -0
  267. package/mode/forth.js +162 -0
  268. package/mode/fortran.d.ts +2 -0
  269. package/mode/fortran.js +171 -0
  270. package/mode/gas.d.ts +3 -0
  271. package/mode/gas.js +342 -0
  272. package/mode/gherkin.d.ts +2 -0
  273. package/mode/gherkin.js +146 -0
  274. package/mode/go.d.ts +2 -0
  275. package/mode/go.js +163 -0
  276. package/mode/groovy.d.ts +2 -0
  277. package/mode/groovy.js +226 -0
  278. package/mode/haskell.d.ts +2 -0
  279. package/mode/haskell.js +238 -0
  280. package/mode/haxe.d.ts +3 -0
  281. package/mode/haxe.js +490 -0
  282. package/mode/http.d.ts +2 -0
  283. package/mode/http.js +87 -0
  284. package/mode/idl.d.ts +2 -0
  285. package/mode/idl.js +274 -0
  286. package/mode/javascript.d.ts +5 -0
  287. package/mode/javascript.js +922 -0
  288. package/mode/jinja2.d.ts +2 -0
  289. package/mode/jinja2.js +170 -0
  290. package/mode/julia.d.ts +2 -0
  291. package/mode/julia.js +367 -0
  292. package/mode/livescript.d.ts +2 -0
  293. package/mode/livescript.js +257 -0
  294. package/mode/lua.d.ts +2 -0
  295. package/mode/lua.js +135 -0
  296. package/mode/mathematica.d.ts +2 -0
  297. package/mode/mathematica.js +153 -0
  298. package/mode/mbox.d.ts +2 -0
  299. package/mode/mbox.js +114 -0
  300. package/mode/mirc.d.ts +2 -0
  301. package/mode/mirc.js +174 -0
  302. package/mode/mllike.d.ts +4 -0
  303. package/mode/mllike.js +346 -0
  304. package/mode/modelica.d.ts +2 -0
  305. package/mode/modelica.js +190 -0
  306. package/mode/mscgen.d.ts +4 -0
  307. package/mode/mscgen.js +147 -0
  308. package/mode/mumps.d.ts +2 -0
  309. package/mode/mumps.js +127 -0
  310. package/mode/nginx.d.ts +2 -0
  311. package/mode/nginx.js +161 -0
  312. package/mode/nsis.d.ts +2 -0
  313. package/mode/nsis.js +78 -0
  314. package/mode/ntriples.d.ts +2 -0
  315. package/mode/ntriples.js +139 -0
  316. package/mode/octave.d.ts +2 -0
  317. package/mode/octave.js +123 -0
  318. package/mode/oz.d.ts +2 -0
  319. package/mode/oz.js +233 -0
  320. package/mode/pascal.d.ts +2 -0
  321. package/mode/pascal.js +122 -0
  322. package/mode/pegjs.d.ts +2 -0
  323. package/mode/pegjs.js +85 -0
  324. package/mode/perl.d.ts +2 -0
  325. package/mode/perl.js +818 -0
  326. package/mode/pig.d.ts +2 -0
  327. package/mode/pig.js +147 -0
  328. package/mode/powershell.d.ts +2 -0
  329. package/mode/powershell.js +379 -0
  330. package/mode/properties.d.ts +2 -0
  331. package/mode/properties.js +60 -0
  332. package/mode/protobuf.d.ts +2 -0
  333. package/mode/protobuf.js +55 -0
  334. package/mode/pug.d.ts +2 -0
  335. package/mode/pug.js +502 -0
  336. package/mode/puppet.d.ts +2 -0
  337. package/mode/puppet.js +203 -0
  338. package/mode/python.d.ts +3 -0
  339. package/mode/python.js +388 -0
  340. package/mode/q.d.ts +2 -0
  341. package/mode/q.js +124 -0
  342. package/mode/r.d.ts +2 -0
  343. package/mode/r.js +172 -0
  344. package/mode/rpm.d.ts +3 -0
  345. package/mode/rpm.js +88 -0
  346. package/mode/ruby.d.ts +2 -0
  347. package/mode/ruby.js +287 -0
  348. package/mode/rust.d.ts +2 -0
  349. package/mode/rust.js +54 -0
  350. package/mode/sas.d.ts +2 -0
  351. package/mode/sas.js +266 -0
  352. package/mode/sass.d.ts +2 -0
  353. package/mode/sass.js +427 -0
  354. package/mode/scheme.d.ts +2 -0
  355. package/mode/scheme.js +261 -0
  356. package/mode/shell.d.ts +2 -0
  357. package/mode/shell.js +146 -0
  358. package/mode/sieve.d.ts +2 -0
  359. package/mode/sieve.js +176 -0
  360. package/mode/simple-mode.d.ts +14 -0
  361. package/mode/simple-mode.js +136 -0
  362. package/mode/smalltalk.d.ts +2 -0
  363. package/mode/smalltalk.js +151 -0
  364. package/mode/solr.d.ts +2 -0
  365. package/mode/solr.js +78 -0
  366. package/mode/sparql.d.ts +2 -0
  367. package/mode/sparql.js +169 -0
  368. package/mode/spreadsheet.d.ts +2 -0
  369. package/mode/spreadsheet.js +96 -0
  370. package/mode/sql.d.ts +27 -0
  371. package/mode/sql.js +481 -0
  372. package/mode/stex.d.ts +3 -0
  373. package/mode/stex.js +245 -0
  374. package/mode/stylus.d.ts +2 -0
  375. package/mode/stylus.js +747 -0
  376. package/mode/swift.d.ts +2 -0
  377. package/mode/swift.js +200 -0
  378. package/mode/tcl.d.ts +2 -0
  379. package/mode/tcl.js +123 -0
  380. package/mode/textile.d.ts +2 -0
  381. package/mode/textile.js +440 -0
  382. package/mode/tiddlywiki.d.ts +2 -0
  383. package/mode/tiddlywiki.js +277 -0
  384. package/mode/tiki.d.ts +2 -0
  385. package/mode/tiki.js +291 -0
  386. package/mode/toml.d.ts +2 -0
  387. package/mode/toml.js +74 -0
  388. package/mode/troff.d.ts +2 -0
  389. package/mode/troff.js +63 -0
  390. package/mode/ttcn-cfg.d.ts +2 -0
  391. package/mode/ttcn-cfg.js +199 -0
  392. package/mode/ttcn.d.ts +2 -0
  393. package/mode/ttcn.js +255 -0
  394. package/mode/turtle.d.ts +2 -0
  395. package/mode/turtle.js +145 -0
  396. package/mode/vb.d.ts +2 -0
  397. package/mode/vb.js +254 -0
  398. package/mode/vbscript.d.ts +3 -0
  399. package/mode/vbscript.js +320 -0
  400. package/mode/velocity.d.ts +2 -0
  401. package/mode/velocity.js +184 -0
  402. package/mode/verilog.d.ts +3 -0
  403. package/mode/verilog.js +601 -0
  404. package/mode/vhdl.d.ts +2 -0
  405. package/mode/vhdl.js +172 -0
  406. package/mode/wast.d.ts +2 -0
  407. package/mode/wast.js +119 -0
  408. package/mode/webidl.d.ts +2 -0
  409. package/mode/webidl.js +179 -0
  410. package/mode/xml.d.ts +3 -0
  411. package/mode/xml.js +397 -0
  412. package/mode/xquery.d.ts +2 -0
  413. package/mode/xquery.js +415 -0
  414. package/mode/yacas.d.ts +2 -0
  415. package/mode/yacas.js +181 -0
  416. package/mode/yaml.d.ts +2 -0
  417. package/mode/yaml.js +101 -0
  418. package/mode/z80.d.ts +3 -0
  419. package/mode/z80.js +101 -0
  420. package/package.json +37 -3
package/mode/perl.js ADDED
@@ -0,0 +1,818 @@
1
+
2
+ // it's like "peek", but need for look-ahead or look-behind if index < 0
3
+ function look(stream, c){
4
+ return stream.string.charAt(stream.pos+(c||0));
5
+ }
6
+
7
+ // return a part of prefix of current stream from current position
8
+ function prefix(stream, c){
9
+ if(c){
10
+ var x=stream.pos-c;
11
+ return stream.string.substr((x>=0?x:0),c);}
12
+ else{
13
+ return stream.string.substr(0,stream.pos-1);
14
+ }
15
+ }
16
+
17
+ // return a part of suffix of current stream from current position
18
+ function suffix(stream, c){
19
+ var y=stream.string.length;
20
+ var x=y-stream.pos+1;
21
+ return stream.string.substr(stream.pos,(c&&c<y?c:x));
22
+ }
23
+
24
+ // eating and vomiting a part of stream from current position
25
+ function eatSuffix(stream, c){
26
+ var x=stream.pos+c;
27
+ var y;
28
+ if(x<=0)
29
+ stream.pos=0;
30
+ else if(x>=(y=stream.string.length-1))
31
+ stream.pos=y;
32
+ else
33
+ stream.pos=x;
34
+ }
35
+
36
+ // http://perldoc.perl.org
37
+ var PERL={ // null - magic touch
38
+ // 1 - keyword
39
+ // 2 - def
40
+ // 3 - atom
41
+ // 4 - operator
42
+ // 5 - builtin (predefined)
43
+ // [x,y] - x=1,2,3; y=must be defined if x{...}
44
+ // PERL operators
45
+ '->': 4,
46
+ '++': 4,
47
+ '--': 4,
48
+ '**': 4,
49
+ // ! ~ \ and unary + and -
50
+ '=~': 4,
51
+ '!~': 4,
52
+ '*': 4,
53
+ '/': 4,
54
+ '%': 4,
55
+ 'x': 4,
56
+ '+': 4,
57
+ '-': 4,
58
+ '.': 4,
59
+ '<<': 4,
60
+ '>>': 4,
61
+ // named unary operators
62
+ '<': 4,
63
+ '>': 4,
64
+ '<=': 4,
65
+ '>=': 4,
66
+ 'lt': 4,
67
+ 'gt': 4,
68
+ 'le': 4,
69
+ 'ge': 4,
70
+ '==': 4,
71
+ '!=': 4,
72
+ '<=>': 4,
73
+ 'eq': 4,
74
+ 'ne': 4,
75
+ 'cmp': 4,
76
+ '~~': 4,
77
+ '&': 4,
78
+ '|': 4,
79
+ '^': 4,
80
+ '&&': 4,
81
+ '||': 4,
82
+ '//': 4,
83
+ '..': 4,
84
+ '...': 4,
85
+ '?': 4,
86
+ ':': 4,
87
+ '=': 4,
88
+ '+=': 4,
89
+ '-=': 4,
90
+ '*=': 4, // etc. ???
91
+ ',': 4,
92
+ '=>': 4,
93
+ '::': 4,
94
+ // list operators (rightward)
95
+ 'not': 4,
96
+ 'and': 4,
97
+ 'or': 4,
98
+ 'xor': 4,
99
+ // PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;)
100
+ 'BEGIN': [5,1],
101
+ 'END': [5,1],
102
+ 'PRINT': [5,1],
103
+ 'PRINTF': [5,1],
104
+ 'GETC': [5,1],
105
+ 'READ': [5,1],
106
+ 'READLINE': [5,1],
107
+ 'DESTROY': [5,1],
108
+ 'TIE': [5,1],
109
+ 'TIEHANDLE': [5,1],
110
+ 'UNTIE': [5,1],
111
+ 'STDIN': 5,
112
+ 'STDIN_TOP': 5,
113
+ 'STDOUT': 5,
114
+ 'STDOUT_TOP': 5,
115
+ 'STDERR': 5,
116
+ 'STDERR_TOP': 5,
117
+ '$ARG': 5,
118
+ '$_': 5,
119
+ '@ARG': 5,
120
+ '@_': 5,
121
+ '$LIST_SEPARATOR': 5,
122
+ '$"': 5,
123
+ '$PROCESS_ID': 5,
124
+ '$PID': 5,
125
+ '$$': 5,
126
+ '$REAL_GROUP_ID': 5,
127
+ '$GID': 5,
128
+ '$(': 5,
129
+ '$EFFECTIVE_GROUP_ID': 5,
130
+ '$EGID': 5,
131
+ '$)': 5,
132
+ '$PROGRAM_NAME': 5,
133
+ '$0': 5,
134
+ '$SUBSCRIPT_SEPARATOR': 5,
135
+ '$SUBSEP': 5,
136
+ '$;': 5,
137
+ '$REAL_USER_ID': 5,
138
+ '$UID': 5,
139
+ '$<': 5,
140
+ '$EFFECTIVE_USER_ID': 5,
141
+ '$EUID': 5,
142
+ '$>': 5,
143
+ '$a': 5,
144
+ '$b': 5,
145
+ '$COMPILING': 5,
146
+ '$^C': 5,
147
+ '$DEBUGGING': 5,
148
+ '$^D': 5,
149
+ '${^ENCODING}': 5,
150
+ '$ENV': 5,
151
+ '%ENV': 5,
152
+ '$SYSTEM_FD_MAX': 5,
153
+ '$^F': 5,
154
+ '@F': 5,
155
+ '${^GLOBAL_PHASE}': 5,
156
+ '$^H': 5,
157
+ '%^H': 5,
158
+ '@INC': 5,
159
+ '%INC': 5,
160
+ '$INPLACE_EDIT': 5,
161
+ '$^I': 5,
162
+ '$^M': 5,
163
+ '$OSNAME': 5,
164
+ '$^O': 5,
165
+ '${^OPEN}': 5,
166
+ '$PERLDB': 5,
167
+ '$^P': 5,
168
+ '$SIG': 5,
169
+ '%SIG': 5,
170
+ '$BASETIME': 5,
171
+ '$^T': 5,
172
+ '${^TAINT}': 5,
173
+ '${^UNICODE}': 5,
174
+ '${^UTF8CACHE}': 5,
175
+ '${^UTF8LOCALE}': 5,
176
+ '$PERL_VERSION': 5,
177
+ '$^V': 5,
178
+ '${^WIN32_SLOPPY_STAT}': 5,
179
+ '$EXECUTABLE_NAME': 5,
180
+ '$^X': 5,
181
+ '$1': 5, // - regexp $1, $2...
182
+ '$MATCH': 5,
183
+ '$&': 5,
184
+ '${^MATCH}': 5,
185
+ '$PREMATCH': 5,
186
+ '$`': 5,
187
+ '${^PREMATCH}': 5,
188
+ '$POSTMATCH': 5,
189
+ "$'": 5,
190
+ '${^POSTMATCH}': 5,
191
+ '$LAST_PAREN_MATCH': 5,
192
+ '$+': 5,
193
+ '$LAST_SUBMATCH_RESULT': 5,
194
+ '$^N': 5,
195
+ '@LAST_MATCH_END': 5,
196
+ '@+': 5,
197
+ '%LAST_PAREN_MATCH': 5,
198
+ '%+': 5,
199
+ '@LAST_MATCH_START': 5,
200
+ '@-': 5,
201
+ '%LAST_MATCH_START': 5,
202
+ '%-': 5,
203
+ '$LAST_REGEXP_CODE_RESULT': 5,
204
+ '$^R': 5,
205
+ '${^RE_DEBUG_FLAGS}': 5,
206
+ '${^RE_TRIE_MAXBUF}': 5,
207
+ '$ARGV': 5,
208
+ '@ARGV': 5,
209
+ 'ARGV': 5,
210
+ 'ARGVOUT': 5,
211
+ '$OUTPUT_FIELD_SEPARATOR': 5,
212
+ '$OFS': 5,
213
+ '$,': 5,
214
+ '$INPUT_LINE_NUMBER': 5,
215
+ '$NR': 5,
216
+ '$.': 5,
217
+ '$INPUT_RECORD_SEPARATOR': 5,
218
+ '$RS': 5,
219
+ '$/': 5,
220
+ '$OUTPUT_RECORD_SEPARATOR': 5,
221
+ '$ORS': 5,
222
+ '$\\': 5,
223
+ '$OUTPUT_AUTOFLUSH': 5,
224
+ '$|': 5,
225
+ '$ACCUMULATOR': 5,
226
+ '$^A': 5,
227
+ '$FORMAT_FORMFEED': 5,
228
+ '$^L': 5,
229
+ '$FORMAT_PAGE_NUMBER': 5,
230
+ '$%': 5,
231
+ '$FORMAT_LINES_LEFT': 5,
232
+ '$-': 5,
233
+ '$FORMAT_LINE_BREAK_CHARACTERS': 5,
234
+ '$:': 5,
235
+ '$FORMAT_LINES_PER_PAGE': 5,
236
+ '$=': 5,
237
+ '$FORMAT_TOP_NAME': 5,
238
+ '$^': 5,
239
+ '$FORMAT_NAME': 5,
240
+ '$~': 5,
241
+ '${^CHILD_ERROR_NATIVE}': 5,
242
+ '$EXTENDED_OS_ERROR': 5,
243
+ '$^E': 5,
244
+ '$EXCEPTIONS_BEING_CAUGHT': 5,
245
+ '$^S': 5,
246
+ '$WARNING': 5,
247
+ '$^W': 5,
248
+ '${^WARNING_BITS}': 5,
249
+ '$OS_ERROR': 5,
250
+ '$ERRNO': 5,
251
+ '$!': 5,
252
+ '%OS_ERROR': 5,
253
+ '%ERRNO': 5,
254
+ '%!': 5,
255
+ '$CHILD_ERROR': 5,
256
+ '$?': 5,
257
+ '$EVAL_ERROR': 5,
258
+ '$@': 5,
259
+ '$OFMT': 5,
260
+ '$#': 5,
261
+ '$*': 5,
262
+ '$ARRAY_BASE': 5,
263
+ '$[': 5,
264
+ '$OLD_PERL_VERSION': 5,
265
+ '$]': 5,
266
+ // PERL blocks
267
+ 'if':[1,1],
268
+ elsif:[1,1],
269
+ 'else':[1,1],
270
+ 'while':[1,1],
271
+ unless:[1,1],
272
+ 'for':[1,1],
273
+ foreach:[1,1],
274
+ // PERL functions
275
+ 'abs':1, // - absolute value function
276
+ accept:1, // - accept an incoming socket connect
277
+ alarm:1, // - schedule a SIGALRM
278
+ 'atan2':1, // - arctangent of Y/X in the range -PI to PI
279
+ bind:1, // - binds an address to a socket
280
+ binmode:1, // - prepare binary files for I/O
281
+ bless:1, // - create an object
282
+ bootstrap:1, //
283
+ 'break':1, // - break out of a "given" block
284
+ caller:1, // - get context of the current subroutine call
285
+ chdir:1, // - change your current working directory
286
+ chmod:1, // - changes the permissions on a list of files
287
+ chomp:1, // - remove a trailing record separator from a string
288
+ chop:1, // - remove the last character from a string
289
+ chown:1, // - change the ownership on a list of files
290
+ chr:1, // - get character this number represents
291
+ chroot:1, // - make directory new root for path lookups
292
+ close:1, // - close file (or pipe or socket) handle
293
+ closedir:1, // - close directory handle
294
+ connect:1, // - connect to a remote socket
295
+ 'continue':[1,1], // - optional trailing block in a while or foreach
296
+ 'cos':1, // - cosine function
297
+ crypt:1, // - one-way passwd-style encryption
298
+ dbmclose:1, // - breaks binding on a tied dbm file
299
+ dbmopen:1, // - create binding on a tied dbm file
300
+ 'default':1, //
301
+ defined:1, // - test whether a value, variable, or function is defined
302
+ 'delete':1, // - deletes a value from a hash
303
+ die:1, // - raise an exception or bail out
304
+ 'do':1, // - turn a BLOCK into a TERM
305
+ dump:1, // - create an immediate core dump
306
+ each:1, // - retrieve the next key/value pair from a hash
307
+ endgrent:1, // - be done using group file
308
+ endhostent:1, // - be done using hosts file
309
+ endnetent:1, // - be done using networks file
310
+ endprotoent:1, // - be done using protocols file
311
+ endpwent:1, // - be done using passwd file
312
+ endservent:1, // - be done using services file
313
+ eof:1, // - test a filehandle for its end
314
+ 'eval':1, // - catch exceptions or compile and run code
315
+ 'exec':1, // - abandon this program to run another
316
+ exists:1, // - test whether a hash key is present
317
+ exit:1, // - terminate this program
318
+ 'exp':1, // - raise I to a power
319
+ fcntl:1, // - file control system call
320
+ fileno:1, // - return file descriptor from filehandle
321
+ flock:1, // - lock an entire file with an advisory lock
322
+ fork:1, // - create a new process just like this one
323
+ format:1, // - declare a picture format with use by the write() function
324
+ formline:1, // - internal function used for formats
325
+ getc:1, // - get the next character from the filehandle
326
+ getgrent:1, // - get next group record
327
+ getgrgid:1, // - get group record given group user ID
328
+ getgrnam:1, // - get group record given group name
329
+ gethostbyaddr:1, // - get host record given its address
330
+ gethostbyname:1, // - get host record given name
331
+ gethostent:1, // - get next hosts record
332
+ getlogin:1, // - return who logged in at this tty
333
+ getnetbyaddr:1, // - get network record given its address
334
+ getnetbyname:1, // - get networks record given name
335
+ getnetent:1, // - get next networks record
336
+ getpeername:1, // - find the other end of a socket connection
337
+ getpgrp:1, // - get process group
338
+ getppid:1, // - get parent process ID
339
+ getpriority:1, // - get current nice value
340
+ getprotobyname:1, // - get protocol record given name
341
+ getprotobynumber:1, // - get protocol record numeric protocol
342
+ getprotoent:1, // - get next protocols record
343
+ getpwent:1, // - get next passwd record
344
+ getpwnam:1, // - get passwd record given user login name
345
+ getpwuid:1, // - get passwd record given user ID
346
+ getservbyname:1, // - get services record given its name
347
+ getservbyport:1, // - get services record given numeric port
348
+ getservent:1, // - get next services record
349
+ getsockname:1, // - retrieve the sockaddr for a given socket
350
+ getsockopt:1, // - get socket options on a given socket
351
+ given:1, //
352
+ glob:1, // - expand filenames using wildcards
353
+ gmtime:1, // - convert UNIX time into record or string using Greenwich time
354
+ 'goto':1, // - create spaghetti code
355
+ grep:1, // - locate elements in a list test true against a given criterion
356
+ hex:1, // - convert a string to a hexadecimal number
357
+ 'import':1, // - patch a module's namespace into your own
358
+ index:1, // - find a substring within a string
359
+ 'int':1, // - get the integer portion of a number
360
+ ioctl:1, // - system-dependent device control system call
361
+ 'join':1, // - join a list into a string using a separator
362
+ keys:1, // - retrieve list of indices from a hash
363
+ kill:1, // - send a signal to a process or process group
364
+ last:1, // - exit a block prematurely
365
+ lc:1, // - return lower-case version of a string
366
+ lcfirst:1, // - return a string with just the next letter in lower case
367
+ length:1, // - return the number of bytes in a string
368
+ 'link':1, // - create a hard link in the filesystem
369
+ listen:1, // - register your socket as a server
370
+ local: 2, // - create a temporary value for a global variable (dynamic scoping)
371
+ localtime:1, // - convert UNIX time into record or string using local time
372
+ lock:1, // - get a thread lock on a variable, subroutine, or method
373
+ 'log':1, // - retrieve the natural logarithm for a number
374
+ lstat:1, // - stat a symbolic link
375
+ m:null, // - match a string with a regular expression pattern
376
+ map:1, // - apply a change to a list to get back a new list with the changes
377
+ mkdir:1, // - create a directory
378
+ msgctl:1, // - SysV IPC message control operations
379
+ msgget:1, // - get SysV IPC message queue
380
+ msgrcv:1, // - receive a SysV IPC message from a message queue
381
+ msgsnd:1, // - send a SysV IPC message to a message queue
382
+ my: 2, // - declare and assign a local variable (lexical scoping)
383
+ 'new':1, //
384
+ next:1, // - iterate a block prematurely
385
+ no:1, // - unimport some module symbols or semantics at compile time
386
+ oct:1, // - convert a string to an octal number
387
+ open:1, // - open a file, pipe, or descriptor
388
+ opendir:1, // - open a directory
389
+ ord:1, // - find a character's numeric representation
390
+ our: 2, // - declare and assign a package variable (lexical scoping)
391
+ pack:1, // - convert a list into a binary representation
392
+ 'package':1, // - declare a separate global namespace
393
+ pipe:1, // - open a pair of connected filehandles
394
+ pop:1, // - remove the last element from an array and return it
395
+ pos:1, // - find or set the offset for the last/next m//g search
396
+ print:1, // - output a list to a filehandle
397
+ printf:1, // - output a formatted list to a filehandle
398
+ prototype:1, // - get the prototype (if any) of a subroutine
399
+ push:1, // - append one or more elements to an array
400
+ q:null, // - singly quote a string
401
+ qq:null, // - doubly quote a string
402
+ qr:null, // - Compile pattern
403
+ quotemeta:null, // - quote regular expression magic characters
404
+ qw:null, // - quote a list of words
405
+ qx:null, // - backquote quote a string
406
+ rand:1, // - retrieve the next pseudorandom number
407
+ read:1, // - fixed-length buffered input from a filehandle
408
+ readdir:1, // - get a directory from a directory handle
409
+ readline:1, // - fetch a record from a file
410
+ readlink:1, // - determine where a symbolic link is pointing
411
+ readpipe:1, // - execute a system command and collect standard output
412
+ recv:1, // - receive a message over a Socket
413
+ redo:1, // - start this loop iteration over again
414
+ ref:1, // - find out the type of thing being referenced
415
+ rename:1, // - change a filename
416
+ require:1, // - load in external functions from a library at runtime
417
+ reset:1, // - clear all variables of a given name
418
+ 'return':1, // - get out of a function early
419
+ reverse:1, // - flip a string or a list
420
+ rewinddir:1, // - reset directory handle
421
+ rindex:1, // - right-to-left substring search
422
+ rmdir:1, // - remove a directory
423
+ s:null, // - replace a pattern with a string
424
+ say:1, // - print with newline
425
+ scalar:1, // - force a scalar context
426
+ seek:1, // - reposition file pointer for random-access I/O
427
+ seekdir:1, // - reposition directory pointer
428
+ select:1, // - reset default output or do I/O multiplexing
429
+ semctl:1, // - SysV semaphore control operations
430
+ semget:1, // - get set of SysV semaphores
431
+ semop:1, // - SysV semaphore operations
432
+ send:1, // - send a message over a socket
433
+ setgrent:1, // - prepare group file for use
434
+ sethostent:1, // - prepare hosts file for use
435
+ setnetent:1, // - prepare networks file for use
436
+ setpgrp:1, // - set the process group of a process
437
+ setpriority:1, // - set a process's nice value
438
+ setprotoent:1, // - prepare protocols file for use
439
+ setpwent:1, // - prepare passwd file for use
440
+ setservent:1, // - prepare services file for use
441
+ setsockopt:1, // - set some socket options
442
+ shift:1, // - remove the first element of an array, and return it
443
+ shmctl:1, // - SysV shared memory operations
444
+ shmget:1, // - get SysV shared memory segment identifier
445
+ shmread:1, // - read SysV shared memory
446
+ shmwrite:1, // - write SysV shared memory
447
+ shutdown:1, // - close down just half of a socket connection
448
+ 'sin':1, // - return the sine of a number
449
+ sleep:1, // - block for some number of seconds
450
+ socket:1, // - create a socket
451
+ socketpair:1, // - create a pair of sockets
452
+ 'sort':1, // - sort a list of values
453
+ splice:1, // - add or remove elements anywhere in an array
454
+ 'split':1, // - split up a string using a regexp delimiter
455
+ sprintf:1, // - formatted print into a string
456
+ 'sqrt':1, // - square root function
457
+ srand:1, // - seed the random number generator
458
+ stat:1, // - get a file's status information
459
+ state:1, // - declare and assign a state variable (persistent lexical scoping)
460
+ study:1, // - optimize input data for repeated searches
461
+ 'sub':1, // - declare a subroutine, possibly anonymously
462
+ 'substr':1, // - get or alter a portion of a string
463
+ symlink:1, // - create a symbolic link to a file
464
+ syscall:1, // - execute an arbitrary system call
465
+ sysopen:1, // - open a file, pipe, or descriptor
466
+ sysread:1, // - fixed-length unbuffered input from a filehandle
467
+ sysseek:1, // - position I/O pointer on handle used with sysread and syswrite
468
+ system:1, // - run a separate program
469
+ syswrite:1, // - fixed-length unbuffered output to a filehandle
470
+ tell:1, // - get current seekpointer on a filehandle
471
+ telldir:1, // - get current seekpointer on a directory handle
472
+ tie:1, // - bind a variable to an object class
473
+ tied:1, // - get a reference to the object underlying a tied variable
474
+ time:1, // - return number of seconds since 1970
475
+ times:1, // - return elapsed time for self and child processes
476
+ tr:null, // - transliterate a string
477
+ truncate:1, // - shorten a file
478
+ uc:1, // - return upper-case version of a string
479
+ ucfirst:1, // - return a string with just the next letter in upper case
480
+ umask:1, // - set file creation mode mask
481
+ undef:1, // - remove a variable or function definition
482
+ unlink:1, // - remove one link to a file
483
+ unpack:1, // - convert binary structure into normal perl variables
484
+ unshift:1, // - prepend more elements to the beginning of a list
485
+ untie:1, // - break a tie binding to a variable
486
+ use:1, // - load in a module at compile time
487
+ utime:1, // - set a file's last access and modify times
488
+ values:1, // - return a list of the values in a hash
489
+ vec:1, // - test or set particular bits in a string
490
+ wait:1, // - wait for any child process to die
491
+ waitpid:1, // - wait for a particular child process to die
492
+ wantarray:1, // - get void vs scalar vs list context of current subroutine call
493
+ warn:1, // - print debugging info
494
+ when:1, //
495
+ write:1, // - print a picture record
496
+ y:null}; // - transliterate a string
497
+
498
+ var RXstyle="string.special";
499
+ var RXmodifiers=/[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type
500
+
501
+ function tokenChain(stream,state,chain,style,tail){ // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;)
502
+ state.chain=null; // 12 3tail
503
+ state.style=null;
504
+ state.tail=null;
505
+ state.tokenize=function(stream,state){
506
+ var e=false,c,i=0;
507
+ while(c=stream.next()){
508
+ if(c===chain[i]&&!e){
509
+ if(chain[++i]!==undefined){
510
+ state.chain=chain[i];
511
+ state.style=style;
512
+ state.tail=tail;}
513
+ else if(tail)
514
+ stream.eatWhile(tail);
515
+ state.tokenize=tokenPerl;
516
+ return style;}
517
+ e=!e&&c=="\\";}
518
+ return style;};
519
+ return state.tokenize(stream,state);}
520
+
521
+ function tokenSOMETHING(stream,state,string){
522
+ state.tokenize=function(stream,state){
523
+ if(stream.string==string)
524
+ state.tokenize=tokenPerl;
525
+ stream.skipToEnd();
526
+ return "string";};
527
+ return state.tokenize(stream,state);}
528
+
529
+ function tokenPerl(stream,state){
530
+ if(stream.eatSpace())
531
+ return null;
532
+ if(state.chain)
533
+ return tokenChain(stream,state,state.chain,state.style,state.tail);
534
+ if(stream.match(/^(\-?((\d[\d_]*)?\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F_]+|0b[01_]+|\d[\d_]*(e[+-]?\d+)?)/))
535
+ return 'number';
536
+ if(stream.match(/^<<(?=[_a-zA-Z])/)){ // NOTE: <<SOMETHING\n...\nSOMETHING\n
537
+ stream.eatWhile(/\w/);
538
+ return tokenSOMETHING(stream,state,stream.current().substr(2));}
539
+ if(stream.sol()&&stream.match(/^\=item(?!\w)/)){// NOTE: \n=item...\n=cut\n
540
+ return tokenSOMETHING(stream,state,'=cut');}
541
+ var ch=stream.next();
542
+ if(ch=='"'||ch=="'"){ // NOTE: ' or " or <<'SOMETHING'\n...\nSOMETHING\n or <<"SOMETHING"\n...\nSOMETHING\n
543
+ if(prefix(stream, 3)=="<<"+ch){
544
+ var p=stream.pos;
545
+ stream.eatWhile(/\w/);
546
+ var n=stream.current().substr(1);
547
+ if(n&&stream.eat(ch))
548
+ return tokenSOMETHING(stream,state,n);
549
+ stream.pos=p;}
550
+ return tokenChain(stream,state,[ch],"string");}
551
+ if(ch=="q"){
552
+ var c=look(stream, -2);
553
+ if(!(c&&/\w/.test(c))){
554
+ c=look(stream, 0);
555
+ if(c=="x"){
556
+ c=look(stream, 1);
557
+ if(c=="("){
558
+ eatSuffix(stream, 2);
559
+ return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
560
+ if(c=="["){
561
+ eatSuffix(stream, 2);
562
+ return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
563
+ if(c=="{"){
564
+ eatSuffix(stream, 2);
565
+ return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
566
+ if(c=="<"){
567
+ eatSuffix(stream, 2);
568
+ return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
569
+ if(/[\^'"!~\/]/.test(c)){
570
+ eatSuffix(stream, 1);
571
+ return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
572
+ else if(c=="q"){
573
+ c=look(stream, 1);
574
+ if(c=="("){
575
+ eatSuffix(stream, 2);
576
+ return tokenChain(stream,state,[")"],"string");}
577
+ if(c=="["){
578
+ eatSuffix(stream, 2);
579
+ return tokenChain(stream,state,["]"],"string");}
580
+ if(c=="{"){
581
+ eatSuffix(stream, 2);
582
+ return tokenChain(stream,state,["}"],"string");}
583
+ if(c=="<"){
584
+ eatSuffix(stream, 2);
585
+ return tokenChain(stream,state,[">"],"string");}
586
+ if(/[\^'"!~\/]/.test(c)){
587
+ eatSuffix(stream, 1);
588
+ return tokenChain(stream,state,[stream.eat(c)],"string");}}
589
+ else if(c=="w"){
590
+ c=look(stream, 1);
591
+ if(c=="("){
592
+ eatSuffix(stream, 2);
593
+ return tokenChain(stream,state,[")"],"bracket");}
594
+ if(c=="["){
595
+ eatSuffix(stream, 2);
596
+ return tokenChain(stream,state,["]"],"bracket");}
597
+ if(c=="{"){
598
+ eatSuffix(stream, 2);
599
+ return tokenChain(stream,state,["}"],"bracket");}
600
+ if(c=="<"){
601
+ eatSuffix(stream, 2);
602
+ return tokenChain(stream,state,[">"],"bracket");}
603
+ if(/[\^'"!~\/]/.test(c)){
604
+ eatSuffix(stream, 1);
605
+ return tokenChain(stream,state,[stream.eat(c)],"bracket");}}
606
+ else if(c=="r"){
607
+ c=look(stream, 1);
608
+ if(c=="("){
609
+ eatSuffix(stream, 2);
610
+ return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
611
+ if(c=="["){
612
+ eatSuffix(stream, 2);
613
+ return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
614
+ if(c=="{"){
615
+ eatSuffix(stream, 2);
616
+ return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
617
+ if(c=="<"){
618
+ eatSuffix(stream, 2);
619
+ return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
620
+ if(/[\^'"!~\/]/.test(c)){
621
+ eatSuffix(stream, 1);
622
+ return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
623
+ else if(/[\^'"!~\/(\[{<]/.test(c)){
624
+ if(c=="("){
625
+ eatSuffix(stream, 1);
626
+ return tokenChain(stream,state,[")"],"string");}
627
+ if(c=="["){
628
+ eatSuffix(stream, 1);
629
+ return tokenChain(stream,state,["]"],"string");}
630
+ if(c=="{"){
631
+ eatSuffix(stream, 1);
632
+ return tokenChain(stream,state,["}"],"string");}
633
+ if(c=="<"){
634
+ eatSuffix(stream, 1);
635
+ return tokenChain(stream,state,[">"],"string");}
636
+ if(/[\^'"!~\/]/.test(c)){
637
+ return tokenChain(stream,state,[stream.eat(c)],"string");}}}}
638
+ if(ch=="m"){
639
+ var c=look(stream, -2);
640
+ if(!(c&&/\w/.test(c))){
641
+ c=stream.eat(/[(\[{<\^'"!~\/]/);
642
+ if(c){
643
+ if(/[\^'"!~\/]/.test(c)){
644
+ return tokenChain(stream,state,[c],RXstyle,RXmodifiers);}
645
+ if(c=="("){
646
+ return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
647
+ if(c=="["){
648
+ return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
649
+ if(c=="{"){
650
+ return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
651
+ if(c=="<"){
652
+ return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}}}}
653
+ if(ch=="s"){
654
+ var c=/[\/>\]})\w]/.test(look(stream, -2));
655
+ if(!c){
656
+ c=stream.eat(/[(\[{<\^'"!~\/]/);
657
+ if(c){
658
+ if(c=="[")
659
+ return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
660
+ if(c=="{")
661
+ return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
662
+ if(c=="<")
663
+ return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
664
+ if(c=="(")
665
+ return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
666
+ return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
667
+ if(ch=="y"){
668
+ var c=/[\/>\]})\w]/.test(look(stream, -2));
669
+ if(!c){
670
+ c=stream.eat(/[(\[{<\^'"!~\/]/);
671
+ if(c){
672
+ if(c=="[")
673
+ return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
674
+ if(c=="{")
675
+ return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
676
+ if(c=="<")
677
+ return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
678
+ if(c=="(")
679
+ return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
680
+ return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
681
+ if(ch=="t"){
682
+ var c=/[\/>\]})\w]/.test(look(stream, -2));
683
+ if(!c){
684
+ c=stream.eat("r");if(c){
685
+ c=stream.eat(/[(\[{<\^'"!~\/]/);
686
+ if(c){
687
+ if(c=="[")
688
+ return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
689
+ if(c=="{")
690
+ return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
691
+ if(c=="<")
692
+ return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
693
+ if(c=="(")
694
+ return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
695
+ return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}}
696
+ if(ch=="`"){
697
+ return tokenChain(stream,state,[ch],"builtin");}
698
+ if(ch=="/"){
699
+ if(!/~\s*$/.test(prefix(stream)))
700
+ return "operator";
701
+ else
702
+ return tokenChain(stream,state,[ch],RXstyle,RXmodifiers);}
703
+ if(ch=="$"){
704
+ var p=stream.pos;
705
+ if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}"))
706
+ return "builtin";
707
+ else
708
+ stream.pos=p;}
709
+ if(/[$@%]/.test(ch)){
710
+ var p=stream.pos;
711
+ if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(look(stream, -2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){
712
+ var c=stream.current();
713
+ if(PERL[c])
714
+ return "builtin";}
715
+ stream.pos=p;}
716
+ if(/[$@%&]/.test(ch)){
717
+ if(stream.eatWhile(/[\w$]/)||stream.eat("{")&&stream.eatWhile(/[\w$]/)&&stream.eat("}")){
718
+ var c=stream.current();
719
+ if(PERL[c])
720
+ return "builtin";
721
+ else
722
+ return "variable";}}
723
+ if(ch=="#"){
724
+ if(look(stream, -2)!="$"){
725
+ stream.skipToEnd();
726
+ return "comment";}}
727
+ if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){
728
+ var p=stream.pos;
729
+ stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/);
730
+ if(PERL[stream.current()])
731
+ return "operator";
732
+ else
733
+ stream.pos=p;}
734
+ if(ch=="_"){
735
+ if(stream.pos==1){
736
+ if(suffix(stream, 6)=="_END__"){
737
+ return tokenChain(stream,state,['\0'],"comment");}
738
+ else if(suffix(stream, 7)=="_DATA__"){
739
+ return tokenChain(stream,state,['\0'],"builtin");}
740
+ else if(suffix(stream, 7)=="_C__"){
741
+ return tokenChain(stream,state,['\0'],"string");}}}
742
+ if(/\w/.test(ch)){
743
+ var p=stream.pos;
744
+ if(look(stream, -2)=="{"&&(look(stream, 0)=="}"||stream.eatWhile(/\w/)&&look(stream, 0)=="}"))
745
+ return "string";
746
+ else
747
+ stream.pos=p;}
748
+ if(/[A-Z]/.test(ch)){
749
+ var l=look(stream, -2);
750
+ var p=stream.pos;
751
+ stream.eatWhile(/[A-Z_]/);
752
+ if(/[\da-z]/.test(look(stream, 0))){
753
+ stream.pos=p;}
754
+ else{
755
+ var c=PERL[stream.current()];
756
+ if(!c)
757
+ return "meta";
758
+ if(c[1])
759
+ c=c[0];
760
+ if(l!=":"){
761
+ if(c==1)
762
+ return "keyword";
763
+ else if(c==2)
764
+ return "def";
765
+ else if(c==3)
766
+ return "atom";
767
+ else if(c==4)
768
+ return "operator";
769
+ else if(c==5)
770
+ return "builtin";
771
+ else
772
+ return "meta";}
773
+ else
774
+ return "meta";}}
775
+ if(/[a-zA-Z_]/.test(ch)){
776
+ var l=look(stream, -2);
777
+ stream.eatWhile(/\w/);
778
+ var c=PERL[stream.current()];
779
+ if(!c)
780
+ return "meta";
781
+ if(c[1])
782
+ c=c[0];
783
+ if(l!=":"){
784
+ if(c==1)
785
+ return "keyword";
786
+ else if(c==2)
787
+ return "def";
788
+ else if(c==3)
789
+ return "atom";
790
+ else if(c==4)
791
+ return "operator";
792
+ else if(c==5)
793
+ return "builtin";
794
+ else
795
+ return "meta";}
796
+ else
797
+ return "meta";}
798
+ return null;}
799
+
800
+ export const perl = {
801
+ name: "perl",
802
+
803
+ startState: function() {
804
+ return {
805
+ tokenize: tokenPerl,
806
+ chain: null,
807
+ style: null,
808
+ tail: null
809
+ };
810
+ },
811
+ token: function(stream, state) {
812
+ return (state.tokenize || tokenPerl)(stream, state);
813
+ },
814
+ languageData: {
815
+ commentTokens: {line: "#"},
816
+ wordChars: "$"
817
+ }
818
+ };