From 4ea461c0085f658f680240d69caca800a5a9164e Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 24 Nov 2015 17:34:08 -0800 Subject: [PATCH] Avoid syntax error on alphabetic @box expressions. --- Cycript.l.in | 8 +++++++- Cycript.yy.in | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Cycript.l.in b/Cycript.l.in index 59ce0f8..081980e 100644 --- a/Cycript.l.in +++ b/Cycript.l.in @@ -304,6 +304,12 @@ XMLName {XMLNameStart}{XMLNamePart}* "@import" L C F(tk::AtImport, hi::Special); "@selector" L C F(tk::AtSelector, hi::Meta); +"@null" L C F(tk::AtNull, hi::Constant); +"@YES" L C F(tk::AtYes, hi::Constant); +"@NO" L C F(tk::AtNo, hi::Constant); +"@true" L C F(tk::AtTrue, hi::Constant); +"@false" L C F(tk::AtFalse, hi::Constant); + "NULL" L C I(identifier, Identifier("NULL"), tk::Identifier_, hi::Constant); "nil" L C I(identifier, Identifier("nil"), tk::Identifier_, hi::Constant); "YES" L C I(identifier, Identifier("YES"), tk::Yes, hi::Constant); @@ -465,7 +471,7 @@ XMLName {XMLNameStart}{XMLNamePart}* <> if (yyextra->auto_) { yyextra->auto_ = false; F(tk::AutoComplete, hi::Nothing); } L yyterminate(); -@{IdentifierPart}+|\xe2.|. L E("unknown token") +@{IdentifierStart}{IdentifierPart}*|\xe2.|. L E("unknown token") %% diff --git a/Cycript.yy.in b/Cycript.yy.in index 1e9d2ba..6f88b07 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -249,6 +249,11 @@ int cylex(YYSTYPE *, CYLocation *, void *); %token AtImport "@import" %token AtEnd "@end" %token AtSelector "@selector" +%token AtNull "@null" +%token AtYes "@YES" +%token AtNo "@NO" +%token AtTrue "@true" +%token AtFalse "@false" %token Yes "YES" %token No "NO" @end @@ -1641,6 +1646,11 @@ BoxableExpression PrimaryExpression : "@" BoxableExpression { $$ = CYNew CYBox($2); } + | "@YES" { $$ = CYNew CYBox(CYNew CYTrue()); } + | "@NO" { $$ = CYNew CYBox(CYNew CYFalse()); } + | "@true" { $$ = CYNew CYBox(CYNew CYTrue()); } + | "@false" { $$ = CYNew CYBox(CYNew CYFalse()); } + | "@null" { $$ = CYNew CYBox(CYNew CYNull()); } ; /* }}} */ /* Cycript (Objective-C): Block Expressions {{{ */ -- 2.45.2