From ac9d4181bbfb217fda1fd531c3cd466b10a38564 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 11 Mar 2014 16:35:13 -0700 Subject: [PATCH] The nice thing about # is its similar density to @. --- Cycript.l.in | 1 + Cycript.yy.in | 3 ++- ObjectiveC/Library.mm | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cycript.l.in b/Cycript.l.in index 7eb9d11..cbe4fe5 100644 --- a/Cycript.l.in +++ b/Cycript.l.in @@ -196,6 +196,7 @@ XMLName {XMLNameStart}{XMLNamePart}* @begin E4X ObjectiveC "@" L C F(tk::At, hi::Operator); +"#" L C F(tk::Pound, hi::Operator); @end "&" L C F(tk::Ampersand, hi::Operator); diff --git a/Cycript.yy.in b/Cycript.yy.in index 2c8125e..3a31f1e 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -161,6 +161,7 @@ int cylex(YYSTYPE *, cy::location *, void *); @begin E4X ObjectiveC %token At "@" +%token Pound "#" @end %token Ampersand "&" @@ -1664,7 +1665,7 @@ PrimaryExpression /* }}} */ /* Cycript (Objective-C): Instance Literals {{{ */ PrimaryExpression - : "^" NumericLiteral { $$ = CYNew CYInstanceLiteral($2); } + : "#" NumericLiteral { $$ = CYNew CYInstanceLiteral($2); } ; /* }}} */ @end diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index b707a90..b7d23ef 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -1087,7 +1087,7 @@ NSObject *CYCopyNSObject(CYPool &pool, JSContextRef context, JSValueRef value) { } - (NSString *) cy$toCYON:(bool)objective { - return [@"^" stringByAppendingString:[[self description] cy$toCYON:true]]; + return [@"#" stringByAppendingString:[[self description] cy$toCYON:true]]; } - (bool) cy$hasProperty:(NSString *)name { -- 2.47.2