X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/e53322782610fa076081d974ac22712107a2fe0e..1dbba6ccaecdd0572932cb02fe92a9154d2abe83:/Cycript.l diff --git a/Cycript.l b/Cycript.l index 10be43f..24e72d7 100644 --- a/Cycript.l +++ b/Cycript.l @@ -17,71 +17,88 @@ number [-]?{digit}*[.]?{digit}+ %% -"&" { return CYTokenAmpersand; } -"&&" { return CYTokenAmpersandAmpersand; } -"&=" { return CYTokenAmpersandEqual; } -"^" { return CYTokenCarrot; } -"^=" { return CYTokenCarrotEqual; } -"=" { return CYTokenEqual; } -"==" { return CYTokenEqualEqual; } -"===" { return CYTokenEqualEqualEqual; } -"!" { return CYTokenExclamation; } -"!=" { return CYTokenExclamationEqual; } -"!==" { return CYTokenExclamationEqualEqual; } -"-" { return CYTokenHyphen; } -"-=" { return CYTokenHyphenEqual; } -"--" { return CYTokenHyphenHyphen; } -"->" { return CYTokenHyphenRight; } -"<" { return CYTokenLeft; } -"<=" { return CYTokenLeftEqual; } -"<<" { return CYTokenLeftLeft; } -"<<=" { return CYTokenLeftLeftEqual; } -"%" { return CYTokenPercent; } -"%=" { return CYTokenPercentEqual; } -"." { return CYTokenPeriod; } -"|" { return CYTokenPipe; } -"|=" { return CYTokenPipeEqual; } -"||" { return CYTokenPipePipe; } -"+" { return CYTokenPlus; } -"+=" { return CYTokenPlusEqual; } -"++" { return CYTokenPlusPlus; } -">" { return CYTokenRight; } -">=" { return CYTokenRightEqual; } -">>" { return CYTokenRightRight; } -">>=" { return CYTokenRightRightEqual; } -">>>" { return CYTokenRightRightRight; } -">>>=" { return CYTokenRightRightRightEqual; } -"/" { return CYTokenSlash; } -"/=" { return CYTokenSlashEqual; } -"*" { return CYTokenStar; } -"*=" { return CYTokenStarEqual; } -"~" { return CYTokenTilde; } +"&" return CYTokenAmpersand; +"&&" return CYTokenAmpersandAmpersand; +"&=" return CYTokenAmpersandEqual; +"^" return CYTokenCarrot; +"^=" return CYTokenCarrotEqual; +"=" return CYTokenEqual; +"==" return CYTokenEqualEqual; +"===" return CYTokenEqualEqualEqual; +"!" return CYTokenExclamation; +"!=" return CYTokenExclamationEqual; +"!==" return CYTokenExclamationEqualEqual; +"-" return CYTokenHyphen; +"-=" return CYTokenHyphenEqual; +"--" return CYTokenHyphenHyphen; +"->" return CYTokenHyphenRight; +"<" return CYTokenLeft; +"<=" return CYTokenLeftEqual; +"<<" return CYTokenLeftLeft; +"<<=" return CYTokenLeftLeftEqual; +"%" return CYTokenPercent; +"%=" return CYTokenPercentEqual; +"." return CYTokenPeriod; +"|" return CYTokenPipe; +"|=" return CYTokenPipeEqual; +"||" return CYTokenPipePipe; +"+" return CYTokenPlus; +"+=" return CYTokenPlusEqual; +"++" return CYTokenPlusPlus; +">" return CYTokenRight; +">=" return CYTokenRightEqual; +">>" return CYTokenRightRight; +">>=" return CYTokenRightRightEqual; +">>>" return CYTokenRightRightRight; +">>>=" return CYTokenRightRightRightEqual; +"/" return CYTokenSlash; +"/=" return CYTokenSlashEqual; +"*" return CYTokenStar; +"*=" return CYTokenStarEqual; +"~" return CYTokenTilde; -"break" { return CYTokenBreak; } -"case" { return CYTokenCase; } -"catch" { return CYTokenCatch; } -"continue" { return CYTokenContinue; } -"default" { return CYTokenDefault; } -"delete" { return CYTokenDelete; } -"do" { return CYTokenDo; } -"else" { return CYTokenElse; } -"false" { return CYTokenFalse; } -"finally" { return CYTokenFinally; } -"for" { return CYTokenFor; } -"function" { return CYTokenFunction; } -"if" { return CYTokenIf; } -"in" { return CYTokenIn; } -"instanceof" { return CYTokenInstanceOf; } -"new" { return CYTokenNew; } -"null" { return CYTokenNull; } -"return" { return CYTokenReturn; } -"switch" { return CYTokenSwitch; } -"this" { return CYTokenThis; } -"throw" { return CYTokenThrow; } -"true" { return CYTokenTrue; } -"try" { return CYTokenTry; } -"typeof" { return CYTokenTypeOf; } -"var" { return CYTokenVar; } -"void" { return CYTokenVoid; } -"while" { return CYTokenWhile; } -"with" { return CYTokenWith; } +":" return CYTokenColon; +"," return CYTokenComma; +"?" return CYTokenQuestion; +";" return CYTokenSemiColon; + +"(" return CYTokenOpenParen; +")" return CYTokenCloseParen; +"{" return CYTokenOpenBrace; +"}" return CYTokenCloseBrace; +"[" return CYTokenOpenBracket; +"]" return CYTokenCloseBracket; + +"break" return CYTokenBreak; +"case" return CYTokenCase; +"catch" return CYTokenCatch; +"continue" return CYTokenContinue; +"default" return CYTokenDefault; +"delete" return CYTokenDelete; +"do" return CYTokenDo; +"else" return CYTokenElse; +"false" return CYTokenFalse; +"finally" return CYTokenFinally; +"for" return CYTokenFor; +"function" return CYTokenFunction; +"if" return CYTokenIf; +"in" return CYTokenIn; +"instanceof" return CYTokenInstanceOf; +"new" return CYTokenNew; +"null" return CYTokenNull; +"return" return CYTokenReturn; +"switch" return CYTokenSwitch; +"this" return CYTokenThis; +"throw" return CYTokenThrow; +"true" return CYTokenTrue; +"try" return CYTokenTry; +"typeof" return CYTokenTypeOf; +"var" return CYTokenVar; +"void" return CYTokenVoid; +"while" return CYTokenWhile; +"with" return CYTokenWith; + +[a-zA-Z$_][a-zA-Z$_0-9]* return CYTokenIdentifier; +[0-9]+ return CYTokenNumber; + +[ \t\n] ;