Keywords.cpp 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862
  1. // Copyright (c) 2008 Roberto Raggi <[email protected]>
  2. //
  3. // Permission is hereby granted, free of charge, to any person obtaining a copy
  4. // of this software and associated documentation files (the "Software"), to deal
  5. // in the Software without restriction, including without limitation the rights
  6. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. // copies of the Software, and to permit persons to whom the Software is
  8. // furnished to do so, subject to the following conditions:
  9. //
  10. // The above copyright notice and this permission notice shall be included in
  11. // all copies or substantial portions of the Software.
  12. //
  13. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. // THE SOFTWARE.
  20. #include "Lexer.h"
  21. #include "Token.h"
  22. namespace CPlusPlus {
  23. static inline int classify2(const char *s, LanguageFeatures)
  24. {
  25. if (s[0] == 'd') {
  26. if (s[1] == 'o') {
  27. return T_DO;
  28. }
  29. }
  30. else if (s[0] == 'i') {
  31. if (s[1] == 'f') {
  32. return T_IF;
  33. }
  34. }
  35. return T_IDENTIFIER;
  36. }
  37. static inline int classify3(const char *s, LanguageFeatures features)
  38. {
  39. if (s[0] == 'a') {
  40. if (s[1] == 's') {
  41. if (s[2] == 'm') {
  42. return T_ASM;
  43. }
  44. }
  45. }
  46. else if (s[0] == 'f') {
  47. if (s[1] == 'o') {
  48. if (s[2] == 'r') {
  49. return T_FOR;
  50. }
  51. }
  52. }
  53. else if (s[0] == 'i') {
  54. if (s[1] == 'n') {
  55. if (s[2] == 't') {
  56. return T_INT;
  57. }
  58. }
  59. }
  60. else if (s[0] == 'n') {
  61. if (s[1] == 'e') {
  62. if (s[2] == 'w') {
  63. return T_NEW;
  64. }
  65. }
  66. }
  67. else if (s[0] == 't') {
  68. if (s[1] == 'r') {
  69. if (s[2] == 'y') {
  70. return T_TRY;
  71. }
  72. }
  73. }
  74. else if (features.qtMocRunEnabled && s[0] == 'Q') {
  75. if (s[1] == '_') {
  76. if (s[2] == 'D') {
  77. return T_Q_D;
  78. }
  79. else if (s[2] == 'Q') {
  80. return T_Q_Q;
  81. }
  82. }
  83. }
  84. return T_IDENTIFIER;
  85. }
  86. static inline int classify4(const char *s, LanguageFeatures features)
  87. {
  88. if (s[0] == 'a') {
  89. if (s[1] == 'u') {
  90. if (s[2] == 't') {
  91. if (s[3] == 'o') {
  92. return T_AUTO;
  93. }
  94. }
  95. }
  96. }
  97. else if (s[0] == 'b') {
  98. if (s[1] == 'o') {
  99. if (s[2] == 'o') {
  100. if (s[3] == 'l') {
  101. return T_BOOL;
  102. }
  103. }
  104. }
  105. }
  106. else if (s[0] == 'c') {
  107. if (s[1] == 'a') {
  108. if (s[2] == 's') {
  109. if (s[3] == 'e') {
  110. return T_CASE;
  111. }
  112. }
  113. }
  114. else if (s[1] == 'h') {
  115. if (s[2] == 'a') {
  116. if (s[3] == 'r') {
  117. return T_CHAR;
  118. }
  119. }
  120. }
  121. }
  122. else if (s[0] == 'e') {
  123. if (s[1] == 'l') {
  124. if (s[2] == 's') {
  125. if (s[3] == 'e') {
  126. return T_ELSE;
  127. }
  128. }
  129. }
  130. else if (s[1] == 'n') {
  131. if (s[2] == 'u') {
  132. if (s[3] == 'm') {
  133. return T_ENUM;
  134. }
  135. }
  136. }
  137. else if (features.qtKeywordsEnabled && s[1] == 'm') {
  138. if (s[2] == 'i') {
  139. if (s[3] == 't') {
  140. return T_EMIT;
  141. }
  142. }
  143. }
  144. }
  145. else if (s[0] == 'g') {
  146. if (s[1] == 'o') {
  147. if (s[2] == 't') {
  148. if (s[3] == 'o') {
  149. return T_GOTO;
  150. }
  151. }
  152. }
  153. }
  154. else if (s[0] == 'l') {
  155. if (s[1] == 'o') {
  156. if (s[2] == 'n') {
  157. if (s[3] == 'g') {
  158. return T_LONG;
  159. }
  160. }
  161. }
  162. }
  163. else if (s[0] == 't') {
  164. if (s[1] == 'h') {
  165. if (s[2] == 'i') {
  166. if (s[3] == 's') {
  167. return T_THIS;
  168. }
  169. }
  170. }
  171. else if (s[1] == 'r') {
  172. if (s[2] == 'u') {
  173. if (s[3] == 'e') {
  174. return T_TRUE;
  175. }
  176. }
  177. }
  178. }
  179. else if (s[0] == 'v') {
  180. if (s[1] == 'o') {
  181. if (s[2] == 'i') {
  182. if (s[3] == 'd') {
  183. return T_VOID;
  184. }
  185. }
  186. }
  187. }
  188. else if (features.qtEnabled && s[0] == 'S') {
  189. if (s[1] == 'L') {
  190. if (s[2] == 'O') {
  191. if (s[3] == 'T') {
  192. return T_SLOT;
  193. }
  194. }
  195. }
  196. }
  197. return T_IDENTIFIER;
  198. }
  199. static inline int classify5(const char *s, LanguageFeatures features)
  200. {
  201. if (s[0] == '_') {
  202. if (s[1] == '_') {
  203. if (s[2] == 'a') {
  204. if (s[3] == 's') {
  205. if (s[4] == 'm') {
  206. return T___ASM;
  207. }
  208. }
  209. }
  210. }
  211. }
  212. else if (s[0] == 'b') {
  213. if (s[1] == 'r') {
  214. if (s[2] == 'e') {
  215. if (s[3] == 'a') {
  216. if (s[4] == 'k') {
  217. return T_BREAK;
  218. }
  219. }
  220. }
  221. }
  222. }
  223. else if (s[0] == 'c') {
  224. if (s[1] == 'a') {
  225. if (s[2] == 't') {
  226. if (s[3] == 'c') {
  227. if (s[4] == 'h') {
  228. return T_CATCH;
  229. }
  230. }
  231. }
  232. }
  233. else if (s[1] == 'l') {
  234. if (s[2] == 'a') {
  235. if (s[3] == 's') {
  236. if (s[4] == 's') {
  237. return T_CLASS;
  238. }
  239. }
  240. }
  241. }
  242. else if (s[1] == 'o') {
  243. if (s[2] == 'n') {
  244. if (s[3] == 's') {
  245. if (s[4] == 't') {
  246. return T_CONST;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. else if (s[0] == 'f') {
  253. if (s[1] == 'a') {
  254. if (s[2] == 'l') {
  255. if (s[3] == 's') {
  256. if (s[4] == 'e') {
  257. return T_FALSE;
  258. }
  259. }
  260. }
  261. }
  262. else if (s[1] == 'l') {
  263. if (s[2] == 'o') {
  264. if (s[3] == 'a') {
  265. if (s[4] == 't') {
  266. return T_FLOAT;
  267. }
  268. }
  269. }
  270. }
  271. }
  272. else if (s[0] == 's') {
  273. if (s[1] == 'h') {
  274. if (s[2] == 'o') {
  275. if (s[3] == 'r') {
  276. if (s[4] == 't') {
  277. return T_SHORT;
  278. }
  279. }
  280. }
  281. }
  282. else if (features.qtKeywordsEnabled) {
  283. if (s[1] == 'l') {
  284. if (s[2] == 'o') {
  285. if (s[3] == 't') {
  286. if (s[4] == 's') {
  287. return T_Q_SLOTS;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. }
  294. else if (s[0] == 't') {
  295. if (s[1] == 'h') {
  296. if (s[2] == 'r') {
  297. if (s[3] == 'o') {
  298. if (s[4] == 'w') {
  299. return T_THROW;
  300. }
  301. }
  302. }
  303. }
  304. }
  305. else if (s[0] == 'u') {
  306. if (s[1] == 'n') {
  307. if (s[2] == 'i') {
  308. if (s[3] == 'o') {
  309. if (s[4] == 'n') {
  310. return T_UNION;
  311. }
  312. }
  313. }
  314. }
  315. else if (s[1] == 's') {
  316. if (s[2] == 'i') {
  317. if (s[3] == 'n') {
  318. if (s[4] == 'g') {
  319. return T_USING;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. else if (s[0] == 'w') {
  326. if (s[1] == 'h') {
  327. if (s[2] == 'i') {
  328. if (s[3] == 'l') {
  329. if (s[4] == 'e') {
  330. return T_WHILE;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. return T_IDENTIFIER;
  337. }
  338. static inline int classify6(const char *s, LanguageFeatures features)
  339. {
  340. if (s[0] == 'd') {
  341. if (s[1] == 'e') {
  342. if (s[2] == 'l') {
  343. if (s[3] == 'e') {
  344. if (s[4] == 't') {
  345. if (s[5] == 'e') {
  346. return T_DELETE;
  347. }
  348. }
  349. }
  350. }
  351. }
  352. else if (s[1] == 'o') {
  353. if (s[2] == 'u') {
  354. if (s[3] == 'b') {
  355. if (s[4] == 'l') {
  356. if (s[5] == 'e') {
  357. return T_DOUBLE;
  358. }
  359. }
  360. }
  361. }
  362. }
  363. }
  364. else if (s[0] == 'e') {
  365. if (s[1] == 'x') {
  366. if (s[2] == 'p') {
  367. if (s[3] == 'o') {
  368. if (s[4] == 'r') {
  369. if (s[5] == 't') {
  370. return T_EXPORT;
  371. }
  372. }
  373. }
  374. }
  375. else if (s[2] == 't') {
  376. if (s[3] == 'e') {
  377. if (s[4] == 'r') {
  378. if (s[5] == 'n') {
  379. return T_EXTERN;
  380. }
  381. }
  382. }
  383. }
  384. }
  385. }
  386. else if (s[0] == 'f') {
  387. if (s[1] == 'r') {
  388. if (s[2] == 'i') {
  389. if (s[3] == 'e') {
  390. if (s[4] == 'n') {
  391. if (s[5] == 'd') {
  392. return T_FRIEND;
  393. }
  394. }
  395. }
  396. }
  397. }
  398. }
  399. else if (s[0] == 'i') {
  400. if (s[1] == 'n') {
  401. if (s[2] == 'l') {
  402. if (s[3] == 'i') {
  403. if (s[4] == 'n') {
  404. if (s[5] == 'e') {
  405. return T_INLINE;
  406. }
  407. }
  408. }
  409. }
  410. }
  411. }
  412. else if (s[0] == 'p') {
  413. if (s[1] == 'u') {
  414. if (s[2] == 'b') {
  415. if (s[3] == 'l') {
  416. if (s[4] == 'i') {
  417. if (s[5] == 'c') {
  418. return T_PUBLIC;
  419. }
  420. }
  421. }
  422. }
  423. }
  424. }
  425. else if (s[0] == 'r') {
  426. if (s[1] == 'e') {
  427. if (s[2] == 't') {
  428. if (s[3] == 'u') {
  429. if (s[4] == 'r') {
  430. if (s[5] == 'n') {
  431. return T_RETURN;
  432. }
  433. }
  434. }
  435. }
  436. }
  437. }
  438. else if (s[0] == 's') {
  439. if (s[1] == 'i') {
  440. if (s[2] == 'g') {
  441. if (s[3] == 'n') {
  442. if (s[4] == 'e') {
  443. if (s[5] == 'd') {
  444. return T_SIGNED;
  445. }
  446. }
  447. }
  448. }
  449. else if (s[2] == 'z') {
  450. if (s[3] == 'e') {
  451. if (s[4] == 'o') {
  452. if (s[5] == 'f') {
  453. return T_SIZEOF;
  454. }
  455. }
  456. }
  457. }
  458. }
  459. else if (s[1] == 't') {
  460. if (s[2] == 'a') {
  461. if (s[3] == 't') {
  462. if (s[4] == 'i') {
  463. if (s[5] == 'c') {
  464. return T_STATIC;
  465. }
  466. }
  467. }
  468. }
  469. else if (s[2] == 'r') {
  470. if (s[3] == 'u') {
  471. if (s[4] == 'c') {
  472. if (s[5] == 't') {
  473. return T_STRUCT;
  474. }
  475. }
  476. }
  477. }
  478. }
  479. else if (s[1] == 'w') {
  480. if (s[2] == 'i') {
  481. if (s[3] == 't') {
  482. if (s[4] == 'c') {
  483. if (s[5] == 'h') {
  484. return T_SWITCH;
  485. }
  486. }
  487. }
  488. }
  489. }
  490. }
  491. else if (s[0] == 't') {
  492. if (s[1] == 'y') {
  493. if (s[2] == 'p') {
  494. if (s[3] == 'e') {
  495. if (s[4] == 'i') {
  496. if (s[5] == 'd') {
  497. return T_TYPEID;
  498. }
  499. }
  500. else if (s[4] == 'o') {
  501. if (s[5] == 'f') {
  502. return T_TYPEOF;
  503. }
  504. }
  505. }
  506. }
  507. }
  508. }
  509. else if (features.qtKeywordsEnabled && s[0] == 'S') {
  510. if (s[1] == 'I') {
  511. if (s[2] == 'G') {
  512. if (s[3] == 'N') {
  513. if (s[4] == 'A') {
  514. if (s[5] == 'L') {
  515. return T_SIGNAL;
  516. }
  517. }
  518. }
  519. }
  520. }
  521. }
  522. else if (features.qtKeywordsEnabled && s[0] == 'Q') {
  523. if (s[1] == '_') {
  524. if (s[2] == 'S') {
  525. if (s[3] == 'L') {
  526. if (s[4] == 'O') {
  527. if (s[5] == 'T') {
  528. return T_Q_SLOT;
  529. }
  530. }
  531. }
  532. }
  533. else if (s[2] == 'E') {
  534. if (s[3] == 'M') {
  535. if (s[4] == 'I') {
  536. if (s[5] == 'T') {
  537. return T_Q_EMIT;
  538. }
  539. }
  540. }
  541. }
  542. }
  543. }
  544. return T_IDENTIFIER;
  545. }
  546. static inline int classify7(const char *s, LanguageFeatures features)
  547. {
  548. if (s[0] == '_') {
  549. if (s[1] == '_') {
  550. if (s[2] == 'a') {
  551. if (s[3] == 's') {
  552. if (s[4] == 'm') {
  553. if (s[5] == '_') {
  554. if (s[6] == '_') {
  555. return T___ASM__;
  556. }
  557. }
  558. }
  559. }
  560. }
  561. else if (s[2] == 'c') {
  562. if (s[3] == 'o') {
  563. if (s[4] == 'n') {
  564. if (s[5] == 's') {
  565. if (s[6] == 't') {
  566. return T___CONST;
  567. }
  568. }
  569. }
  570. }
  571. }
  572. }
  573. }
  574. else if (features.cxx11Enabled && s[0] == 'a') {
  575. if (s[1] == 'l') {
  576. if (s[2] == 'i') {
  577. if (s[3] == 'g') {
  578. if (s[4] == 'n') {
  579. if (s[5] == 'a') {
  580. if (s[6] == 's') {
  581. return T_ALIGNAS;
  582. }
  583. }
  584. else if (s[5] == 'o') {
  585. if (s[6] == 'f') {
  586. return T_ALIGNOF;
  587. }
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. else if (s[0] == 'd') {
  595. if (s[1] == 'e') {
  596. if (s[2] == 'f') {
  597. if (s[3] == 'a') {
  598. if (s[4] == 'u') {
  599. if (s[5] == 'l') {
  600. if (s[6] == 't') {
  601. return T_DEFAULT;
  602. }
  603. }
  604. }
  605. }
  606. }
  607. }
  608. }
  609. else if (s[0] == 'm') {
  610. if (s[1] == 'u') {
  611. if (s[2] == 't') {
  612. if (s[3] == 'a') {
  613. if (s[4] == 'b') {
  614. if (s[5] == 'l') {
  615. if (s[6] == 'e') {
  616. return T_MUTABLE;
  617. }
  618. }
  619. }
  620. }
  621. }
  622. }
  623. }
  624. else if (features.cxx11Enabled && s[0] == 'n') {
  625. if (s[1] == 'u') {
  626. if (s[2] == 'l') {
  627. if (s[3] == 'l') {
  628. if (s[4] == 'p') {
  629. if (s[5] == 't') {
  630. if (s[6] == 'r') {
  631. return T_NULLPTR;
  632. }
  633. }
  634. }
  635. }
  636. }
  637. }
  638. }
  639. else if (s[0] == 'p') {
  640. if (s[1] == 'r') {
  641. if (s[2] == 'i') {
  642. if (s[3] == 'v') {
  643. if (s[4] == 'a') {
  644. if (s[5] == 't') {
  645. if (s[6] == 'e') {
  646. return T_PRIVATE;
  647. }
  648. }
  649. }
  650. }
  651. }
  652. }
  653. }
  654. else if (features.qtKeywordsEnabled && s[0] == 'f') {
  655. if (s[1] == 'o') {
  656. if (s[2] == 'r') {
  657. if (s[3] == 'e') {
  658. if (s[4] == 'a') {
  659. if (s[5] == 'c') {
  660. if (s[6] == 'h') {
  661. return T_Q_FOREACH;
  662. }
  663. }
  664. }
  665. }
  666. }
  667. }
  668. }
  669. else if (features.qtEnabled && s[0] == 's') {
  670. if (s[1] == 'i') {
  671. if (s[2] == 'g') {
  672. if (s[3] == 'n') {
  673. if (s[4] == 'a') {
  674. if (s[5] == 'l') {
  675. if (s[6] == 's') {
  676. return T_Q_SIGNALS;
  677. }
  678. }
  679. }
  680. }
  681. }
  682. }
  683. }
  684. else if (s[0] == 't') {
  685. if (s[1] == 'y') {
  686. if (s[2] == 'p') {
  687. if (s[3] == 'e') {
  688. if (s[4] == 'd') {
  689. if (s[5] == 'e') {
  690. if (s[6] == 'f') {
  691. return T_TYPEDEF;
  692. }
  693. }
  694. }
  695. }
  696. }
  697. }
  698. }
  699. else if (s[0] == 'v') {
  700. if (s[1] == 'i') {
  701. if (s[2] == 'r') {
  702. if (s[3] == 't') {
  703. if (s[4] == 'u') {
  704. if (s[5] == 'a') {
  705. if (s[6] == 'l') {
  706. return T_VIRTUAL;
  707. }
  708. }
  709. }
  710. }
  711. }
  712. }
  713. }
  714. else if (s[0] == 'w') {
  715. if (s[1] == 'c') {
  716. if (s[2] == 'h') {
  717. if (s[3] == 'a') {
  718. if (s[4] == 'r') {
  719. if (s[5] == '_') {
  720. if (s[6] == 't') {
  721. return T_WCHAR_T;
  722. }
  723. }
  724. }
  725. }
  726. }
  727. }
  728. }
  729. else if (features.qtEnabled && s[0] == 'Q') {
  730. if (s[1] == '_') {
  731. if (s[2] == 'S') {
  732. if (s[3] == 'L') {
  733. if (s[4] == 'O') {
  734. if (s[5] == 'T') {
  735. if (s[6] == 'S') {
  736. return T_Q_SLOTS;
  737. }
  738. }
  739. }
  740. }
  741. }
  742. else if (s[2] == 'E') {
  743. if (s[3] == 'N') {
  744. if (s[4] == 'U') {
  745. if (s[5] == 'M') {
  746. if (s[6] == 'S') {
  747. return T_Q_ENUMS;
  748. }
  749. }
  750. }
  751. }
  752. }
  753. else if (s[2] == 'F') {
  754. if (s[3] == 'L') {
  755. if (s[4] == 'A') {
  756. if (s[5] == 'G') {
  757. if (s[6] == 'S') {
  758. return T_Q_FLAGS;
  759. }
  760. }
  761. }
  762. }
  763. }
  764. }
  765. }
  766. return T_IDENTIFIER;
  767. }
  768. static inline int classify8(const char *s, LanguageFeatures features)
  769. {
  770. if (s[0] == '_') {
  771. if (s[1] == '_') {
  772. if (s[2] == 'i') {
  773. if (s[3] == 'n') {
  774. if (s[4] == 'l') {
  775. if (s[5] == 'i') {
  776. if (s[6] == 'n') {
  777. if (s[7] == 'e') {
  778. return T___INLINE;
  779. }
  780. }
  781. }
  782. }
  783. }
  784. }
  785. else if (s[2] == 't') {
  786. if (s[3] == 'y') {
  787. if (s[4] == 'p') {
  788. if (s[5] == 'e') {
  789. if (s[6] == 'o') {
  790. if (s[7] == 'f') {
  791. return T___TYPEOF;
  792. }
  793. }
  794. }
  795. }
  796. }
  797. else if (s[3] == 'h') {
  798. if (s[4] == 'r') {
  799. if (s[5] == 'e') {
  800. if (s[6] == 'a') {
  801. if (s[7] == 'd') {
  802. return T___THREAD;
  803. }
  804. }
  805. }
  806. }
  807. }
  808. }
  809. }
  810. }
  811. else if (s[0] == 'c') {
  812. if (s[1] == 'o') {
  813. if (s[2] == 'n') {
  814. if (s[3] == 't') {
  815. if (s[4] == 'i') {
  816. if (s[5] == 'n') {
  817. if (s[6] == 'u') {
  818. if (s[7] == 'e') {
  819. return T_CONTINUE;
  820. }
  821. }
  822. }
  823. }
  824. }
  825. }
  826. } else if (features.cxx11Enabled && s[1] == 'h') {
  827. if (s[2] == 'a') {
  828. if (s[3] == 'r') {
  829. if (s[4] == '1') {
  830. if (s[5] == '6') {
  831. if (s[6] == '_') {
  832. if (s[7] == 't') {
  833. return T_CHAR16_T;
  834. }
  835. }
  836. }
  837. } else if (s[4] == '3') {
  838. if (s[5] == '2') {
  839. if (s[6] == '_') {
  840. if (s[7] == 't') {
  841. return T_CHAR32_T;
  842. }
  843. }
  844. }
  845. }
  846. }
  847. }
  848. }
  849. }
  850. else if (features.cxx11Enabled && s[0] == 'd') {
  851. if (s[1] == 'e') {
  852. if (s[2] == 'c') {
  853. if (s[3] == 'l') {
  854. if (s[4] == 't') {
  855. if (s[5] == 'y') {
  856. if (s[6] == 'p') {
  857. if (s[7] == 'e') {
  858. return T_DECLTYPE;
  859. }
  860. }
  861. }
  862. }
  863. }
  864. }
  865. }
  866. }
  867. else if (s[0] == 'e') {
  868. if (s[1] == 'x') {
  869. if (s[2] == 'p') {
  870. if (s[3] == 'l') {
  871. if (s[4] == 'i') {
  872. if (s[5] == 'c') {
  873. if (s[6] == 'i') {
  874. if (s[7] == 't') {
  875. return T_EXPLICIT;
  876. }
  877. }
  878. }
  879. }
  880. }
  881. }
  882. }
  883. }
  884. else if (features.cxx11Enabled && s[0] == 'n') {
  885. if (s[1] == 'o') {
  886. if (s[2] == 'e') {
  887. if (s[3] == 'x') {
  888. if (s[4] == 'c') {
  889. if (s[5] == 'e') {
  890. if (s[6] == 'p') {
  891. if (s[7] == 't') {
  892. return T_NOEXCEPT;
  893. }
  894. }
  895. }
  896. }
  897. }
  898. }
  899. }
  900. }
  901. else if (s[0] == 'o') {
  902. if (s[1] == 'p') {
  903. if (s[2] == 'e') {
  904. if (s[3] == 'r') {
  905. if (s[4] == 'a') {
  906. if (s[5] == 't') {
  907. if (s[6] == 'o') {
  908. if (s[7] == 'r') {
  909. return T_OPERATOR;
  910. }
  911. }
  912. }
  913. }
  914. }
  915. }
  916. }
  917. }
  918. else if (s[0] == 'r') {
  919. if (s[1] == 'e') {
  920. if (s[2] == 'g') {
  921. if (s[3] == 'i') {
  922. if (s[4] == 's') {
  923. if (s[5] == 't') {
  924. if (s[6] == 'e') {
  925. if (s[7] == 'r') {
  926. return T_REGISTER;
  927. }
  928. }
  929. }
  930. }
  931. }
  932. }
  933. }
  934. }
  935. else if (s[0] == 't') {
  936. if (s[1] == 'e') {
  937. if (s[2] == 'm') {
  938. if (s[3] == 'p') {
  939. if (s[4] == 'l') {
  940. if (s[5] == 'a') {
  941. if (s[6] == 't') {
  942. if (s[7] == 'e') {
  943. return T_TEMPLATE;
  944. }
  945. }
  946. }
  947. }
  948. }
  949. }
  950. }
  951. else if (s[1] == 'y') {
  952. if (s[2] == 'p') {
  953. if (s[3] == 'e') {
  954. if (s[4] == 'n') {
  955. if (s[5] == 'a') {
  956. if (s[6] == 'm') {
  957. if (s[7] == 'e') {
  958. return T_TYPENAME;
  959. }
  960. }
  961. }
  962. }
  963. }
  964. }
  965. }
  966. }
  967. else if (s[0] == 'u') {
  968. if (s[1] == 'n') {
  969. if (s[2] == 's') {
  970. if (s[3] == 'i') {
  971. if (s[4] == 'g') {
  972. if (s[5] == 'n') {
  973. if (s[6] == 'e') {
  974. if (s[7] == 'd') {
  975. return T_UNSIGNED;
  976. }
  977. }
  978. }
  979. }
  980. }
  981. }
  982. }
  983. }
  984. else if (s[0] == 'v') {
  985. if (s[1] == 'o') {
  986. if (s[2] == 'l') {
  987. if (s[3] == 'a') {
  988. if (s[4] == 't') {
  989. if (s[5] == 'i') {
  990. if (s[6] == 'l') {
  991. if (s[7] == 'e') {
  992. return T_VOLATILE;
  993. }
  994. }
  995. }
  996. }
  997. }
  998. }
  999. }
  1000. }
  1001. else if (features.qtEnabled && s[0] == 'Q') {
  1002. if (s[1] == '_') {
  1003. if (s[2] == 'G') {
  1004. if (s[3] == 'A') {
  1005. if (s[4] == 'D') {
  1006. if (s[5] == 'G') {
  1007. if (s[6] == 'E') {
  1008. if (s[7] == 'T') {
  1009. return T_Q_GADGET;
  1010. }
  1011. }
  1012. }
  1013. }
  1014. }
  1015. }
  1016. else if (s[2] == 'O') {
  1017. if (s[3] == 'B') {
  1018. if (s[4] == 'J') {
  1019. if (s[5] == 'E') {
  1020. if (s[6] == 'C') {
  1021. if (s[7] == 'T') {
  1022. return T_Q_OBJECT;
  1023. }
  1024. }
  1025. }
  1026. }
  1027. }
  1028. }
  1029. else if (s[2] == 'S') {
  1030. if (s[3] == 'I') {
  1031. if (s[4] == 'G') {
  1032. if (s[5] == 'N') {
  1033. if (s[6] == 'A') {
  1034. if (s[7] == 'L') {
  1035. return T_Q_SIGNAL;
  1036. }
  1037. }
  1038. }
  1039. }
  1040. }
  1041. }
  1042. }
  1043. }
  1044. return T_IDENTIFIER;
  1045. }
  1046. static inline int classify9(const char *s, LanguageFeatures features)
  1047. {
  1048. if (s[0] == '_') {
  1049. if (s[1] == '_') {
  1050. if (s[2] == 'c') {
  1051. if (s[3] == 'o') {
  1052. if (s[4] == 'n') {
  1053. if (s[5] == 's') {
  1054. if (s[6] == 't') {
  1055. if (s[7] == '_') {
  1056. if (s[8] == '_') {
  1057. return T___CONST__;
  1058. }
  1059. }
  1060. }
  1061. }
  1062. }
  1063. }
  1064. }
  1065. }
  1066. }
  1067. else if (features.cxx11Enabled && s[0] == 'c') {
  1068. if (s[1] == 'o') {
  1069. if (s[2] == 'n') {
  1070. if (s[3] == 's') {
  1071. if (s[4] == 't') {
  1072. if (s[5] == 'e') {
  1073. if (s[6] == 'x') {
  1074. if (s[7] == 'p') {
  1075. if (s[8] == 'r') {
  1076. return T_CONSTEXPR;
  1077. }
  1078. }
  1079. }
  1080. }
  1081. }
  1082. }
  1083. }
  1084. }
  1085. }
  1086. else if (s[0] == 'n') {
  1087. if (s[1] == 'a') {
  1088. if (s[2] == 'm') {
  1089. if (s[3] == 'e') {
  1090. if (s[4] == 's') {
  1091. if (s[5] == 'p') {
  1092. if (s[6] == 'a') {
  1093. if (s[7] == 'c') {
  1094. if (s[8] == 'e') {
  1095. return T_NAMESPACE;
  1096. }
  1097. }
  1098. }
  1099. }
  1100. }
  1101. }
  1102. }
  1103. }
  1104. }
  1105. else if (s[0] == 'p') {
  1106. if (s[1] == 'r') {
  1107. if (s[2] == 'o') {
  1108. if (s[3] == 't') {
  1109. if (s[4] == 'e') {
  1110. if (s[5] == 'c') {
  1111. if (s[6] == 't') {
  1112. if (s[7] == 'e') {
  1113. if (s[8] == 'd') {
  1114. return T_PROTECTED;
  1115. }
  1116. }
  1117. }
  1118. }
  1119. }
  1120. }
  1121. }
  1122. }
  1123. }
  1124. else if (features.qtEnabled && s[0] == 'Q') {
  1125. if (s[1] == '_') {
  1126. if (s[2] == 'S') {
  1127. if (s[3] == 'I') {
  1128. if (s[4] == 'G') {
  1129. if (s[5] == 'N') {
  1130. if (s[6] == 'A') {
  1131. if (s[7] == 'L') {
  1132. if (s[8] == 'S') {
  1133. return T_Q_SIGNALS;
  1134. }
  1135. }
  1136. }
  1137. }
  1138. }
  1139. }
  1140. } else if (s[2] == 'F') {
  1141. if (s[3] == 'O') {
  1142. if (s[4] == 'R') {
  1143. if (s[5] == 'E') {
  1144. if (s[6] == 'A') {
  1145. if (s[7] == 'C') {
  1146. if (s[8] == 'H') {
  1147. return T_Q_FOREACH;
  1148. }
  1149. }
  1150. }
  1151. }
  1152. }
  1153. }
  1154. }
  1155. }
  1156. }
  1157. return T_IDENTIFIER;
  1158. }
  1159. static inline int classify10(const char *s, LanguageFeatures features)
  1160. {
  1161. if (s[0] == '_') {
  1162. if (s[1] == '_') {
  1163. if (s[2] == 'i') {
  1164. if (s[3] == 'n') {
  1165. if (s[4] == 'l') {
  1166. if (s[5] == 'i') {
  1167. if (s[6] == 'n') {
  1168. if (s[7] == 'e') {
  1169. if (s[8] == '_') {
  1170. if (s[9] == '_') {
  1171. return T___INLINE__;
  1172. }
  1173. }
  1174. }
  1175. }
  1176. }
  1177. }
  1178. }
  1179. }
  1180. else if (s[2] == 'd') {
  1181. if (s[3] == 'e') {
  1182. if (s[4] == 'c') {
  1183. if (s[5] == 'l') {
  1184. if (s[6] == 't') {
  1185. if (s[7] == 'y') {
  1186. if (s[8] == 'p') {
  1187. if (s[9] == 'e') {
  1188. return T___DECLTYPE;
  1189. }
  1190. }
  1191. }
  1192. }
  1193. }
  1194. }
  1195. }
  1196. }
  1197. else if (s[2] == 't') {
  1198. if (s[3] == 'y') {
  1199. if (s[4] == 'p') {
  1200. if (s[5] == 'e') {
  1201. if (s[6] == 'o') {
  1202. if (s[7] == 'f') {
  1203. if (s[8] == '_') {
  1204. if (s[9] == '_') {
  1205. return T___TYPEOF__;
  1206. }
  1207. }
  1208. }
  1209. }
  1210. }
  1211. }
  1212. }
  1213. }
  1214. else if (s[2] == 'v') {
  1215. if (s[3] == 'o') {
  1216. if (s[4] == 'l') {
  1217. if (s[5] == 'a') {
  1218. if (s[6] == 't') {
  1219. if (s[7] == 'i') {
  1220. if (s[8] == 'l') {
  1221. if (s[9] == 'e') {
  1222. return T___VOLATILE;
  1223. }
  1224. }
  1225. }
  1226. }
  1227. }
  1228. }
  1229. }
  1230. }
  1231. }
  1232. }
  1233. else if (s[0] == 'c') {
  1234. if (s[1] == 'o') {
  1235. if (s[2] == 'n') {
  1236. if (s[3] == 's') {
  1237. if (s[4] == 't') {
  1238. if (s[5] == '_') {
  1239. if (s[6] == 'c') {
  1240. if (s[7] == 'a') {
  1241. if (s[8] == 's') {
  1242. if (s[9] == 't') {
  1243. return T_CONST_CAST;
  1244. }
  1245. }
  1246. }
  1247. }
  1248. }
  1249. }
  1250. }
  1251. }
  1252. }
  1253. }
  1254. else if (features.qtEnabled && s[0] == 'Q') {
  1255. if (s[1] == '_') {
  1256. if (s[2] == 'O') {
  1257. if (s[3] == 'V') {
  1258. if (s[4] == 'E') {
  1259. if (s[5] == 'R') {
  1260. if (s[6] == 'R') {
  1261. if (s[7] == 'I') {
  1262. if (s[8] == 'D') {
  1263. if (s[9] == 'E') {
  1264. return T_Q_PROPERTY; // Q_OVERRIDE is just an alias for Q_PROPERTY
  1265. }
  1266. }
  1267. }
  1268. }
  1269. }
  1270. }
  1271. }
  1272. }
  1273. else if (s[2] == 'P') {
  1274. if (s[3] == 'R') {
  1275. if (s[4] == 'O') {
  1276. if (s[5] == 'P') {
  1277. if (s[6] == 'E') {
  1278. if (s[7] == 'R') {
  1279. if (s[8] == 'T') {
  1280. if (s[9] == 'Y') {
  1281. return T_Q_PROPERTY;
  1282. }
  1283. }
  1284. }
  1285. }
  1286. }
  1287. }
  1288. }
  1289. }
  1290. }
  1291. }
  1292. return T_IDENTIFIER;
  1293. }
  1294. static inline int classify11(const char *s, LanguageFeatures features)
  1295. {
  1296. if (s[0] == '_') {
  1297. if (s[1] == '_') {
  1298. if (s[2] == 'a') {
  1299. if (s[3] == 't') {
  1300. if (s[4] == 't') {
  1301. if (s[5] == 'r') {
  1302. if (s[6] == 'i') {
  1303. if (s[7] == 'b') {
  1304. if (s[8] == 'u') {
  1305. if (s[9] == 't') {
  1306. if (s[10] == 'e') {
  1307. return T___ATTRIBUTE;
  1308. }
  1309. }
  1310. }
  1311. }
  1312. }
  1313. }
  1314. }
  1315. }
  1316. }
  1317. }
  1318. }
  1319. else if (s[0] == 's') {
  1320. if (s[1] == 't') {
  1321. if (s[2] == 'a') {
  1322. if (s[3] == 't') {
  1323. if (s[4] == 'i') {
  1324. if (s[5] == 'c') {
  1325. if (s[6] == '_') {
  1326. if (s[7] == 'c') {
  1327. if (s[8] == 'a') {
  1328. if (s[9] == 's') {
  1329. if (s[10] == 't') {
  1330. return T_STATIC_CAST;
  1331. }
  1332. }
  1333. }
  1334. }
  1335. }
  1336. }
  1337. }
  1338. }
  1339. }
  1340. }
  1341. }
  1342. else if (features.qtEnabled && s[0] == 'Q') {
  1343. if (s[1] == '_') {
  1344. if (s[2] == 'I') {
  1345. if (s[3] == 'N') {
  1346. if (s[4] == 'V') {
  1347. if (s[5] == 'O') {
  1348. if (s[6] == 'K') {
  1349. if (s[7] == 'A') {
  1350. if (s[8] == 'B') {
  1351. if (s[9] == 'L') {
  1352. if (s[10] == 'E') {
  1353. return T_Q_INVOKABLE;
  1354. }
  1355. }
  1356. }
  1357. }
  1358. }
  1359. }
  1360. }
  1361. }
  1362. }
  1363. }
  1364. }
  1365. return T_IDENTIFIER;
  1366. }
  1367. static inline int classify12(const char *s, LanguageFeatures features)
  1368. {
  1369. if (s[0] == '_') {
  1370. if (s[1] == '_') {
  1371. if (s[2] == 'v') {
  1372. if (s[3] == 'o') {
  1373. if (s[4] == 'l') {
  1374. if (s[5] == 'a') {
  1375. if (s[6] == 't') {
  1376. if (s[7] == 'i') {
  1377. if (s[8] == 'l') {
  1378. if (s[9] == 'e') {
  1379. if (s[10] == '_') {
  1380. if (s[11] == '_') {
  1381. return T___VOLATILE__;
  1382. }
  1383. }
  1384. }
  1385. }
  1386. }
  1387. }
  1388. }
  1389. }
  1390. }
  1391. }
  1392. }
  1393. }
  1394. else if (features.qtEnabled && s[0] == 'Q') {
  1395. if (s[1] == '_') {
  1396. if (s[2] == 'I') {
  1397. if (s[3] == 'N') {
  1398. if (s[4] == 'T') {
  1399. if (s[5] == 'E') {
  1400. if (s[6] == 'R') {
  1401. if (s[7] == 'F') {
  1402. if (s[8] == 'A') {
  1403. if (s[9] == 'C') {
  1404. if (s[10] == 'E') {
  1405. if (s[11] == 'S') {
  1406. return T_Q_INTERFACES;
  1407. }
  1408. }
  1409. }
  1410. }
  1411. }
  1412. }
  1413. }
  1414. }
  1415. }
  1416. }
  1417. }
  1418. }
  1419. else if (s[0] == 'd') {
  1420. if (s[1] == 'y') {
  1421. if (s[2] == 'n') {
  1422. if (s[3] == 'a') {
  1423. if (s[4] == 'm') {
  1424. if (s[5] == 'i') {
  1425. if (s[6] == 'c') {
  1426. if (s[7] == '_') {
  1427. if (s[8] == 'c') {
  1428. if (s[9] == 'a') {
  1429. if (s[10] == 's') {
  1430. if (s[11] == 't') {
  1431. return T_DYNAMIC_CAST;
  1432. }
  1433. }
  1434. }
  1435. }
  1436. }
  1437. }
  1438. }
  1439. }
  1440. }
  1441. }
  1442. }
  1443. }
  1444. else if (features.cxx11Enabled && s[0] == 't') {
  1445. if (s[1] == 'h') {
  1446. if (s[2] == 'r') {
  1447. if (s[3] == 'e') {
  1448. if (s[4] == 'a') {
  1449. if (s[5] == 'd') {
  1450. if (s[6] == '_') {
  1451. if (s[7] == 'l') {
  1452. if (s[8] == 'o') {
  1453. if (s[9] == 'c') {
  1454. if (s[10] == 'a') {
  1455. if (s[11] == 'l') {
  1456. return T_THREAD_LOCAL;
  1457. }
  1458. }
  1459. }
  1460. }
  1461. }
  1462. }
  1463. }
  1464. }
  1465. }
  1466. }
  1467. }
  1468. }
  1469. return T_IDENTIFIER;
  1470. }
  1471. static inline int classify13(const char *s, LanguageFeatures features)
  1472. {
  1473. if (s[0] == '_') {
  1474. if (s[1] == '_') {
  1475. if (s[2] == 'a') {
  1476. if (s[3] == 't') {
  1477. if (s[4] == 't') {
  1478. if (s[5] == 'r') {
  1479. if (s[6] == 'i') {
  1480. if (s[7] == 'b') {
  1481. if (s[8] == 'u') {
  1482. if (s[9] == 't') {
  1483. if (s[10] == 'e') {
  1484. if (s[11] == '_') {
  1485. if (s[12] == '_') {
  1486. return T___ATTRIBUTE__;
  1487. }
  1488. }
  1489. }
  1490. }
  1491. }
  1492. }
  1493. }
  1494. }
  1495. }
  1496. }
  1497. }
  1498. }
  1499. } else if (features.cxx11Enabled && s[0] == 's') {
  1500. if (s[1] == 't') {
  1501. if (s[2] == 'a') {
  1502. if (s[3] == 't') {
  1503. if (s[4] == 'i') {
  1504. if (s[5] == 'c') {
  1505. if (s[6] == '_') {
  1506. if (s[7] == 'a') {
  1507. if (s[8] == 's') {
  1508. if (s[9] == 's') {
  1509. if (s[10] == 'e') {
  1510. if (s[11] == 'r') {
  1511. if (s[12] == 't') {
  1512. return T_STATIC_ASSERT;
  1513. }
  1514. }
  1515. }
  1516. }
  1517. }
  1518. }
  1519. }
  1520. }
  1521. }
  1522. }
  1523. }
  1524. }
  1525. }
  1526. return T_IDENTIFIER;
  1527. }
  1528. static inline int classify16(const char *s, LanguageFeatures)
  1529. {
  1530. if (s[0] == 'r') {
  1531. if (s[1] == 'e') {
  1532. if (s[2] == 'i') {
  1533. if (s[3] == 'n') {
  1534. if (s[4] == 't') {
  1535. if (s[5] == 'e') {
  1536. if (s[6] == 'r') {
  1537. if (s[7] == 'p') {
  1538. if (s[8] == 'r') {
  1539. if (s[9] == 'e') {
  1540. if (s[10] == 't') {
  1541. if (s[11] == '_') {
  1542. if (s[12] == 'c') {
  1543. if (s[13] == 'a') {
  1544. if (s[14] == 's') {
  1545. if (s[15] == 't') {
  1546. return T_REINTERPRET_CAST;
  1547. }
  1548. }
  1549. }
  1550. }
  1551. }
  1552. }
  1553. }
  1554. }
  1555. }
  1556. }
  1557. }
  1558. }
  1559. }
  1560. }
  1561. }
  1562. }
  1563. return T_IDENTIFIER;
  1564. }
  1565. static inline int classify14(const char *s, LanguageFeatures features)
  1566. {
  1567. if (features.qtEnabled && s[0] == 'Q') {
  1568. if (s[1] == '_') {
  1569. if (s[2] == 'P') {
  1570. if (s[3] == 'R') {
  1571. if (s[4] == 'I') {
  1572. if (s[5] == 'V') {
  1573. if (s[6] == 'A') {
  1574. if (s[7] == 'T') {
  1575. if (s[8] == 'E') {
  1576. if (s[9] == '_') {
  1577. if (s[10] == 'S') {
  1578. if (s[11] == 'L') {
  1579. if (s[12] == 'O') {
  1580. if (s[13] == 'T') {
  1581. return T_Q_PRIVATE_SLOT;
  1582. }
  1583. }
  1584. }
  1585. }
  1586. }
  1587. }
  1588. }
  1589. }
  1590. }
  1591. }
  1592. }
  1593. }
  1594. }
  1595. }
  1596. return T_IDENTIFIER;
  1597. }
  1598. static inline int classify18(const char *s, LanguageFeatures features)
  1599. {
  1600. if (features.qtEnabled && s[0] == 'Q') {
  1601. if (s[1] == '_') {
  1602. if (s[2] == 'P') {
  1603. if (s[3] == 'R') {
  1604. if (s[4] == 'I') {
  1605. if (s[5] == 'V') {
  1606. if (s[6] == 'A') {
  1607. if (s[7] == 'T') {
  1608. if (s[8] == 'E') {
  1609. if (s[9] == '_') {
  1610. if (s[10] == 'P') {
  1611. if (s[11] == 'R') {
  1612. if (s[12] == 'O') {
  1613. if (s[13] == 'P') {
  1614. if (s[14] == 'E') {
  1615. if (s[15] == 'R') {
  1616. if (s[16] == 'T') {
  1617. if (s[17] == 'Y') {
  1618. return T_Q_PRIVATE_PROPERTY;
  1619. }
  1620. }
  1621. }
  1622. }
  1623. }
  1624. }
  1625. }
  1626. }
  1627. }
  1628. }
  1629. }
  1630. }
  1631. }
  1632. }
  1633. }
  1634. }
  1635. }
  1636. }
  1637. return T_IDENTIFIER;
  1638. }
  1639. static inline int classify19(const char *s, LanguageFeatures features)
  1640. {
  1641. if (features.qtEnabled && s[0] == 'Q') {
  1642. if (s[1] == '_') {
  1643. if (s[2] == 'D') {
  1644. if (s[3] == 'E') {
  1645. if (s[4] == 'C') {
  1646. if (s[5] == 'L') {
  1647. if (s[6] == 'A') {
  1648. if (s[7] == 'R') {
  1649. if (s[8] == 'E') {
  1650. if (s[9] == '_') {
  1651. if (s[10] == 'I') {
  1652. if (s[11] == 'N') {
  1653. if (s[12] == 'T') {
  1654. if (s[13] == 'E') {
  1655. if (s[14] == 'R') {
  1656. if (s[15] == 'F') {
  1657. if (s[16] == 'A') {
  1658. if (s[17] == 'C') {
  1659. if (s[18] == 'E') {
  1660. return T_Q_DECLARE_INTERFACE;
  1661. }
  1662. }
  1663. }
  1664. }
  1665. }
  1666. }
  1667. }
  1668. }
  1669. }
  1670. }
  1671. }
  1672. }
  1673. }
  1674. }
  1675. }
  1676. }
  1677. }
  1678. }
  1679. }
  1680. return T_IDENTIFIER;
  1681. }
  1682. int Lexer::classify(const char *s, int n, LanguageFeatures features) {
  1683. switch (n) {
  1684. case 2: return classify2(s, features);
  1685. case 3: return classify3(s, features);
  1686. case 4: return classify4(s, features);
  1687. case 5: return classify5(s, features);
  1688. case 6: return classify6(s, features);
  1689. case 7: return classify7(s, features);
  1690. case 8: return classify8(s, features);
  1691. case 9: return classify9(s, features);
  1692. case 10: return classify10(s, features);
  1693. case 11: return classify11(s, features);
  1694. case 12: return classify12(s, features);
  1695. case 13: return classify13(s, features);
  1696. case 14: return classify14(s, features);
  1697. case 16: return classify16(s, features);
  1698. case 18: return classify18(s, features);
  1699. case 19: return classify19(s, features);
  1700. default: return T_IDENTIFIER;
  1701. } // switch
  1702. }
  1703. static inline int classifyOperator2(const char *s) {
  1704. if (s[0] == 'o') {
  1705. if (s[1] == 'r') {
  1706. return T_OR;
  1707. }
  1708. }
  1709. return T_IDENTIFIER;
  1710. }
  1711. static inline int classifyOperator3(const char *s) {
  1712. if (s[0] == 'a') {
  1713. if (s[1] == 'n') {
  1714. if (s[2] == 'd') {
  1715. return T_AND;
  1716. }
  1717. }
  1718. }
  1719. else if (s[0] == 'n') {
  1720. if (s[1] == 'o') {
  1721. if (s[2] == 't') {
  1722. return T_NOT;
  1723. }
  1724. }
  1725. }
  1726. else if (s[0] == 'x') {
  1727. if (s[1] == 'o') {
  1728. if (s[2] == 'r') {
  1729. return T_XOR;
  1730. }
  1731. }
  1732. }
  1733. return T_IDENTIFIER;
  1734. }
  1735. static inline int classifyOperator5(const char *s) {
  1736. if (s[0] == 'b') {
  1737. if (s[1] == 'i') {
  1738. if (s[2] == 't') {
  1739. if (s[3] == 'o') {
  1740. if (s[4] == 'r') {
  1741. return T_BITOR;
  1742. }
  1743. }
  1744. }
  1745. }
  1746. }
  1747. else if (s[0] == 'c') {
  1748. if (s[1] == 'o') {
  1749. if (s[2] == 'm') {
  1750. if (s[3] == 'p') {
  1751. if (s[4] == 'l') {
  1752. return T_COMPL;
  1753. }
  1754. }
  1755. }
  1756. }
  1757. }
  1758. else if (s[0] == 'o') {
  1759. if (s[1] == 'r') {
  1760. if (s[2] == '_') {
  1761. if (s[3] == 'e') {
  1762. if (s[4] == 'q') {
  1763. return T_OR_EQ;
  1764. }
  1765. }
  1766. }
  1767. }
  1768. }
  1769. return T_IDENTIFIER;
  1770. }
  1771. static inline int classifyOperator6(const char *s) {
  1772. if (s[0] == 'a') {
  1773. if (s[1] == 'n') {
  1774. if (s[2] == 'd') {
  1775. if (s[3] == '_') {
  1776. if (s[4] == 'e') {
  1777. if (s[5] == 'q') {
  1778. return T_AND_EQ;
  1779. }
  1780. }
  1781. }
  1782. }
  1783. }
  1784. }
  1785. else if (s[0] == 'b') {
  1786. if (s[1] == 'i') {
  1787. if (s[2] == 't') {
  1788. if (s[3] == 'a') {
  1789. if (s[4] == 'n') {
  1790. if (s[5] == 'd') {
  1791. return T_BITAND;
  1792. }
  1793. }
  1794. }
  1795. }
  1796. }
  1797. }
  1798. else if (s[0] == 'n') {
  1799. if (s[1] == 'o') {
  1800. if (s[2] == 't') {
  1801. if (s[3] == '_') {
  1802. if (s[4] == 'e') {
  1803. if (s[5] == 'q') {
  1804. return T_NOT_EQ;
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. }
  1811. else if (s[0] == 'x') {
  1812. if (s[1] == 'o') {
  1813. if (s[2] == 'r') {
  1814. if (s[3] == '_') {
  1815. if (s[4] == 'e') {
  1816. if (s[5] == 'q') {
  1817. return T_XOR_EQ;
  1818. }
  1819. }
  1820. }
  1821. }
  1822. }
  1823. }
  1824. return T_IDENTIFIER;
  1825. }
  1826. int Lexer::classifyOperator(const char *s, int n) {
  1827. switch (n) {
  1828. case 2: return classifyOperator2(s);
  1829. case 3: return classifyOperator3(s);
  1830. case 5: return classifyOperator5(s);
  1831. case 6: return classifyOperator6(s);
  1832. default: return T_IDENTIFIER;
  1833. } // switch
  1834. }
  1835. } // namespace CPlusPlus