php.test.ts 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. 'use strict';
  6. import { testTokenization } from './testRunner';
  7. import { htmlTokenTypes } from '../src/php';
  8. testTokenization(['php', 'css'], [
  9. // Bug 13596:[ErrorTelemetry] Stream did not advance while tokenizing. Mode id is php (stuck)
  10. // We're testing the fact that tokenize does not throw
  11. [
  12. { line: '<?php', tokens: [{ startIndex: 0, type: "metatag.php" }] },
  13. { line: '"', tokens: [{ startIndex: 0, type: "string.php" }] },
  14. { line: '\\', tokens: [{ startIndex: 0, type: "" }] }
  15. ],
  16. // Blocks
  17. [{
  18. line: '<?php',
  19. tokens: [
  20. { startIndex: 0, type: 'metatag.php' }
  21. ]
  22. }],
  23. [{
  24. line: '<?php ?>',
  25. tokens: [
  26. { startIndex: 0, type: 'metatag.php' },
  27. { startIndex: 5, type: '' },
  28. { startIndex: 6, type: 'metatag.php' }
  29. ]
  30. }],
  31. [{
  32. line: '<?=',
  33. tokens: [
  34. { startIndex: 0, type: 'metatag.php' }
  35. ]
  36. }],
  37. [{
  38. line: '<?php /* comment */ ?>',
  39. tokens: [
  40. { startIndex: 0, type: 'metatag.php' },
  41. { startIndex: 5, type: '' },
  42. { startIndex: 6, type: 'comment.php' },
  43. { startIndex: 19, type: '' },
  44. { startIndex: 20, type: 'metatag.php' }
  45. ]
  46. }],
  47. // Variables
  48. [{
  49. line: '<?php $abc = 5; ?>',
  50. tokens: [
  51. { startIndex: 0, type: 'metatag.php' },
  52. { startIndex: 5, type: '' },
  53. { startIndex: 6, type: 'variable.php' },
  54. { startIndex: 10, type: '' },
  55. { startIndex: 11, type: 'delimiter.php' },
  56. { startIndex: 12, type: '' },
  57. { startIndex: 13, type: 'number.php' },
  58. { startIndex: 14, type: 'delimiter.php' },
  59. { startIndex: 15, type: '' },
  60. { startIndex: 16, type: 'metatag.php' }
  61. ]
  62. }],
  63. [{
  64. line: '<?php $a = "chris"; ?>',
  65. tokens: [
  66. { startIndex: 0, type: 'metatag.php' },
  67. { startIndex: 5, type: '' },
  68. { startIndex: 6, type: 'variable.php' },
  69. { startIndex: 8, type: '' },
  70. { startIndex: 9, type: 'delimiter.php' },
  71. { startIndex: 10, type: '' },
  72. { startIndex: 11, type: 'string.php' },
  73. { startIndex: 18, type: 'delimiter.php' },
  74. { startIndex: 19, type: '' },
  75. { startIndex: 20, type: 'metatag.php' }
  76. ]
  77. }],
  78. [{
  79. line: '<?php $myVar = -10; ?>',
  80. tokens: [
  81. { startIndex: 0, type: 'metatag.php' },
  82. { startIndex: 5, type: '' },
  83. { startIndex: 6, type: 'variable.php' },
  84. { startIndex: 12, type: '' },
  85. { startIndex: 13, type: 'delimiter.php' },
  86. { startIndex: 14, type: '' },
  87. { startIndex: 15, type: 'delimiter.php' },
  88. { startIndex: 16, type: 'number.php' },
  89. { startIndex: 18, type: 'delimiter.php' },
  90. { startIndex: 19, type: '' },
  91. { startIndex: 20, type: 'metatag.php' }
  92. ]
  93. }],
  94. [{
  95. line: '<?php $myVar = 5 + (10 * 2); ?>',
  96. tokens: [
  97. { startIndex: 0, type: 'metatag.php' },
  98. { startIndex: 5, type: '' },
  99. { startIndex: 6, type: 'variable.php' },
  100. { startIndex: 12, type: '' },
  101. { startIndex: 13, type: 'delimiter.php' },
  102. { startIndex: 14, type: '' },
  103. { startIndex: 15, type: 'number.php' },
  104. { startIndex: 16, type: '' },
  105. { startIndex: 17, type: 'delimiter.php' },
  106. { startIndex: 18, type: '' },
  107. { startIndex: 19, type: 'delimiter.parenthesis.php' },
  108. { startIndex: 20, type: 'number.php' },
  109. { startIndex: 22, type: '' },
  110. { startIndex: 23, type: 'delimiter.php' },
  111. { startIndex: 24, type: '' },
  112. { startIndex: 25, type: 'number.php' },
  113. { startIndex: 26, type: 'delimiter.parenthesis.php' },
  114. { startIndex: 27, type: 'delimiter.php' },
  115. { startIndex: 28, type: '' },
  116. { startIndex: 29, type: 'metatag.php' }
  117. ]
  118. }],
  119. // Keywords
  120. [{
  121. line: '<?php function myFunc() { } ?>',
  122. tokens: [
  123. { startIndex: 0, type: 'metatag.php' },
  124. { startIndex: 5, type: '' },
  125. { startIndex: 6, type: 'keyword.php' },
  126. { startIndex: 14, type: '' },
  127. { startIndex: 15, type: 'identifier.php' },
  128. { startIndex: 21, type: 'delimiter.parenthesis.php' },
  129. { startIndex: 23, type: '' },
  130. { startIndex: 24, type: 'delimiter.bracket.php' },
  131. { startIndex: 25, type: '' },
  132. { startIndex: 26, type: 'delimiter.bracket.php' },
  133. { startIndex: 27, type: '' },
  134. { startIndex: 28, type: 'metatag.php' }
  135. ]
  136. }],
  137. [{
  138. line: '<?php function ?>',
  139. tokens: [
  140. { startIndex: 0, type: 'metatag.php' },
  141. { startIndex: 5, type: '' },
  142. { startIndex: 6, type: 'keyword.php' },
  143. { startIndex: 14, type: '' },
  144. { startIndex: 15, type: 'metatag.php' }
  145. ]
  146. }],
  147. [{
  148. line: '<?php if ($start > 52) { $start = 0; } ?>',
  149. tokens: [
  150. { startIndex: 0, type: 'metatag.php' },
  151. { startIndex: 5, type: '' },
  152. { startIndex: 6, type: 'keyword.php' },
  153. { startIndex: 8, type: '' },
  154. { startIndex: 9, type: 'delimiter.parenthesis.php' },
  155. { startIndex: 10, type: 'variable.php' },
  156. { startIndex: 16, type: '' },
  157. { startIndex: 17, type: 'delimiter.php' },
  158. { startIndex: 18, type: '' },
  159. { startIndex: 19, type: 'number.php' },
  160. { startIndex: 21, type: 'delimiter.parenthesis.php' },
  161. { startIndex: 22, type: '' },
  162. { startIndex: 23, type: 'delimiter.bracket.php' },
  163. { startIndex: 24, type: '' },
  164. { startIndex: 25, type: 'variable.php' },
  165. { startIndex: 31, type: '' },
  166. { startIndex: 32, type: 'delimiter.php' },
  167. { startIndex: 33, type: '' },
  168. { startIndex: 34, type: 'number.php' },
  169. { startIndex: 35, type: 'delimiter.php' },
  170. { startIndex: 36, type: '' },
  171. { startIndex: 37, type: 'delimiter.bracket.php' },
  172. { startIndex: 38, type: '' },
  173. { startIndex: 39, type: 'metatag.php' }
  174. ]
  175. }],
  176. [{
  177. line: '<?php if (true) { $start = 0; } ?>',
  178. tokens: [
  179. { startIndex: 0, type: 'metatag.php' },
  180. { startIndex: 5, type: '' },
  181. { startIndex: 6, type: 'keyword.php' },
  182. { startIndex: 8, type: '' },
  183. { startIndex: 9, type: 'delimiter.parenthesis.php' },
  184. { startIndex: 10, type: 'keyword.php' },
  185. { startIndex: 14, type: 'delimiter.parenthesis.php' },
  186. { startIndex: 15, type: '' },
  187. { startIndex: 16, type: 'delimiter.bracket.php' },
  188. { startIndex: 17, type: '' },
  189. { startIndex: 18, type: 'variable.php' },
  190. { startIndex: 24, type: '' },
  191. { startIndex: 25, type: 'delimiter.php' },
  192. { startIndex: 26, type: '' },
  193. { startIndex: 27, type: 'number.php' },
  194. { startIndex: 28, type: 'delimiter.php' },
  195. { startIndex: 29, type: '' },
  196. { startIndex: 30, type: 'delimiter.bracket.php' },
  197. { startIndex: 31, type: '' },
  198. { startIndex: 32, type: 'metatag.php' }
  199. ]
  200. }],
  201. [{
  202. line: '<?php abstract ?>',
  203. tokens: [
  204. { startIndex: 0, type: 'metatag.php' },
  205. { startIndex: 5, type: '' },
  206. { startIndex: 6, type: 'keyword.php' },
  207. { startIndex: 14, type: '' },
  208. { startIndex: 15, type: 'metatag.php' }
  209. ]
  210. }],
  211. [{
  212. line: '<?php and ?>',
  213. tokens: [
  214. { startIndex: 0, type: 'metatag.php' },
  215. { startIndex: 5, type: '' },
  216. { startIndex: 6, type: 'keyword.php' },
  217. { startIndex: 9, type: '' },
  218. { startIndex: 10, type: 'metatag.php' }
  219. ]
  220. }],
  221. [{
  222. line: '<?php array ?>',
  223. tokens: [
  224. { startIndex: 0, type: 'metatag.php' },
  225. { startIndex: 5, type: '' },
  226. { startIndex: 6, type: 'keyword.php' },
  227. { startIndex: 11, type: '' },
  228. { startIndex: 12, type: 'metatag.php' }
  229. ]
  230. }],
  231. [{
  232. line: '<?php as ?>',
  233. tokens: [
  234. { startIndex: 0, type: 'metatag.php' },
  235. { startIndex: 5, type: '' },
  236. { startIndex: 6, type: 'keyword.php' },
  237. { startIndex: 8, type: '' },
  238. { startIndex: 9, type: 'metatag.php' }
  239. ]
  240. }],
  241. [{
  242. line: '<?php break ?>',
  243. tokens: [
  244. { startIndex: 0, type: 'metatag.php' },
  245. { startIndex: 5, type: '' },
  246. { startIndex: 6, type: 'keyword.php' },
  247. { startIndex: 11, type: '' },
  248. { startIndex: 12, type: 'metatag.php' }
  249. ]
  250. }],
  251. [{
  252. line: '<?php case ?>',
  253. tokens: [
  254. { startIndex: 0, type: 'metatag.php' },
  255. { startIndex: 5, type: '' },
  256. { startIndex: 6, type: 'keyword.php' },
  257. { startIndex: 10, type: '' },
  258. { startIndex: 11, type: 'metatag.php' }
  259. ]
  260. }],
  261. [{
  262. line: '<?php catch ?>',
  263. tokens: [
  264. { startIndex: 0, type: 'metatag.php' },
  265. { startIndex: 5, type: '' },
  266. { startIndex: 6, type: 'keyword.php' },
  267. { startIndex: 11, type: '' },
  268. { startIndex: 12, type: 'metatag.php' }
  269. ]
  270. }],
  271. [{
  272. line: '<?php cfunction ?>',
  273. tokens: [
  274. { startIndex: 0, type: 'metatag.php' },
  275. { startIndex: 5, type: '' },
  276. { startIndex: 6, type: 'keyword.php' },
  277. { startIndex: 15, type: '' },
  278. { startIndex: 16, type: 'metatag.php' }
  279. ]
  280. }],
  281. [{
  282. line: '<?php class ?>',
  283. tokens: [
  284. { startIndex: 0, type: 'metatag.php' },
  285. { startIndex: 5, type: '' },
  286. { startIndex: 6, type: 'keyword.php' },
  287. { startIndex: 11, type: '' },
  288. { startIndex: 12, type: 'metatag.php' }
  289. ]
  290. }],
  291. [{
  292. line: '<?php clone ?>',
  293. tokens: [
  294. { startIndex: 0, type: 'metatag.php' },
  295. { startIndex: 5, type: '' },
  296. { startIndex: 6, type: 'keyword.php' },
  297. { startIndex: 11, type: '' },
  298. { startIndex: 12, type: 'metatag.php' }
  299. ]
  300. }],
  301. [{
  302. line: '<?php const ?>',
  303. tokens: [
  304. { startIndex: 0, type: 'metatag.php' },
  305. { startIndex: 5, type: '' },
  306. { startIndex: 6, type: 'keyword.php' },
  307. { startIndex: 11, type: '' },
  308. { startIndex: 12, type: 'metatag.php' }
  309. ]
  310. }],
  311. [{
  312. line: '<?php continue ?>',
  313. tokens: [
  314. { startIndex: 0, type: 'metatag.php' },
  315. { startIndex: 5, type: '' },
  316. { startIndex: 6, type: 'keyword.php' },
  317. { startIndex: 14, type: '' },
  318. { startIndex: 15, type: 'metatag.php' }
  319. ]
  320. }],
  321. [{
  322. line: '<?php declare ?>',
  323. tokens: [
  324. { startIndex: 0, type: 'metatag.php' },
  325. { startIndex: 5, type: '' },
  326. { startIndex: 6, type: 'keyword.php' },
  327. { startIndex: 13, type: '' },
  328. { startIndex: 14, type: 'metatag.php' }
  329. ]
  330. }],
  331. [{
  332. line: '<?php default ?>',
  333. tokens: [
  334. { startIndex: 0, type: 'metatag.php' },
  335. { startIndex: 5, type: '' },
  336. { startIndex: 6, type: 'keyword.php' },
  337. { startIndex: 13, type: '' },
  338. { startIndex: 14, type: 'metatag.php' }
  339. ]
  340. }],
  341. [{
  342. line: '<?php do ?>',
  343. tokens: [
  344. { startIndex: 0, type: 'metatag.php' },
  345. { startIndex: 5, type: '' },
  346. { startIndex: 6, type: 'keyword.php' },
  347. { startIndex: 8, type: '' },
  348. { startIndex: 9, type: 'metatag.php' }
  349. ]
  350. }],
  351. [{
  352. line: '<?php else ?>',
  353. tokens: [
  354. { startIndex: 0, type: 'metatag.php' },
  355. { startIndex: 5, type: '' },
  356. { startIndex: 6, type: 'keyword.php' },
  357. { startIndex: 10, type: '' },
  358. { startIndex: 11, type: 'metatag.php' }
  359. ]
  360. }],
  361. [{
  362. line: '<?php elseif ?>',
  363. tokens: [
  364. { startIndex: 0, type: 'metatag.php' },
  365. { startIndex: 5, type: '' },
  366. { startIndex: 6, type: 'keyword.php' },
  367. { startIndex: 12, type: '' },
  368. { startIndex: 13, type: 'metatag.php' }
  369. ]
  370. }],
  371. [{
  372. line: '<?php enddeclare ?>',
  373. tokens: [
  374. { startIndex: 0, type: 'metatag.php' },
  375. { startIndex: 5, type: '' },
  376. { startIndex: 6, type: 'keyword.php' },
  377. { startIndex: 16, type: '' },
  378. { startIndex: 17, type: 'metatag.php' }
  379. ]
  380. }],
  381. [{
  382. line: '<?php endfor ?>',
  383. tokens: [
  384. { startIndex: 0, type: 'metatag.php' },
  385. { startIndex: 5, type: '' },
  386. { startIndex: 6, type: 'keyword.php' },
  387. { startIndex: 12, type: '' },
  388. { startIndex: 13, type: 'metatag.php' }
  389. ]
  390. }],
  391. [{
  392. line: '<?php endforeach ?>',
  393. tokens: [
  394. { startIndex: 0, type: 'metatag.php' },
  395. { startIndex: 5, type: '' },
  396. { startIndex: 6, type: 'keyword.php' },
  397. { startIndex: 16, type: '' },
  398. { startIndex: 17, type: 'metatag.php' }
  399. ]
  400. }],
  401. [{
  402. line: '<?php endif ?>',
  403. tokens: [
  404. { startIndex: 0, type: 'metatag.php' },
  405. { startIndex: 5, type: '' },
  406. { startIndex: 6, type: 'keyword.php' },
  407. { startIndex: 11, type: '' },
  408. { startIndex: 12, type: 'metatag.php' }
  409. ]
  410. }],
  411. [{
  412. line: '<?php endswitch ?>',
  413. tokens: [
  414. { startIndex: 0, type: 'metatag.php' },
  415. { startIndex: 5, type: '' },
  416. { startIndex: 6, type: 'keyword.php' },
  417. { startIndex: 15, type: '' },
  418. { startIndex: 16, type: 'metatag.php' }
  419. ]
  420. }],
  421. [{
  422. line: '<?php endwhile ?>',
  423. tokens: [
  424. { startIndex: 0, type: 'metatag.php' },
  425. { startIndex: 5, type: '' },
  426. { startIndex: 6, type: 'keyword.php' },
  427. { startIndex: 14, type: '' },
  428. { startIndex: 15, type: 'metatag.php' }
  429. ]
  430. }],
  431. [{
  432. line: '<?php extends ?>',
  433. tokens: [
  434. { startIndex: 0, type: 'metatag.php' },
  435. { startIndex: 5, type: '' },
  436. { startIndex: 6, type: 'keyword.php' },
  437. { startIndex: 13, type: '' },
  438. { startIndex: 14, type: 'metatag.php' }
  439. ]
  440. }],
  441. [{
  442. line: '<?php false ?>',
  443. tokens: [
  444. { startIndex: 0, type: 'metatag.php' },
  445. { startIndex: 5, type: '' },
  446. { startIndex: 6, type: 'keyword.php' },
  447. { startIndex: 11, type: '' },
  448. { startIndex: 12, type: 'metatag.php' }
  449. ]
  450. }],
  451. [{
  452. line: '<?php final ?>',
  453. tokens: [
  454. { startIndex: 0, type: 'metatag.php' },
  455. { startIndex: 5, type: '' },
  456. { startIndex: 6, type: 'keyword.php' },
  457. { startIndex: 11, type: '' },
  458. { startIndex: 12, type: 'metatag.php' }
  459. ]
  460. }],
  461. [{
  462. line: '<?php for ?>',
  463. tokens: [
  464. { startIndex: 0, type: 'metatag.php' },
  465. { startIndex: 5, type: '' },
  466. { startIndex: 6, type: 'keyword.php' },
  467. { startIndex: 9, type: '' },
  468. { startIndex: 10, type: 'metatag.php' }
  469. ]
  470. }],
  471. [{
  472. line: '<?php foreach ?>',
  473. tokens: [
  474. { startIndex: 0, type: 'metatag.php' },
  475. { startIndex: 5, type: '' },
  476. { startIndex: 6, type: 'keyword.php' },
  477. { startIndex: 13, type: '' },
  478. { startIndex: 14, type: 'metatag.php' }
  479. ]
  480. }],
  481. [{
  482. line: '<?php function ?>',
  483. tokens: [
  484. { startIndex: 0, type: 'metatag.php' },
  485. { startIndex: 5, type: '' },
  486. { startIndex: 6, type: 'keyword.php' },
  487. { startIndex: 14, type: '' },
  488. { startIndex: 15, type: 'metatag.php' }
  489. ]
  490. }],
  491. [{
  492. line: '<?php global ?>',
  493. tokens: [
  494. { startIndex: 0, type: 'metatag.php' },
  495. { startIndex: 5, type: '' },
  496. { startIndex: 6, type: 'keyword.php' },
  497. { startIndex: 12, type: '' },
  498. { startIndex: 13, type: 'metatag.php' }
  499. ]
  500. }],
  501. [{
  502. line: '<?php goto ?>',
  503. tokens: [
  504. { startIndex: 0, type: 'metatag.php' },
  505. { startIndex: 5, type: '' },
  506. { startIndex: 6, type: 'keyword.php' },
  507. { startIndex: 10, type: '' },
  508. { startIndex: 11, type: 'metatag.php' }
  509. ]
  510. }],
  511. [{
  512. line: '<?php if ?>',
  513. tokens: [
  514. { startIndex: 0, type: 'metatag.php' },
  515. { startIndex: 5, type: '' },
  516. { startIndex: 6, type: 'keyword.php' },
  517. { startIndex: 8, type: '' },
  518. { startIndex: 9, type: 'metatag.php' }
  519. ]
  520. }],
  521. [{
  522. line: '<?php implements ?>',
  523. tokens: [
  524. { startIndex: 0, type: 'metatag.php' },
  525. { startIndex: 5, type: '' },
  526. { startIndex: 6, type: 'keyword.php' },
  527. { startIndex: 16, type: '' },
  528. { startIndex: 17, type: 'metatag.php' }
  529. ]
  530. }],
  531. [{
  532. line: '<?php interface ?>',
  533. tokens: [
  534. { startIndex: 0, type: 'metatag.php' },
  535. { startIndex: 5, type: '' },
  536. { startIndex: 6, type: 'keyword.php' },
  537. { startIndex: 15, type: '' },
  538. { startIndex: 16, type: 'metatag.php' }
  539. ]
  540. }],
  541. [{
  542. line: '<?php instanceof ?>',
  543. tokens: [
  544. { startIndex: 0, type: 'metatag.php' },
  545. { startIndex: 5, type: '' },
  546. { startIndex: 6, type: 'keyword.php' },
  547. { startIndex: 16, type: '' },
  548. { startIndex: 17, type: 'metatag.php' }
  549. ]
  550. }],
  551. [{
  552. line: '<?php namespace ?>',
  553. tokens: [
  554. { startIndex: 0, type: 'metatag.php' },
  555. { startIndex: 5, type: '' },
  556. { startIndex: 6, type: 'keyword.php' },
  557. { startIndex: 15, type: '' },
  558. { startIndex: 16, type: 'metatag.php' }
  559. ]
  560. }],
  561. [{
  562. line: '<?php new ?>',
  563. tokens: [
  564. { startIndex: 0, type: 'metatag.php' },
  565. { startIndex: 5, type: '' },
  566. { startIndex: 6, type: 'keyword.php' },
  567. { startIndex: 9, type: '' },
  568. { startIndex: 10, type: 'metatag.php' }
  569. ]
  570. }],
  571. [{
  572. line: '<?php null ?>',
  573. tokens: [
  574. { startIndex: 0, type: 'metatag.php' },
  575. { startIndex: 5, type: '' },
  576. { startIndex: 6, type: 'keyword.php' },
  577. { startIndex: 10, type: '' },
  578. { startIndex: 11, type: 'metatag.php' }
  579. ]
  580. }],
  581. [{
  582. line: '<?php object ?>',
  583. tokens: [
  584. { startIndex: 0, type: 'metatag.php' },
  585. { startIndex: 5, type: '' },
  586. { startIndex: 6, type: 'keyword.php' },
  587. { startIndex: 12, type: '' },
  588. { startIndex: 13, type: 'metatag.php' }
  589. ]
  590. }],
  591. [{
  592. line: '<?php old_function ?>',
  593. tokens: [
  594. { startIndex: 0, type: 'metatag.php' },
  595. { startIndex: 5, type: '' },
  596. { startIndex: 6, type: 'keyword.php' },
  597. { startIndex: 18, type: '' },
  598. { startIndex: 19, type: 'metatag.php' }
  599. ]
  600. }],
  601. [{
  602. line: '<?php or ?>',
  603. tokens: [
  604. { startIndex: 0, type: 'metatag.php' },
  605. { startIndex: 5, type: '' },
  606. { startIndex: 6, type: 'keyword.php' },
  607. { startIndex: 8, type: '' },
  608. { startIndex: 9, type: 'metatag.php' }
  609. ]
  610. }],
  611. [{
  612. line: '<?php private ?>',
  613. tokens: [
  614. { startIndex: 0, type: 'metatag.php' },
  615. { startIndex: 5, type: '' },
  616. { startIndex: 6, type: 'keyword.php' },
  617. { startIndex: 13, type: '' },
  618. { startIndex: 14, type: 'metatag.php' }
  619. ]
  620. }],
  621. [{
  622. line: '<?php protected ?>',
  623. tokens: [
  624. { startIndex: 0, type: 'metatag.php' },
  625. { startIndex: 5, type: '' },
  626. { startIndex: 6, type: 'keyword.php' },
  627. { startIndex: 15, type: '' },
  628. { startIndex: 16, type: 'metatag.php' }
  629. ]
  630. }],
  631. [{
  632. line: '<?php public ?>',
  633. tokens: [
  634. { startIndex: 0, type: 'metatag.php' },
  635. { startIndex: 5, type: '' },
  636. { startIndex: 6, type: 'keyword.php' },
  637. { startIndex: 12, type: '' },
  638. { startIndex: 13, type: 'metatag.php' }
  639. ]
  640. }],
  641. [{
  642. line: '<?php resource ?>',
  643. tokens: [
  644. { startIndex: 0, type: 'metatag.php' },
  645. { startIndex: 5, type: '' },
  646. { startIndex: 6, type: 'keyword.php' },
  647. { startIndex: 14, type: '' },
  648. { startIndex: 15, type: 'metatag.php' }
  649. ]
  650. }],
  651. [{
  652. line: '<?php static ?>',
  653. tokens: [
  654. { startIndex: 0, type: 'metatag.php' },
  655. { startIndex: 5, type: '' },
  656. { startIndex: 6, type: 'keyword.php' },
  657. { startIndex: 12, type: '' },
  658. { startIndex: 13, type: 'metatag.php' }
  659. ]
  660. }],
  661. [{
  662. line: '<?php switch ?>',
  663. tokens: [
  664. { startIndex: 0, type: 'metatag.php' },
  665. { startIndex: 5, type: '' },
  666. { startIndex: 6, type: 'keyword.php' },
  667. { startIndex: 12, type: '' },
  668. { startIndex: 13, type: 'metatag.php' }
  669. ]
  670. }],
  671. [{
  672. line: '<?php throw ?>',
  673. tokens: [
  674. { startIndex: 0, type: 'metatag.php' },
  675. { startIndex: 5, type: '' },
  676. { startIndex: 6, type: 'keyword.php' },
  677. { startIndex: 11, type: '' },
  678. { startIndex: 12, type: 'metatag.php' }
  679. ]
  680. }],
  681. [{
  682. line: '<?php try ?>',
  683. tokens: [
  684. { startIndex: 0, type: 'metatag.php' },
  685. { startIndex: 5, type: '' },
  686. { startIndex: 6, type: 'keyword.php' },
  687. { startIndex: 9, type: '' },
  688. { startIndex: 10, type: 'metatag.php' }
  689. ]
  690. }],
  691. [{
  692. line: '<?php true ?>',
  693. tokens: [
  694. { startIndex: 0, type: 'metatag.php' },
  695. { startIndex: 5, type: '' },
  696. { startIndex: 6, type: 'keyword.php' },
  697. { startIndex: 10, type: '' },
  698. { startIndex: 11, type: 'metatag.php' }
  699. ]
  700. }],
  701. [{
  702. line: '<?php use ?>',
  703. tokens: [
  704. { startIndex: 0, type: 'metatag.php' },
  705. { startIndex: 5, type: '' },
  706. { startIndex: 6, type: 'keyword.php' },
  707. { startIndex: 9, type: '' },
  708. { startIndex: 10, type: 'metatag.php' }
  709. ]
  710. }],
  711. [{
  712. line: '<?php var ?>',
  713. tokens: [
  714. { startIndex: 0, type: 'metatag.php' },
  715. { startIndex: 5, type: '' },
  716. { startIndex: 6, type: 'keyword.php' },
  717. { startIndex: 9, type: '' },
  718. { startIndex: 10, type: 'metatag.php' }
  719. ]
  720. }],
  721. [{
  722. line: '<?php while ?>',
  723. tokens: [
  724. { startIndex: 0, type: 'metatag.php' },
  725. { startIndex: 5, type: '' },
  726. { startIndex: 6, type: 'keyword.php' },
  727. { startIndex: 11, type: '' },
  728. { startIndex: 12, type: 'metatag.php' }
  729. ]
  730. }],
  731. [{
  732. line: '<?php xor ?>',
  733. tokens: [
  734. { startIndex: 0, type: 'metatag.php' },
  735. { startIndex: 5, type: '' },
  736. { startIndex: 6, type: 'keyword.php' },
  737. { startIndex: 9, type: '' },
  738. { startIndex: 10, type: 'metatag.php' }
  739. ]
  740. }],
  741. [{
  742. line: '<?php die ?>',
  743. tokens: [
  744. { startIndex: 0, type: 'metatag.php' },
  745. { startIndex: 5, type: '' },
  746. { startIndex: 6, type: 'keyword.php' },
  747. { startIndex: 9, type: '' },
  748. { startIndex: 10, type: 'metatag.php' }
  749. ]
  750. }],
  751. [{
  752. line: '<?php echo ?>',
  753. tokens: [
  754. { startIndex: 0, type: 'metatag.php' },
  755. { startIndex: 5, type: '' },
  756. { startIndex: 6, type: 'keyword.php' },
  757. { startIndex: 10, type: '' },
  758. { startIndex: 11, type: 'metatag.php' }
  759. ]
  760. }],
  761. [{
  762. line: '<?php empty ?>',
  763. tokens: [
  764. { startIndex: 0, type: 'metatag.php' },
  765. { startIndex: 5, type: '' },
  766. { startIndex: 6, type: 'keyword.php' },
  767. { startIndex: 11, type: '' },
  768. { startIndex: 12, type: 'metatag.php' }
  769. ]
  770. }],
  771. [{
  772. line: '<?php exit ?>',
  773. tokens: [
  774. { startIndex: 0, type: 'metatag.php' },
  775. { startIndex: 5, type: '' },
  776. { startIndex: 6, type: 'keyword.php' },
  777. { startIndex: 10, type: '' },
  778. { startIndex: 11, type: 'metatag.php' }
  779. ]
  780. }],
  781. [{
  782. line: '<?php eval ?>',
  783. tokens: [
  784. { startIndex: 0, type: 'metatag.php' },
  785. { startIndex: 5, type: '' },
  786. { startIndex: 6, type: 'keyword.php' },
  787. { startIndex: 10, type: '' },
  788. { startIndex: 11, type: 'metatag.php' }
  789. ]
  790. }],
  791. [{
  792. line: '<?php include ?>',
  793. tokens: [
  794. { startIndex: 0, type: 'metatag.php' },
  795. { startIndex: 5, type: '' },
  796. { startIndex: 6, type: 'keyword.php' },
  797. { startIndex: 13, type: '' },
  798. { startIndex: 14, type: 'metatag.php' }
  799. ]
  800. }],
  801. [{
  802. line: '<?php include_once ?>',
  803. tokens: [
  804. { startIndex: 0, type: 'metatag.php' },
  805. { startIndex: 5, type: '' },
  806. { startIndex: 6, type: 'keyword.php' },
  807. { startIndex: 18, type: '' },
  808. { startIndex: 19, type: 'metatag.php' }
  809. ]
  810. }],
  811. [{
  812. line: '<?php isset ?>',
  813. tokens: [
  814. { startIndex: 0, type: 'metatag.php' },
  815. { startIndex: 5, type: '' },
  816. { startIndex: 6, type: 'keyword.php' },
  817. { startIndex: 11, type: '' },
  818. { startIndex: 12, type: 'metatag.php' }
  819. ]
  820. }],
  821. [{
  822. line: '<?php list ?>',
  823. tokens: [
  824. { startIndex: 0, type: 'metatag.php' },
  825. { startIndex: 5, type: '' },
  826. { startIndex: 6, type: 'keyword.php' },
  827. { startIndex: 10, type: '' },
  828. { startIndex: 11, type: 'metatag.php' }
  829. ]
  830. }],
  831. [{
  832. line: '<?php require ?>',
  833. tokens: [
  834. { startIndex: 0, type: 'metatag.php' },
  835. { startIndex: 5, type: '' },
  836. { startIndex: 6, type: 'keyword.php' },
  837. { startIndex: 13, type: '' },
  838. { startIndex: 14, type: 'metatag.php' }
  839. ]
  840. }],
  841. [{
  842. line: '<?php require_once ?>',
  843. tokens: [
  844. { startIndex: 0, type: 'metatag.php' },
  845. { startIndex: 5, type: '' },
  846. { startIndex: 6, type: 'keyword.php' },
  847. { startIndex: 18, type: '' },
  848. { startIndex: 19, type: 'metatag.php' }
  849. ]
  850. }],
  851. [{
  852. line: '<?php return ?>',
  853. tokens: [
  854. { startIndex: 0, type: 'metatag.php' },
  855. { startIndex: 5, type: '' },
  856. { startIndex: 6, type: 'keyword.php' },
  857. { startIndex: 12, type: '' },
  858. { startIndex: 13, type: 'metatag.php' }
  859. ]
  860. }],
  861. [{
  862. line: '<?php print ?>',
  863. tokens: [
  864. { startIndex: 0, type: 'metatag.php' },
  865. { startIndex: 5, type: '' },
  866. { startIndex: 6, type: 'keyword.php' },
  867. { startIndex: 11, type: '' },
  868. { startIndex: 12, type: 'metatag.php' }
  869. ]
  870. }],
  871. [{
  872. line: '<?php unset ?>',
  873. tokens: [
  874. { startIndex: 0, type: 'metatag.php' },
  875. { startIndex: 5, type: '' },
  876. { startIndex: 6, type: 'keyword.php' },
  877. { startIndex: 11, type: '' },
  878. { startIndex: 12, type: 'metatag.php' }
  879. ]
  880. }],
  881. [{
  882. line: '<?php __construct ?>',
  883. tokens: [
  884. { startIndex: 0, type: 'metatag.php' },
  885. { startIndex: 5, type: '' },
  886. { startIndex: 6, type: 'keyword.php' },
  887. { startIndex: 17, type: '' },
  888. { startIndex: 18, type: 'metatag.php' }
  889. ]
  890. }],
  891. // Compile Time Constants
  892. [{
  893. line: '<?php __FILE__ ?>',
  894. tokens: [
  895. { startIndex: 0, type: 'metatag.php' },
  896. { startIndex: 5, type: '' },
  897. { startIndex: 6, type: 'constant.php' },
  898. { startIndex: 14, type: '' },
  899. { startIndex: 15, type: 'metatag.php' }
  900. ]
  901. }],
  902. [{
  903. line: '<?php $myscript = __FILE__; ?>',
  904. tokens: [
  905. { startIndex: 0, type: 'metatag.php' },
  906. { startIndex: 5, type: '' },
  907. { startIndex: 6, type: 'variable.php' },
  908. { startIndex: 15, type: '' },
  909. { startIndex: 16, type: 'delimiter.php' },
  910. { startIndex: 17, type: '' },
  911. { startIndex: 18, type: 'constant.php' },
  912. { startIndex: 26, type: 'delimiter.php' },
  913. { startIndex: 27, type: '' },
  914. { startIndex: 28, type: 'metatag.php' }
  915. ]
  916. }],
  917. [{
  918. line: '<?php __CLASS__ ?>',
  919. tokens: [
  920. { startIndex: 0, type: 'metatag.php' },
  921. { startIndex: 5, type: '' },
  922. { startIndex: 6, type: 'constant.php' },
  923. { startIndex: 15, type: '' },
  924. { startIndex: 16, type: 'metatag.php' }
  925. ]
  926. }],
  927. [{
  928. line: '<?php __DIR__ ?>',
  929. tokens: [
  930. { startIndex: 0, type: 'metatag.php' },
  931. { startIndex: 5, type: '' },
  932. { startIndex: 6, type: 'constant.php' },
  933. { startIndex: 13, type: '' },
  934. { startIndex: 14, type: 'metatag.php' }
  935. ]
  936. }],
  937. [{
  938. line: '<?php __LINE__ ?>',
  939. tokens: [
  940. { startIndex: 0, type: 'metatag.php' },
  941. { startIndex: 5, type: '' },
  942. { startIndex: 6, type: 'constant.php' },
  943. { startIndex: 14, type: '' },
  944. { startIndex: 15, type: 'metatag.php' }
  945. ]
  946. }],
  947. [{
  948. line: '<?php __NAMESPACE__ ?>',
  949. tokens: [
  950. { startIndex: 0, type: 'metatag.php' },
  951. { startIndex: 5, type: '' },
  952. { startIndex: 6, type: 'constant.php' },
  953. { startIndex: 19, type: '' },
  954. { startIndex: 20, type: 'metatag.php' }
  955. ]
  956. }],
  957. [{
  958. line: '<?php __METHOD__ ?>',
  959. tokens: [
  960. { startIndex: 0, type: 'metatag.php' },
  961. { startIndex: 5, type: '' },
  962. { startIndex: 6, type: 'constant.php' },
  963. { startIndex: 16, type: '' },
  964. { startIndex: 17, type: 'metatag.php' }
  965. ]
  966. }],
  967. [{
  968. line: '<?php __FUNCTION__ ?>',
  969. tokens: [
  970. { startIndex: 0, type: 'metatag.php' },
  971. { startIndex: 5, type: '' },
  972. { startIndex: 6, type: 'constant.php' },
  973. { startIndex: 18, type: '' },
  974. { startIndex: 19, type: 'metatag.php' }
  975. ]
  976. }],
  977. [{
  978. line: '<?php __TRAIT__ ?>',
  979. tokens: [
  980. { startIndex: 0, type: 'metatag.php' },
  981. { startIndex: 5, type: '' },
  982. { startIndex: 6, type: 'constant.php' },
  983. { startIndex: 15, type: '' },
  984. { startIndex: 16, type: 'metatag.php' }
  985. ]
  986. }],
  987. // Predefined Variables
  988. [{
  989. line: '<?php $_ENV ?>',
  990. tokens: [
  991. { startIndex: 0, type: 'metatag.php' },
  992. { startIndex: 5, type: '' },
  993. { startIndex: 6, type: 'variable.predefined.php' },
  994. { startIndex: 11, type: '' },
  995. { startIndex: 12, type: 'metatag.php' }
  996. ]
  997. }],
  998. [{
  999. line: '<?php echo $_ENV; ?>',
  1000. tokens: [
  1001. { startIndex: 0, type: 'metatag.php' },
  1002. { startIndex: 5, type: '' },
  1003. { startIndex: 6, type: 'keyword.php' },
  1004. { startIndex: 10, type: '' },
  1005. { startIndex: 11, type: 'variable.predefined.php' },
  1006. { startIndex: 16, type: 'delimiter.php' },
  1007. { startIndex: 17, type: '' },
  1008. { startIndex: 18, type: 'metatag.php' }
  1009. ]
  1010. }],
  1011. [{
  1012. line: '<?php $GLOBALS ?>',
  1013. tokens: [
  1014. { startIndex: 0, type: 'metatag.php' },
  1015. { startIndex: 5, type: '' },
  1016. { startIndex: 6, type: 'variable.predefined.php' },
  1017. { startIndex: 14, type: '' },
  1018. { startIndex: 15, type: 'metatag.php' }
  1019. ]
  1020. }],
  1021. [{
  1022. line: '<?php $_SERVER ?>',
  1023. tokens: [
  1024. { startIndex: 0, type: 'metatag.php' },
  1025. { startIndex: 5, type: '' },
  1026. { startIndex: 6, type: 'variable.predefined.php' },
  1027. { startIndex: 14, type: '' },
  1028. { startIndex: 15, type: 'metatag.php' }
  1029. ]
  1030. }],
  1031. [{
  1032. line: '<?php $_GET ?>',
  1033. tokens: [
  1034. { startIndex: 0, type: 'metatag.php' },
  1035. { startIndex: 5, type: '' },
  1036. { startIndex: 6, type: 'variable.predefined.php' },
  1037. { startIndex: 11, type: '' },
  1038. { startIndex: 12, type: 'metatag.php' }
  1039. ]
  1040. }],
  1041. [{
  1042. line: '<?php $_POST ?>',
  1043. tokens: [
  1044. { startIndex: 0, type: 'metatag.php' },
  1045. { startIndex: 5, type: '' },
  1046. { startIndex: 6, type: 'variable.predefined.php' },
  1047. { startIndex: 12, type: '' },
  1048. { startIndex: 13, type: 'metatag.php' }
  1049. ]
  1050. }],
  1051. [{
  1052. line: '<?php $_FILES ?>',
  1053. tokens: [
  1054. { startIndex: 0, type: 'metatag.php' },
  1055. { startIndex: 5, type: '' },
  1056. { startIndex: 6, type: 'variable.predefined.php' },
  1057. { startIndex: 13, type: '' },
  1058. { startIndex: 14, type: 'metatag.php' }
  1059. ]
  1060. }],
  1061. [{
  1062. line: '<?php $_REQUEST ?>',
  1063. tokens: [
  1064. { startIndex: 0, type: 'metatag.php' },
  1065. { startIndex: 5, type: '' },
  1066. { startIndex: 6, type: 'variable.predefined.php' },
  1067. { startIndex: 15, type: '' },
  1068. { startIndex: 16, type: 'metatag.php' }
  1069. ]
  1070. }],
  1071. [{
  1072. line: '<?php $_SESSION ?>',
  1073. tokens: [
  1074. { startIndex: 0, type: 'metatag.php' },
  1075. { startIndex: 5, type: '' },
  1076. { startIndex: 6, type: 'variable.predefined.php' },
  1077. { startIndex: 15, type: '' },
  1078. { startIndex: 16, type: 'metatag.php' }
  1079. ]
  1080. }],
  1081. [{
  1082. line: '<?php $_ENV ?>',
  1083. tokens: [
  1084. { startIndex: 0, type: 'metatag.php' },
  1085. { startIndex: 5, type: '' },
  1086. { startIndex: 6, type: 'variable.predefined.php' },
  1087. { startIndex: 11, type: '' },
  1088. { startIndex: 12, type: 'metatag.php' }
  1089. ]
  1090. }],
  1091. [{
  1092. line: '<?php $_COOKIE ?>',
  1093. tokens: [
  1094. { startIndex: 0, type: 'metatag.php' },
  1095. { startIndex: 5, type: '' },
  1096. { startIndex: 6, type: 'variable.predefined.php' },
  1097. { startIndex: 14, type: '' },
  1098. { startIndex: 15, type: 'metatag.php' }
  1099. ]
  1100. }],
  1101. [{
  1102. line: '<?php $php_errormsg ?>',
  1103. tokens: [
  1104. { startIndex: 0, type: 'metatag.php' },
  1105. { startIndex: 5, type: '' },
  1106. { startIndex: 6, type: 'variable.predefined.php' },
  1107. { startIndex: 19, type: '' },
  1108. { startIndex: 20, type: 'metatag.php' }
  1109. ]
  1110. }],
  1111. [{
  1112. line: '<?php $HTTP_RAW_POST_DATA ?>',
  1113. tokens: [
  1114. { startIndex: 0, type: 'metatag.php' },
  1115. { startIndex: 5, type: '' },
  1116. { startIndex: 6, type: 'variable.predefined.php' },
  1117. { startIndex: 25, type: '' },
  1118. { startIndex: 26, type: 'metatag.php' }
  1119. ]
  1120. }],
  1121. [{
  1122. line: '<?php $http_response_header ?>',
  1123. tokens: [
  1124. { startIndex: 0, type: 'metatag.php' },
  1125. { startIndex: 5, type: '' },
  1126. { startIndex: 6, type: 'variable.predefined.php' },
  1127. { startIndex: 27, type: '' },
  1128. { startIndex: 28, type: 'metatag.php' }
  1129. ]
  1130. }],
  1131. [{
  1132. line: '<?php $argc ?>',
  1133. tokens: [
  1134. { startIndex: 0, type: 'metatag.php' },
  1135. { startIndex: 5, type: '' },
  1136. { startIndex: 6, type: 'variable.predefined.php' },
  1137. { startIndex: 11, type: '' },
  1138. { startIndex: 12, type: 'metatag.php' }
  1139. ]
  1140. }],
  1141. [{
  1142. line: '<?php $argv ?>',
  1143. tokens: [
  1144. { startIndex: 0, type: 'metatag.php' },
  1145. { startIndex: 5, type: '' },
  1146. { startIndex: 6, type: 'variable.predefined.php' },
  1147. { startIndex: 11, type: '' },
  1148. { startIndex: 12, type: 'metatag.php' }
  1149. ]
  1150. }],
  1151. // Comments - single line
  1152. [{
  1153. line: '<?php // a',
  1154. tokens: [
  1155. { startIndex: 0, type: 'metatag.php' },
  1156. { startIndex: 5, type: '' },
  1157. { startIndex: 6, type: 'comment.php' }
  1158. ]
  1159. }],
  1160. [{
  1161. line: '<?php / / / not a comment',
  1162. tokens: [
  1163. { startIndex: 0, type: 'metatag.php' },
  1164. { startIndex: 5, type: '' },
  1165. { startIndex: 6, type: 'delimiter.php' },
  1166. { startIndex: 7, type: '' },
  1167. { startIndex: 8, type: 'delimiter.php' },
  1168. { startIndex: 9, type: '' },
  1169. { startIndex: 10, type: 'delimiter.php' },
  1170. { startIndex: 11, type: '' },
  1171. { startIndex: 12, type: 'identifier.php' },
  1172. { startIndex: 15, type: '' },
  1173. { startIndex: 16, type: 'identifier.php' },
  1174. { startIndex: 17, type: '' },
  1175. { startIndex: 18, type: 'identifier.php' },
  1176. ]
  1177. }],
  1178. [{
  1179. line: '<?php // a comment',
  1180. tokens: [
  1181. { startIndex: 0, type: 'metatag.php' },
  1182. { startIndex: 5, type: '' },
  1183. { startIndex: 9, type: 'comment.php' }
  1184. ]
  1185. }],
  1186. [{
  1187. line: '<?php // a comment',
  1188. tokens: [
  1189. { startIndex: 0, type: 'metatag.php' },
  1190. { startIndex: 5, type: '' },
  1191. { startIndex: 6, type: 'comment.php' }
  1192. ]
  1193. }],
  1194. [{
  1195. line: '<?php //sticky comment',
  1196. tokens: [
  1197. { startIndex: 0, type: 'metatag.php' },
  1198. { startIndex: 5, type: '' },
  1199. { startIndex: 6, type: 'comment.php' }
  1200. ]
  1201. }],
  1202. [{
  1203. line: '<?php /almost a comment',
  1204. tokens: [
  1205. { startIndex: 0, type: 'metatag.php' },
  1206. { startIndex: 5, type: '' },
  1207. { startIndex: 6, type: 'delimiter.php' },
  1208. { startIndex: 7, type: 'identifier.php' },
  1209. { startIndex: 13, type: '' },
  1210. { startIndex: 14, type: 'identifier.php' },
  1211. { startIndex: 15, type: '' },
  1212. { startIndex: 16, type: 'identifier.php' },
  1213. ]
  1214. }],
  1215. [{
  1216. line: '<?php $x = 1; // my comment // is a nice one',
  1217. tokens: [
  1218. { startIndex: 0, type: 'metatag.php' },
  1219. { startIndex: 5, type: '' },
  1220. { startIndex: 6, type: 'variable.php' },
  1221. { startIndex: 8, type: '' },
  1222. { startIndex: 9, type: 'delimiter.php' },
  1223. { startIndex: 10, type: '' },
  1224. { startIndex: 11, type: 'number.php' },
  1225. { startIndex: 12, type: 'delimiter.php' },
  1226. { startIndex: 13, type: '' },
  1227. { startIndex: 14, type: 'comment.php' }
  1228. ]
  1229. }],
  1230. // Comments - range comment, single line
  1231. [{
  1232. line: '<?php /* a simple comment */ ?>',
  1233. tokens: [
  1234. { startIndex: 0, type: 'metatag.php' },
  1235. { startIndex: 5, type: '' },
  1236. { startIndex: 6, type: 'comment.php' },
  1237. { startIndex: 28, type: '' },
  1238. { startIndex: 29, type: 'metatag.php' }
  1239. ]
  1240. }],
  1241. [{
  1242. line: '<?php $x = /* a simple comment */ 1; ?>',
  1243. tokens: [
  1244. { startIndex: 0, type: 'metatag.php' },
  1245. { startIndex: 5, type: '' },
  1246. { startIndex: 6, type: 'variable.php' },
  1247. { startIndex: 8, type: '' },
  1248. { startIndex: 9, type: 'delimiter.php' },
  1249. { startIndex: 10, type: '' },
  1250. { startIndex: 11, type: 'comment.php' },
  1251. { startIndex: 33, type: '' },
  1252. { startIndex: 34, type: 'number.php' },
  1253. { startIndex: 35, type: 'delimiter.php' },
  1254. { startIndex: 36, type: '' },
  1255. { startIndex: 37, type: 'metatag.php' }
  1256. ]
  1257. }],
  1258. [{
  1259. line: '<?php $x = /* comment */ 1; */ ?>',
  1260. tokens: [
  1261. { startIndex: 0, type: 'metatag.php' },
  1262. { startIndex: 5, type: '' },
  1263. { startIndex: 6, type: 'variable.php' },
  1264. { startIndex: 8, type: '' },
  1265. { startIndex: 9, type: 'delimiter.php' },
  1266. { startIndex: 10, type: '' },
  1267. { startIndex: 11, type: 'comment.php' },
  1268. { startIndex: 24, type: '' },
  1269. { startIndex: 25, type: 'number.php' },
  1270. { startIndex: 26, type: 'delimiter.php' },
  1271. { startIndex: 27, type: '' },
  1272. { startIndex: 28, type: 'delimiter.php' },
  1273. { startIndex: 30, type: '' },
  1274. { startIndex: 31, type: 'metatag.php' }
  1275. ]
  1276. }],
  1277. [{
  1278. line: '<?php $x = /**/; ?>',
  1279. tokens: [
  1280. { startIndex: 0, type: 'metatag.php' },
  1281. { startIndex: 5, type: '' },
  1282. { startIndex: 6, type: 'variable.php' },
  1283. { startIndex: 8, type: '' },
  1284. { startIndex: 9, type: 'delimiter.php' },
  1285. { startIndex: 10, type: '' },
  1286. { startIndex: 11, type: 'comment.php' },
  1287. { startIndex: 15, type: 'delimiter.php' },
  1288. { startIndex: 16, type: '' },
  1289. { startIndex: 17, type: 'metatag.php' }
  1290. ]
  1291. }],
  1292. [{
  1293. line: '<?php $x = /*/;',
  1294. tokens: [
  1295. { startIndex: 0, type: 'metatag.php' },
  1296. { startIndex: 5, type: '' },
  1297. { startIndex: 6, type: 'variable.php' },
  1298. { startIndex: 8, type: '' },
  1299. { startIndex: 9, type: 'delimiter.php' },
  1300. { startIndex: 10, type: '' },
  1301. { startIndex: 11, type: 'comment.php' }
  1302. ]
  1303. }],
  1304. // Comments - range comment, multi lines
  1305. [{
  1306. line: '<?php /* a multiline comment',
  1307. tokens: [
  1308. { startIndex: 0, type: 'metatag.php' },
  1309. { startIndex: 5, type: '' },
  1310. { startIndex: 6, type: 'comment.php' }
  1311. ]
  1312. }, {
  1313. line: 'can actually span',
  1314. tokens: [
  1315. { startIndex: 0, type: 'comment.php' }
  1316. ]
  1317. }, {
  1318. line: 'multiple lines */',
  1319. tokens: [
  1320. { startIndex: 0, type: 'comment.php' }
  1321. ]
  1322. }],
  1323. [{
  1324. line: '<?php $x = /* start a comment',
  1325. tokens: [
  1326. { startIndex: 0, type: 'metatag.php' },
  1327. { startIndex: 5, type: '' },
  1328. { startIndex: 6, type: 'variable.php' },
  1329. { startIndex: 8, type: '' },
  1330. { startIndex: 9, type: 'delimiter.php' },
  1331. { startIndex: 10, type: '' },
  1332. { startIndex: 11, type: 'comment.php' }
  1333. ]
  1334. }, {
  1335. line: ' a ',
  1336. tokens: [
  1337. { startIndex: 0, type: 'comment.php' }
  1338. ]
  1339. }, {
  1340. line: 'and end it */ var a = 2;',
  1341. tokens: [
  1342. { startIndex: 0, type: 'comment.php' },
  1343. { startIndex: 13, type: '' },
  1344. { startIndex: 14, type: 'keyword.php' },
  1345. { startIndex: 17, type: '' },
  1346. { startIndex: 18, type: 'identifier.php' },
  1347. { startIndex: 19, type: '' },
  1348. { startIndex: 20, type: 'delimiter.php' },
  1349. { startIndex: 21, type: '' },
  1350. { startIndex: 22, type: 'number.php' },
  1351. { startIndex: 23, type: 'delimiter.php' }
  1352. ]
  1353. }],
  1354. // Strings
  1355. [{
  1356. line: '<?php $a = \'a\'; ?>',
  1357. tokens: [
  1358. { startIndex: 0, type: 'metatag.php' },
  1359. { startIndex: 5, type: '' },
  1360. { startIndex: 6, type: 'variable.php' },
  1361. { startIndex: 8, type: '' },
  1362. { startIndex: 9, type: 'delimiter.php' },
  1363. { startIndex: 10, type: '' },
  1364. { startIndex: 11, type: 'string.php' },
  1365. { startIndex: 14, type: 'delimiter.php' },
  1366. { startIndex: 15, type: '' },
  1367. { startIndex: 16, type: 'metatag.php' }
  1368. ]
  1369. }],
  1370. [{
  1371. line: '<?php \'use strict\'; ?>',
  1372. tokens: [
  1373. { startIndex: 0, type: 'metatag.php' },
  1374. { startIndex: 5, type: '' },
  1375. { startIndex: 6, type: 'string.php' },
  1376. { startIndex: 18, type: 'delimiter.php' },
  1377. { startIndex: 19, type: '' },
  1378. { startIndex: 20, type: 'metatag.php' }
  1379. ]
  1380. }],
  1381. [{
  1382. line: '<?php $b = $a + " \'cool\' " ?>',
  1383. tokens: [
  1384. { startIndex: 0, type: 'metatag.php' },
  1385. { startIndex: 5, type: '' },
  1386. { startIndex: 6, type: 'variable.php' },
  1387. { startIndex: 8, type: '' },
  1388. { startIndex: 9, type: 'delimiter.php' },
  1389. { startIndex: 10, type: '' },
  1390. { startIndex: 11, type: 'variable.php' },
  1391. { startIndex: 13, type: '' },
  1392. { startIndex: 14, type: 'delimiter.php' },
  1393. { startIndex: 15, type: '' },
  1394. { startIndex: 16, type: 'string.php' },
  1395. { startIndex: 27, type: '' },
  1396. { startIndex: 28, type: 'metatag.php' }
  1397. ]
  1398. }],
  1399. [{
  1400. line: '<?php \'\'\'',
  1401. tokens: [
  1402. { startIndex: 0, type: 'metatag.php' },
  1403. { startIndex: 5, type: '' },
  1404. { startIndex: 6, type: 'string.php' },
  1405. ]
  1406. }],
  1407. [{
  1408. line: '<?php "multiline',
  1409. tokens: [
  1410. { startIndex: 0, type: 'metatag.php' },
  1411. { startIndex: 5, type: '' },
  1412. { startIndex: 6, type: 'string.php' }
  1413. ]
  1414. }, {
  1415. line: 'strings";',
  1416. tokens: [
  1417. { startIndex: 0, type: 'string.php' },
  1418. { startIndex: 8, type: 'delimiter.php' }
  1419. ]
  1420. }],
  1421. // Numbers
  1422. [{
  1423. line: '<?php 0 ?>',
  1424. tokens: [
  1425. { startIndex: 0, type: 'metatag.php' },
  1426. { startIndex: 5, type: '' },
  1427. { startIndex: 6, type: 'number.php' },
  1428. { startIndex: 7, type: '' },
  1429. { startIndex: 8, type: 'metatag.php' }
  1430. ]
  1431. }],
  1432. [{
  1433. line: '<?php 0+0 ?>',
  1434. tokens: [
  1435. { startIndex: 0, type: 'metatag.php' },
  1436. { startIndex: 5, type: '' },
  1437. { startIndex: 6, type: 'number.php' },
  1438. { startIndex: 7, type: 'delimiter.php' },
  1439. { startIndex: 8, type: 'number.php' },
  1440. { startIndex: 9, type: '' },
  1441. { startIndex: 10, type: 'metatag.php' }
  1442. ]
  1443. }],
  1444. [{
  1445. line: '<?php 100+10 ?>',
  1446. tokens: [
  1447. { startIndex: 0, type: 'metatag.php' },
  1448. { startIndex: 5, type: '' },
  1449. { startIndex: 6, type: 'number.php' },
  1450. { startIndex: 9, type: 'delimiter.php' },
  1451. { startIndex: 10, type: 'number.php' },
  1452. { startIndex: 12, type: '' },
  1453. { startIndex: 13, type: 'metatag.php' }
  1454. ]
  1455. }],
  1456. [{
  1457. line: '<?php 0 + 0 ?>',
  1458. tokens: [
  1459. { startIndex: 0, type: 'metatag.php' },
  1460. { startIndex: 5, type: '' },
  1461. { startIndex: 6, type: 'number.php' },
  1462. { startIndex: 7, type: '' },
  1463. { startIndex: 8, type: 'delimiter.php' },
  1464. { startIndex: 9, type: '' },
  1465. { startIndex: 10, type: 'number.php' },
  1466. { startIndex: 11, type: '' },
  1467. { startIndex: 12, type: 'metatag.php' }
  1468. ]
  1469. }],
  1470. [{
  1471. line: '<?php 0123 ?>',
  1472. tokens: [
  1473. { startIndex: 0, type: 'metatag.php' },
  1474. { startIndex: 5, type: '' },
  1475. { startIndex: 6, type: 'number.octal.php' },
  1476. { startIndex: 10, type: '' },
  1477. { startIndex: 11, type: 'metatag.php' }
  1478. ]
  1479. }],
  1480. [{
  1481. line: '<?php 01239 ?>',
  1482. tokens: [
  1483. { startIndex: 0, type: 'metatag.php' },
  1484. { startIndex: 5, type: '' },
  1485. { startIndex: 6, type: 'number.octal.php' },
  1486. { startIndex: 10, type: 'number.php' },
  1487. { startIndex: 11, type: '' },
  1488. { startIndex: 12, type: 'metatag.php' }
  1489. ]
  1490. }],
  1491. [{
  1492. line: '<?php 0x ?>',
  1493. tokens: [
  1494. { startIndex: 0, type: 'metatag.php' },
  1495. { startIndex: 5, type: '' },
  1496. { startIndex: 6, type: 'number.php' },
  1497. { startIndex: 7, type: 'identifier.php' },
  1498. { startIndex: 8, type: '' },
  1499. { startIndex: 9, type: 'metatag.php' }
  1500. ]
  1501. }],
  1502. [{
  1503. line: '<?php 0x123 ?>',
  1504. tokens: [
  1505. { startIndex: 0, type: 'metatag.php' },
  1506. { startIndex: 5, type: '' },
  1507. { startIndex: 6, type: 'number.hex.php' },
  1508. { startIndex: 11, type: '' },
  1509. { startIndex: 12, type: 'metatag.php' }
  1510. ]
  1511. }],
  1512. [{
  1513. line: '<?php 0b1 ?>',
  1514. tokens: [
  1515. { startIndex: 0, type: 'metatag.php' },
  1516. { startIndex: 5, type: '' },
  1517. { startIndex: 6, type: 'number.binary.php' },
  1518. { startIndex: 9, type: '' },
  1519. { startIndex: 10, type: 'metatag.php' }
  1520. ]
  1521. }],
  1522. [{
  1523. line: '<?php { } ?>',
  1524. tokens: [
  1525. { startIndex: 0, type: 'metatag.php' },
  1526. { startIndex: 5, type: '' },
  1527. { startIndex: 6, type: 'delimiter.bracket.php' },
  1528. { startIndex: 7, type: '' },
  1529. { startIndex: 8, type: 'delimiter.bracket.php' },
  1530. { startIndex: 9, type: '' },
  1531. { startIndex: 10, type: 'metatag.php' }
  1532. ]
  1533. }],
  1534. [{
  1535. line: '<?php [1,2,3] ?>',
  1536. tokens: [
  1537. { startIndex: 0, type: 'metatag.php' },
  1538. { startIndex: 5, type: '' },
  1539. { startIndex: 6, type: 'delimiter.array.php' },
  1540. { startIndex: 7, type: 'number.php' },
  1541. { startIndex: 8, type: 'delimiter.php' },
  1542. { startIndex: 9, type: 'number.php' },
  1543. { startIndex: 10, type: 'delimiter.php' },
  1544. { startIndex: 11, type: 'number.php' },
  1545. { startIndex: 12, type: 'delimiter.array.php' },
  1546. { startIndex: 13, type: '' },
  1547. { startIndex: 14, type: 'metatag.php' }
  1548. ]
  1549. }],
  1550. [{
  1551. line: '<?php foo(123);',
  1552. tokens: [
  1553. { startIndex: 0, type: 'metatag.php' },
  1554. { startIndex: 5, type: '' },
  1555. { startIndex: 6, type: 'identifier.php' },
  1556. { startIndex: 9, type: 'delimiter.parenthesis.php' },
  1557. { startIndex: 10, type: 'number.php' },
  1558. { startIndex: 13, type: 'delimiter.parenthesis.php' },
  1559. { startIndex: 14, type: 'delimiter.php' }
  1560. ]
  1561. }],
  1562. [{
  1563. line: '<?php $x = "[{()}]" ?>',
  1564. tokens: [
  1565. { startIndex: 0, type: 'metatag.php' },
  1566. { startIndex: 5, type: '' },
  1567. { startIndex: 6, type: 'variable.php' },
  1568. { startIndex: 8, type: '' },
  1569. { startIndex: 9, type: 'delimiter.php' },
  1570. { startIndex: 10, type: '' },
  1571. { startIndex: 11, type: 'string.php' },
  1572. { startIndex: 19, type: '' },
  1573. { startIndex: 20, type: 'metatag.php' }
  1574. ]
  1575. }],
  1576. // Comments - comment with sharp
  1577. [{
  1578. line: '<?php # a',
  1579. tokens: [
  1580. { startIndex: 0, type: 'metatag.php' },
  1581. { startIndex: 5, type: '' },
  1582. { startIndex: 6, type: 'comment.php' }
  1583. ]
  1584. }],
  1585. [{
  1586. line: '<?php ## a',
  1587. tokens: [
  1588. { startIndex: 0, type: 'metatag.php' },
  1589. { startIndex: 5, type: '' },
  1590. { startIndex: 6, type: 'comment.php' }
  1591. ]
  1592. }],
  1593. [{
  1594. line: '<?php # a comment',
  1595. tokens: [
  1596. { startIndex: 0, type: 'metatag.php' },
  1597. { startIndex: 5, type: '' },
  1598. { startIndex: 9, type: 'comment.php' }
  1599. ]
  1600. }],
  1601. [{
  1602. line: '<?php #sticky comment',
  1603. tokens: [
  1604. { startIndex: 0, type: 'metatag.php' },
  1605. { startIndex: 5, type: '' },
  1606. { startIndex: 6, type: 'comment.php' }
  1607. ]
  1608. }],
  1609. [{
  1610. line: '<?php $x = 1; # my comment // is a nice one',
  1611. tokens: [
  1612. { startIndex: 0, type: 'metatag.php' },
  1613. { startIndex: 5, type: '' },
  1614. { startIndex: 6, type: 'variable.php' },
  1615. { startIndex: 8, type: '' },
  1616. { startIndex: 9, type: 'delimiter.php' },
  1617. { startIndex: 10, type: '' },
  1618. { startIndex: 11, type: 'number.php' },
  1619. { startIndex: 12, type: 'delimiter.php' },
  1620. { startIndex: 13, type: '' },
  1621. { startIndex: 14, type: 'comment.php' }
  1622. ]
  1623. }],
  1624. [{
  1625. line: '<?php # comment?>',
  1626. tokens: [
  1627. { startIndex: 0, type: 'metatag.php' },
  1628. { startIndex: 5, type: '' },
  1629. { startIndex: 6, type: 'comment.php' },
  1630. { startIndex: 15, type: 'metatag.php' }
  1631. ]
  1632. }],
  1633. [{
  1634. line: '<?php # comment? ?>',
  1635. tokens: [
  1636. { startIndex: 0, type: 'metatag.php' },
  1637. { startIndex: 5, type: '' },
  1638. { startIndex: 6, type: 'comment.php' },
  1639. { startIndex: 17, type: 'metatag.php' }
  1640. ]
  1641. }],
  1642. // 3-languages parser
  1643. // php
  1644. [{
  1645. line: '<?=\'hi\'?>',
  1646. tokens: [
  1647. { startIndex: 0, type: 'metatag.php' },
  1648. { startIndex: 3, type: 'string.php' },
  1649. { startIndex: 7, type: 'metatag.php' }
  1650. ]
  1651. }],
  1652. // php/html/php
  1653. [{
  1654. line: '<?php5+3?><br/><?=1?>',
  1655. tokens: [
  1656. { startIndex: 0, type: 'metatag.php' },
  1657. { startIndex: 5, type: 'number.php' },
  1658. { startIndex: 6, type: 'delimiter.php' },
  1659. { startIndex: 7, type: 'number.php' },
  1660. { startIndex: 8, type: 'metatag.php' },
  1661. { startIndex: 10, type: htmlTokenTypes.DELIM_START },
  1662. { startIndex: 11, type: htmlTokenTypes.getTag('br') },
  1663. { startIndex: 13, type: htmlTokenTypes.DELIM_END },
  1664. { startIndex: 15, type: 'metatag.php' },
  1665. { startIndex: 18, type: 'number.php' },
  1666. { startIndex: 19, type: 'metatag.php' }
  1667. ]
  1668. }],
  1669. // php/html/php
  1670. [{
  1671. line: '<?php5+3?><abc><?=1?>',
  1672. tokens: [
  1673. { startIndex: 0, type: 'metatag.php' },
  1674. { startIndex: 5, type: 'number.php' },
  1675. { startIndex: 6, type: 'delimiter.php' },
  1676. { startIndex: 7, type: 'number.php' },
  1677. { startIndex: 8, type: 'metatag.php' },
  1678. { startIndex: 10, type: htmlTokenTypes.DELIM_START },
  1679. { startIndex: 11, type: htmlTokenTypes.getTag('abc') },
  1680. { startIndex: 14, type: htmlTokenTypes.DELIM_END },
  1681. { startIndex: 15, type: 'metatag.php' },
  1682. { startIndex: 18, type: 'number.php' },
  1683. { startIndex: 19, type: 'metatag.php' }
  1684. ]
  1685. }],
  1686. // html/php/html
  1687. [{
  1688. line: '<abc><?php5+3?><abc>',
  1689. tokens: [
  1690. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1691. { startIndex: 1, type: htmlTokenTypes.getTag('abc') },
  1692. { startIndex: 4, type: htmlTokenTypes.DELIM_END },
  1693. { startIndex: 5, type: 'metatag.php' },
  1694. { startIndex: 10, type: 'number.php' },
  1695. { startIndex: 11, type: 'delimiter.php' },
  1696. { startIndex: 12, type: 'number.php' },
  1697. { startIndex: 13, type: 'metatag.php' },
  1698. { startIndex: 15, type: htmlTokenTypes.DELIM_START },
  1699. { startIndex: 16, type: htmlTokenTypes.getTag('abc') },
  1700. { startIndex: 19, type: htmlTokenTypes.DELIM_END }
  1701. ]
  1702. }],
  1703. // html/js/php/html
  1704. [{
  1705. line: '<abc><script>var i= 10;</script><?php5+3?><abc>',
  1706. tokens: [
  1707. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1708. { startIndex: 1, type: htmlTokenTypes.getTag('abc') },
  1709. { startIndex: 4, type: htmlTokenTypes.DELIM_END },
  1710. // { startIndex:5, type: htmlTokenTypes.DELIM_START },
  1711. { startIndex: 6, type: htmlTokenTypes.getTag('script') },
  1712. { startIndex: 12, type: htmlTokenTypes.DELIM_END },
  1713. { startIndex: 13, type: '' },
  1714. { startIndex: 23, type: htmlTokenTypes.DELIM_START },
  1715. { startIndex: 25, type: htmlTokenTypes.getTag('script') },
  1716. { startIndex: 31, type: htmlTokenTypes.DELIM_END },
  1717. { startIndex: 32, type: 'metatag.php' },
  1718. { startIndex: 37, type: 'number.php' },
  1719. { startIndex: 38, type: 'delimiter.php' },
  1720. { startIndex: 39, type: 'number.php' },
  1721. { startIndex: 40, type: 'metatag.php' },
  1722. { startIndex: 42, type: htmlTokenTypes.DELIM_START },
  1723. { startIndex: 43, type: htmlTokenTypes.getTag('abc') },
  1724. { startIndex: 46, type: htmlTokenTypes.DELIM_END }
  1725. ]
  1726. }],
  1727. // html/js/php/js/
  1728. [{
  1729. line: '<abc><script>var i= 10;</script><?php5+3?><script>var x= 15;</script>',
  1730. tokens: [
  1731. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1732. { startIndex: 1, type: htmlTokenTypes.getTag('abc') },
  1733. { startIndex: 4, type: htmlTokenTypes.DELIM_END },
  1734. // { startIndex:5, type: htmlTokenTypes.DELIM_START },
  1735. { startIndex: 6, type: htmlTokenTypes.getTag('script') },
  1736. { startIndex: 12, type: htmlTokenTypes.DELIM_END },
  1737. { startIndex: 13, type: '' },
  1738. { startIndex: 23, type: htmlTokenTypes.DELIM_START },
  1739. { startIndex: 25, type: htmlTokenTypes.getTag('script') },
  1740. { startIndex: 31, type: htmlTokenTypes.DELIM_END },
  1741. { startIndex: 32, type: 'metatag.php' },
  1742. { startIndex: 37, type: 'number.php' },
  1743. { startIndex: 38, type: 'delimiter.php' },
  1744. { startIndex: 39, type: 'number.php' },
  1745. { startIndex: 40, type: 'metatag.php' },
  1746. { startIndex: 42, type: htmlTokenTypes.DELIM_START },
  1747. { startIndex: 43, type: htmlTokenTypes.getTag('script') },
  1748. { startIndex: 49, type: htmlTokenTypes.DELIM_END },
  1749. { startIndex: 50, type: '' },
  1750. { startIndex: 60, type: htmlTokenTypes.DELIM_START },
  1751. { startIndex: 62, type: htmlTokenTypes.getTag('script') },
  1752. { startIndex: 68, type: htmlTokenTypes.DELIM_END }
  1753. ]
  1754. }],
  1755. // Multiline test
  1756. [{
  1757. line: '<html>',
  1758. tokens: [
  1759. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1760. { startIndex: 1, type: htmlTokenTypes.getTag('html') },
  1761. { startIndex: 5, type: htmlTokenTypes.DELIM_END }
  1762. ]
  1763. }, {
  1764. line: '<style><?="div"?>{ color:blue; }</style>',
  1765. tokens: [
  1766. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1767. { startIndex: 1, type: htmlTokenTypes.getTag('style') },
  1768. { startIndex: 6, type: htmlTokenTypes.DELIM_END },
  1769. { startIndex: 7, type: 'metatag.php' },
  1770. { startIndex: 10, type: 'string.php' },
  1771. { startIndex: 15, type: 'metatag.php' },
  1772. { startIndex: 17, type: 'delimiter.bracket.css' },
  1773. { startIndex: 18, type: '' },
  1774. { startIndex: 19, type: 'attribute.name.css' },
  1775. { startIndex: 25, type: 'attribute.value.css' },
  1776. { startIndex: 29, type: 'delimiter.css' },
  1777. { startIndex: 30, type: '' },
  1778. { startIndex: 31, type: 'delimiter.bracket.css' },
  1779. { startIndex: 32, type: htmlTokenTypes.DELIM_START },
  1780. { startIndex: 34, type: htmlTokenTypes.getTag('style') },
  1781. { startIndex: 39, type: htmlTokenTypes.DELIM_END }
  1782. ]
  1783. }],
  1784. // HTML (CSS (PHP)), HTML ( PHP, JS (PHP), PHP)
  1785. [{
  1786. line: '<html><style><?="div"?> { color:blue; }</style><!--<?="HTML Comment"?>--><script>var x = 3;/* <?="JS Comment"/*</script>*/?> */var y = 4;</script></html><? $x = 3;?>',
  1787. tokens: [
  1788. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1789. { startIndex: 1, type: htmlTokenTypes.getTag('html') },
  1790. { startIndex: 5, type: htmlTokenTypes.DELIM_END },
  1791. // { startIndex:6, type: htmlTokenTypes.DELIM_START },
  1792. { startIndex: 7, type: htmlTokenTypes.getTag('style') },
  1793. { startIndex: 12, type: htmlTokenTypes.DELIM_END },
  1794. { startIndex: 13, type: 'metatag.php' },
  1795. { startIndex: 16, type: 'string.php' },
  1796. { startIndex: 21, type: 'metatag.php' },
  1797. { startIndex: 23, type: '' },
  1798. { startIndex: 24, type: 'delimiter.bracket.css' },
  1799. { startIndex: 25, type: '' },
  1800. { startIndex: 26, type: 'attribute.name.css' },
  1801. { startIndex: 32, type: 'attribute.value.css' },
  1802. { startIndex: 36, type: 'delimiter.css' },
  1803. { startIndex: 37, type: '' },
  1804. { startIndex: 38, type: 'delimiter.bracket.css' },
  1805. { startIndex: 39, type: htmlTokenTypes.DELIM_START },
  1806. { startIndex: 41, type: htmlTokenTypes.getTag('style') },
  1807. { startIndex: 46, type: htmlTokenTypes.DELIM_END },
  1808. { startIndex: 47, type: htmlTokenTypes.DELIM_COMMENT },
  1809. { startIndex: 51, type: 'metatag.php' },
  1810. { startIndex: 54, type: 'string.php' },
  1811. { startIndex: 68, type: 'metatag.php' },
  1812. { startIndex: 70, type: htmlTokenTypes.DELIM_COMMENT },
  1813. { startIndex: 73, type: htmlTokenTypes.DELIM_START },
  1814. { startIndex: 74, type: htmlTokenTypes.getTag('script') },
  1815. { startIndex: 80, type: htmlTokenTypes.DELIM_END },
  1816. { startIndex: 81, type: '' },
  1817. { startIndex: 94, type: 'metatag.php' },
  1818. { startIndex: 97, type: 'string.php' },
  1819. { startIndex: 109, type: 'comment.php' },
  1820. { startIndex: 122, type: 'metatag.php' },
  1821. { startIndex: 124, type: '' },
  1822. { startIndex: 137, type: htmlTokenTypes.DELIM_START },
  1823. { startIndex: 139, type: htmlTokenTypes.getTag('script') },
  1824. { startIndex: 145, type: htmlTokenTypes.DELIM_END },
  1825. // { startIndex:146, type: htmlTokenTypes.DELIM_START },
  1826. { startIndex: 148, type: htmlTokenTypes.getTag('html') },
  1827. { startIndex: 152, type: htmlTokenTypes.DELIM_END },
  1828. { startIndex: 153, type: 'metatag.php' },
  1829. { startIndex: 155, type: '' },
  1830. { startIndex: 156, type: 'variable.php' },
  1831. { startIndex: 158, type: '' },
  1832. { startIndex: 159, type: 'delimiter.php' },
  1833. { startIndex: 160, type: '' },
  1834. { startIndex: 161, type: 'number.php' },
  1835. { startIndex: 162, type: 'delimiter.php' },
  1836. { startIndex: 163, type: 'metatag.php' }
  1837. ]
  1838. }],
  1839. // PHP-tag detection
  1840. [{
  1841. line: '<!--c--><?',
  1842. tokens: [
  1843. { startIndex: 0, type: htmlTokenTypes.DELIM_COMMENT },
  1844. { startIndex: 4, type: htmlTokenTypes.COMMENT },
  1845. { startIndex: 5, type: htmlTokenTypes.DELIM_COMMENT },
  1846. { startIndex: 8, type: 'metatag.php' }
  1847. ]
  1848. }],
  1849. [{
  1850. line: '<script>//<?',
  1851. tokens: [
  1852. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1853. { startIndex: 1, type: htmlTokenTypes.getTag('script') },
  1854. { startIndex: 7, type: htmlTokenTypes.DELIM_END },
  1855. { startIndex: 8, type: '' },
  1856. { startIndex: 10, type: 'metatag.php' }
  1857. ]
  1858. }],
  1859. [{
  1860. line: '<script>"<?php5+3?>"',
  1861. tokens: [
  1862. { startIndex: 0, type: htmlTokenTypes.DELIM_START },
  1863. { startIndex: 1, type: htmlTokenTypes.getTag('script') },
  1864. { startIndex: 7, type: htmlTokenTypes.DELIM_END },
  1865. { startIndex: 8, type: '' },
  1866. { startIndex: 9, type: 'metatag.php' },
  1867. { startIndex: 14, type: 'number.php' },
  1868. { startIndex: 15, type: 'delimiter.php' },
  1869. { startIndex: 16, type: 'number.php' },
  1870. { startIndex: 17, type: 'metatag.php' },
  1871. { startIndex: 19, type: '' }
  1872. ]
  1873. }],
  1874. [{
  1875. line: '<?php toString(); ?>',
  1876. tokens: [
  1877. { startIndex: 0, type: 'metatag.php' },
  1878. { startIndex: 5, type: '' },
  1879. { startIndex: 6, type: 'identifier.php' },
  1880. { startIndex: 14, type: 'delimiter.parenthesis.php' },
  1881. { startIndex: 16, type: 'delimiter.php' },
  1882. { startIndex: 17, type: '' },
  1883. { startIndex: 18, type: 'metatag.php' }
  1884. ]
  1885. }]
  1886. ]);