]> git.saurik.com Git - cycript.git/commitdiff
Avoid syntax error on alphabetic @box expressions.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 25 Nov 2015 01:34:08 +0000 (17:34 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 25 Nov 2015 01:34:08 +0000 (17:34 -0800)
Cycript.l.in
Cycript.yy.in

index 59ce0f8b11b8060888d52915ccc54f5b4ec9b546..081980e176e089da8ad2e3ad0c3f3195f94e3603 100644 (file)
@@ -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}*
 
 <<EOF>> 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")
 
 %%
 
index 1e9d2bad9e43efe74d8e5898a7c65e75dd1a56fb..6f88b07ef94b7febb62a42027803656428154142 100644 (file)
@@ -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 <identifier_> Yes "YES"
 %token <identifier_> 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 {{{ */