From: Jay Freeman (saurik) Date: Fri, 10 Jan 2014 05:38:36 +0000 (-0800) Subject: Support @YES/@NO (to better support @true/@false). X-Git-Tag: v0.9.500~88 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/60496dd58d9132df7fe3f6cef8e372a786becc13?ds=inline Support @YES/@NO (to better support @true/@false). --- diff --git a/Cycript.l.in b/Cycript.l.in index 5915fc9..61a0c09 100644 --- a/Cycript.l.in +++ b/Cycript.l.in @@ -270,8 +270,8 @@ XMLName {XMLNameStart}{XMLNamePart}* "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::Identifier_, hi::Constant); -"NO" L C I(identifier, Identifier("NO"), tk::Identifier_, hi::Constant); +"YES" L C I(identifier, Identifier("YES"), tk::Yes, hi::Constant); +"NO" L C I(identifier, Identifier("NO"), tk::No, hi::Constant); "bool" L C I(identifier, Identifier("bool"), tk::Identifier_, hi::Type); "BOOL" L C I(identifier, Identifier("BOOL"), tk::Identifier_, hi::Type); diff --git a/Cycript.yy.in b/Cycript.yy.in index c4af372..94d804b 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -241,6 +241,8 @@ int cylex(YYSTYPE *, cy::location *, void *); %token AtEncode "@encode" %token AtEnd "@end" %token AtSelector "@selector" +%token Yes "YES" +%token No "NO" @end %token False "false" @@ -657,6 +659,8 @@ Identifier @begin C | "typedef" { $$ = $1; } + | "YES" { $$ = $1; } + | "NO" { $$ = $1; } @end | "implements" { $$ = $1; } @@ -1609,6 +1613,8 @@ BoxableExpression | ArrayLiteral { $$ = $1; } | ObjectLiteral { $$ = $1; } | Parenthetical { $$ = $1; } + | "YES" { $$ = CYNew CYTrue(); } + | "NO" { $$ = CYNew CYFalse(); } ; PrimaryExpression