mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 15:09:09 +02:00
* Tokens separated out of parser, needed in writer.
git-svn-id: trunk@27034 -
This commit is contained in:
parent
cedcd354b3
commit
0de9c58092
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2360,6 +2360,7 @@ packages/fcl-js/fpmake.pp svneol=native#text/plain
|
|||||||
packages/fcl-js/src/jsbase.pp svneol=native#text/plain
|
packages/fcl-js/src/jsbase.pp svneol=native#text/plain
|
||||||
packages/fcl-js/src/jsparser.pp svneol=native#text/plain
|
packages/fcl-js/src/jsparser.pp svneol=native#text/plain
|
||||||
packages/fcl-js/src/jsscanner.pp svneol=native#text/plain
|
packages/fcl-js/src/jsscanner.pp svneol=native#text/plain
|
||||||
|
packages/fcl-js/src/jstoken.pp svneol=native#text/plain
|
||||||
packages/fcl-js/src/jstree.pp svneol=native#text/plain
|
packages/fcl-js/src/jstree.pp svneol=native#text/plain
|
||||||
packages/fcl-js/tests/tcparser.pp svneol=native#text/plain
|
packages/fcl-js/tests/tcparser.pp svneol=native#text/plain
|
||||||
packages/fcl-js/tests/tcscanner.pp svneol=native#text/plain
|
packages/fcl-js/tests/tcscanner.pp svneol=native#text/plain
|
||||||
|
79
packages/fcl-js/src/jstoken.pp
Normal file
79
packages/fcl-js/src/jstoken.pp
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
unit jstoken;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
TJSToken = (tjsUnknown,
|
||||||
|
// Specials
|
||||||
|
tjsEOF,tjsWhiteSpace,tjsChar,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,
|
||||||
|
{ Reserved words start here. They must be last }
|
||||||
|
tjsBREAK,tjsCASE, tjsCATCH, tjsCONTINUE,
|
||||||
|
tjsDEFAULT, tjsDELETE, tjsDO,
|
||||||
|
tjsELSE,
|
||||||
|
tjsFalse, tjsFINALLY, tjsFOR, tjsFUNCTION,
|
||||||
|
tjsIF, tjsIN, tjsINSTANCEOF,
|
||||||
|
tjsNEW,tjsNULL,
|
||||||
|
tjsRETURN,
|
||||||
|
tjsSWITCH,
|
||||||
|
tjsTHIS, tjsTHROW, tjsTrue, tjsTRY, tjsTYPEOF,
|
||||||
|
tjsVAR, tjsVOID,
|
||||||
|
tjsWHILE, tjsWITH
|
||||||
|
);
|
||||||
|
|
||||||
|
const
|
||||||
|
FirstKeyword = tjsBreak;
|
||||||
|
LastKeyWord = tJSWith;
|
||||||
|
|
||||||
|
TokenInfos: array[TJSToken] of string = ('unknown',
|
||||||
|
// Specials
|
||||||
|
'EOF','whitespace','Char','String', 'identifier','number','comment','regular expression', 'reserved word',
|
||||||
|
'&&','&=',
|
||||||
|
'(',')','[',']','{','}',
|
||||||
|
',',':','.',';','=','>','<','?',
|
||||||
|
'+','-','*','/','&','|','~','%','^','!',
|
||||||
|
'==',
|
||||||
|
'>=',
|
||||||
|
'<=', '<<', '<<=',
|
||||||
|
'-=', '--', '%=', '/=','^=',
|
||||||
|
'!=',
|
||||||
|
'|=', '||',
|
||||||
|
'+=', '++',
|
||||||
|
'>>>', '>>>=',
|
||||||
|
'>>', '>>=',
|
||||||
|
'===', '!==', '*=',
|
||||||
|
// Identifiers last
|
||||||
|
'break','case','catch', 'continue',
|
||||||
|
'default','delete', 'do',
|
||||||
|
'else',
|
||||||
|
'false','finally', 'for', 'function',
|
||||||
|
'if', 'in', 'instanceof',
|
||||||
|
'new','null',
|
||||||
|
'return',
|
||||||
|
'switch',
|
||||||
|
'this', 'throw', 'true', 'try', 'typeof',
|
||||||
|
'var', 'void',
|
||||||
|
'while', 'with'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user