1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- { *********************************************************************
- This file is part of the Free Component Library (FCL)
- Copyright (c) 2016 Michael Van Canneyt.
-
- Javascript token definitions
-
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
- unit jstoken;
- {$mode objfpc}{$H+}
- interface
- type
- TJSToken = (tjsUnknown,
- // Specials
- tjsEOF,tjsWhiteSpace,tjsChar,tjsString{this bites TJSString}, tjsIdentifier,tjsNumber, tjsComment,tjsREGEX, tjsRESERVED,
- tjsANDAND, tjsANDEQ,
- tjsBraceOpen,tjsBraceClose,tjsSQuaredBraceOpen,tjsSQuaredBraceClose,tjsCurlyBraceOpen,tjsCurlyBraceClose,
- tjsCOMMA,tjsCOLON, tjsDOT,tjsSEMICOLON, tjsASSIGN,tjsGT,tjsLT, tjsConditional,
- tjsPLUS,tjsMINUS,tjsMUL,tjsDIV,tjsAnd,tjsOR, tjsInv, tjsMod, tjsXOR, tjsNot,
- tjsEQ,
- tjsGE,
- tjsLE, tjsLSHIFT, tjsLSHIFTEQ,
- tjsMINUSEQ, tjsMINUSMINUS, tjsMODEQ,tjsDIVEQ,tjsXOREq,
- tjsNE,
- tjsOREQ, tjsOROR,
- tjsPLUSEQ, tjsPLUSPLUS,
- tjsURSHIFT, tjsURSHIFTEQ,
- tjsRSHIFT, tjsRSHIFTEQ,
- tjsSEQ, tjsSNE, tjsMULEQ, tjsArrow, tjsEllipsis,
- { Reserved words start here. They must be last }
- tjsAWAIT, tjsBREAK, tjsCASE, tjsCATCH, tjsCLASS, tjsCONST, tjsCONTINUE,
- tjsDEBUGGER, tjsDEFAULT, tjsDELETE, tjsDO,
- tjsELSE, tjsENUM, tjsEXPORT, tjsEXTENDS,
- tjsFALSE, tjsFINALLY, tjsFOR, tjsFUNCTION,
- tjsIF, tjsIMPORT, tjsIN, tjsINSTANCEOF,
- tjsLet,
- tjsNEW, tjsNULL,
- tjsRETURN,
- tjsSUPER, tjsSWITCH,
- tjsTHIS, tjsTHROW, tjsTrue, tjsTRY, tjsTYPEOF,
- tjsVAR, tjsVOID,
- tjsWHILE, tjsWITH,
- tjsYield
- );
- TJSTokens = Set of TJSToken;
- const
- FirstKeyword = tjsAwait;
- LastKeyWord = tJSYield;
- TokenInfos: array[TJSToken] of String = ('unknown',
- // Specials
- 'EOF','whitespace','Char','String', 'identifier','number','comment','regular expression', 'reserved word',
- '&&','&=',
- '(',')','[',']','{','}',
- ',',':','.',';','=','>','<','?',
- '+','-','*','/','&','|','~','%','^','!',
- '==',
- '>=',
- '<=', '<<', '<<=',
- '-=', '--', '%=', '/=','^=',
- '!=',
- '|=', '||',
- '+=', '++',
- '>>>', '>>>=',
- '>>', '>>=',
- '===', '!==', '*=', '=>', '...',
- // Identifiers last
- 'await', 'break','case','catch', 'class','const','continue',
- 'debugger','default','delete', 'do',
- 'else','enum','export','extends',
- 'false','finally', 'for', 'function',
- 'if', 'import', 'in', 'instanceof',
- 'let',
- 'new','null',
- 'return',
- 'super', 'switch',
- 'this', 'throw', 'true', 'try', 'typeof',
- 'var', 'void',
- 'while', 'with',
- 'yield'
- );
- implementation
- end.
|