X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/3ea7eed0e5ab3447a2cc73016594971b507a2344..0881deb5306e45b62eb0b2d244bc5d6d73b8c0a4:/Cycript.l.in diff --git a/Cycript.l.in b/Cycript.l.in index e109ca9..d63784e 100644 --- a/Cycript.l.in +++ b/Cycript.l.in @@ -1,5 +1,5 @@ /* Cycript - Optimizing JavaScript Compiler/Runtime - * Copyright (C) 2009-2010 Jay Freeman (saurik) + * Copyright (C) 2009-2012 Jay Freeman (saurik) */ /* GNU Lesser General Public License, Version 3 {{{ */ @@ -30,7 +30,9 @@ typedef cy::parser::token tk; #define F(value) do { \ int token(value); \ - yyextra->statement_ = false; \ + yyextra->no_.AtImplementation = false; \ + yyextra->no_.Function = false; \ + yyextra->no_.OpenBrace = false; \ return token; \ } while (false) @@ -46,8 +48,6 @@ typedef cy::parser::token tk; #define C T yyextra->state_ = CYClear; #define R T yyextra->state_ = CYRestricted; -#define E L C I(literal, RegEx(Y), tk::RegularExpressionLiteral); - #define N \ if (yyextra->state_ != CYNewLine) { \ if (yyextra->state_ != CYRestricted) \ @@ -147,7 +147,7 @@ XMLName {XMLNameStart}{XMLNamePart}* %% -\/{RegularExpressionBody}\/{RegularExpressionFlags} E +\/{RegularExpressionBody}\/{RegularExpressionFlags} L C I(literal, RegEx(Y), tk::RegularExpressionLiteral); \/\/[^\n]* L @@ -197,6 +197,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "=" L C F(tk::Equal); "==" L C F(tk::EqualEqual); "===" L C F(tk::EqualEqualEqual); +"=>" L C F(tk::EqualRight); "!" L C F(tk::Exclamation); "!=" L C F(tk::ExclamationEqual); "!==" L C F(tk::ExclamationEqualEqual); @@ -238,7 +239,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "(" L C F(tk::OpenParen); ")" L C F(tk::CloseParen); -"{" L C F(yyextra->statement_ ? tk::OpenBrace__ : yylval->newline_ ? tk::OpenBrace_ : tk::OpenBrace); +"{" L C F(yyextra->no_.OpenBrace ? tk::OpenBrace__ : yylval->newline_ ? tk::OpenBrace_ : tk::OpenBrace); "}" L C F(tk::CloseBrace); "[" L C F(tk::OpenBracket); @@ -250,7 +251,7 @@ XMLName {XMLNameStart}{XMLNamePart}* @begin ObjectiveC "@end" L C F(tk::AtEnd); -"@implementation" L C F(yyextra->statement_ ? tk::AtImplementation_ : tk::AtImplementation); +"@implementation" L C F(yyextra->no_.AtImplementation ? tk::AtImplementation_ : tk::AtImplementation); "@import" L C F(tk::AtImport); "@selector" L C F(tk::AtSelector); @end @@ -259,6 +260,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "null" L C I(null, Null(), tk::Null); "true" L C I(true, True(), tk::True); +"auto" L C I(word, Word("auto"), tk::Auto); "break" L R I(word, Word("break"), tk::Break); "case" L C I(word, Word("case"), tk::Case); "catch" L C I(word, Word("catch"), tk::Catch); @@ -269,7 +271,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "else" L C I(word, Word("else"), tk::Else); "finally" L C I(word, Word("finally"), tk::Finally); "for" L C I(word, Word("for"), tk::For); -"function" L C I(word, Word("function"), yyextra->statement_ ? tk::Function_ : tk::Function); +"function" L C I(word, Word("function"), yyextra->no_.Function ? tk::Function_ : tk::Function); "if" L C I(word, Word("if"), tk::If); "in" L C I(word, Word("in"), yyextra->in_.top() ? tk::In_ : tk::In); "instanceof" L C I(word, Word("instanceof"), tk::InstanceOf); @@ -325,6 +327,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "yield" L C I(identifier, Identifier("yield"), tk::Yield); "each" L C I(identifier, Identifier("each"), tk::Each); +"of" L C I(identifier, Identifier("of"), tk::Of); @begin E4X "namespace" L C I(identifier, Identifier("namespace"), tk::Namespace);