F _UIImageWithName @@
+F UIFormattedPhoneNumberFromString @@
F UIUnformattedPhoneNumberFromString @@
V UIApp @
%%
-"&" { return CYTokenAmpersand; }
-"&&" { return CYTokenAmpersandAmpersand; }
-"&=" { return CYTokenAmpersandEqual; }
-"^" { return CYTokenCarrot; }
-"^=" { return CYTokenCarrotEqual; }
-"=" { return CYTokenEqual; }
-"==" { return CYTokenEqualEqual; }
-"===" { return CYTokenEqualEqualEqual; }
-"!" { return CYTokenExclamation; }
-"!=" { return CYTokenExclamationEqual; }
-"!==" { return CYTokenExclamationEqualEqual; }
-"-" { return CYTokenHyphen; }
-"-=" { return CYTokenHyphenEqual; }
-"--" { return CYTokenHyphenHyphen; }
-"->" { return CYTokenHyphenRight; }
-"<" { return CYTokenLeft; }
-"<=" { return CYTokenLeftEqual; }
-"<<" { return CYTokenLeftLeft; }
-"<<=" { return CYTokenLeftLeftEqual; }
-"%" { return CYTokenPercent; }
-"%=" { return CYTokenPercentEqual; }
-"." { return CYTokenPeriod; }
-"|" { return CYTokenPipe; }
-"|=" { return CYTokenPipeEqual; }
-"||" { return CYTokenPipePipe; }
-"+" { return CYTokenPlus; }
-"+=" { return CYTokenPlusEqual; }
-"++" { return CYTokenPlusPlus; }
-">" { return CYTokenRight; }
-">=" { return CYTokenRightEqual; }
-">>" { return CYTokenRightRight; }
-">>=" { return CYTokenRightRightEqual; }
-">>>" { return CYTokenRightRightRight; }
-">>>=" { return CYTokenRightRightRightEqual; }
-"/" { return CYTokenSlash; }
-"/=" { return CYTokenSlashEqual; }
-"*" { return CYTokenStar; }
-"*=" { return CYTokenStarEqual; }
-"~" { return CYTokenTilde; }
+"&" return CYTokenAmpersand;
+"&&" return CYTokenAmpersandAmpersand;
+"&=" return CYTokenAmpersandEqual;
+"^" return CYTokenCarrot;
+"^=" return CYTokenCarrotEqual;
+"=" return CYTokenEqual;
+"==" return CYTokenEqualEqual;
+"===" return CYTokenEqualEqualEqual;
+"!" return CYTokenExclamation;
+"!=" return CYTokenExclamationEqual;
+"!==" return CYTokenExclamationEqualEqual;
+"-" return CYTokenHyphen;
+"-=" return CYTokenHyphenEqual;
+"--" return CYTokenHyphenHyphen;
+"->" return CYTokenHyphenRight;
+"<" return CYTokenLeft;
+"<=" return CYTokenLeftEqual;
+"<<" return CYTokenLeftLeft;
+"<<=" return CYTokenLeftLeftEqual;
+"%" return CYTokenPercent;
+"%=" return CYTokenPercentEqual;
+"." return CYTokenPeriod;
+"|" return CYTokenPipe;
+"|=" return CYTokenPipeEqual;
+"||" return CYTokenPipePipe;
+"+" return CYTokenPlus;
+"+=" return CYTokenPlusEqual;
+"++" return CYTokenPlusPlus;
+">" return CYTokenRight;
+">=" return CYTokenRightEqual;
+">>" return CYTokenRightRight;
+">>=" return CYTokenRightRightEqual;
+">>>" return CYTokenRightRightRight;
+">>>=" return CYTokenRightRightRightEqual;
+"/" return CYTokenSlash;
+"/=" return CYTokenSlashEqual;
+"*" return CYTokenStar;
+"*=" return CYTokenStarEqual;
+"~" return CYTokenTilde;
-"break" { return CYTokenBreak; }
-"case" { return CYTokenCase; }
-"catch" { return CYTokenCatch; }
-"continue" { return CYTokenContinue; }
-"default" { return CYTokenDefault; }
-"delete" { return CYTokenDelete; }
-"do" { return CYTokenDo; }
-"else" { return CYTokenElse; }
-"false" { return CYTokenFalse; }
-"finally" { return CYTokenFinally; }
-"for" { return CYTokenFor; }
-"function" { return CYTokenFunction; }
-"if" { return CYTokenIf; }
-"in" { return CYTokenIn; }
-"instanceof" { return CYTokenInstanceOf; }
-"new" { return CYTokenNew; }
-"null" { return CYTokenNull; }
-"return" { return CYTokenReturn; }
-"switch" { return CYTokenSwitch; }
-"this" { return CYTokenThis; }
-"throw" { return CYTokenThrow; }
-"true" { return CYTokenTrue; }
-"try" { return CYTokenTry; }
-"typeof" { return CYTokenTypeOf; }
-"var" { return CYTokenVar; }
-"void" { return CYTokenVoid; }
-"while" { return CYTokenWhile; }
-"with" { return CYTokenWith; }
+":" return CYTokenColon;
+"," return CYTokenComma;
+"?" return CYTokenQuestion;
+";" return CYTokenSemiColon;
+
+"(" return CYTokenOpenParen;
+")" return CYTokenCloseParen;
+"{" return CYTokenOpenBrace;
+"}" return CYTokenCloseBrace;
+"[" return CYTokenOpenBracket;
+"]" return CYTokenCloseBracket;
+
+"break" return CYTokenBreak;
+"case" return CYTokenCase;
+"catch" return CYTokenCatch;
+"continue" return CYTokenContinue;
+"default" return CYTokenDefault;
+"delete" return CYTokenDelete;
+"do" return CYTokenDo;
+"else" return CYTokenElse;
+"false" return CYTokenFalse;
+"finally" return CYTokenFinally;
+"for" return CYTokenFor;
+"function" return CYTokenFunction;
+"if" return CYTokenIf;
+"in" return CYTokenIn;
+"instanceof" return CYTokenInstanceOf;
+"new" return CYTokenNew;
+"null" return CYTokenNull;
+"return" return CYTokenReturn;
+"switch" return CYTokenSwitch;
+"this" return CYTokenThis;
+"throw" return CYTokenThrow;
+"true" return CYTokenTrue;
+"try" return CYTokenTry;
+"typeof" return CYTokenTypeOf;
+"var" return CYTokenVar;
+"void" return CYTokenVoid;
+"while" return CYTokenWhile;
+"with" return CYTokenWith;
+
+[a-zA-Z$_][a-zA-Z$_0-9]* return CYTokenIdentifier;
+[0-9]+ return CYTokenNumber;
+
+[ \t\n] ;
-%{
+%code top {
#include "Parser.hpp"
#include "Cycript.tab.h"
void cyerror(YYLTYPE *locp, CYParser *context, const char *msg);
int cylex(YYSTYPE *lvalp, YYLTYPE *llocp);
-%}
+}
+
+%name-prefix "cy"
-%pure-parser
-%name-prefix="cy"
%locations
+%define api.pure
+%glr-parser
+
%defines
+
+%debug
%error-verbose
%parse-param { CYParser *context }
%token CYTokenStarEqual "*="
%token CYTokenTilde "~"
+%token CYTokenColon ":"
+%token CYTokenComma ","
+%token CYTokenQuestion "?"
+%token CYTokenSemiColon ";"
+
+%token CYTokenOpenParen "("
+%token CYTokenCloseParen ")"
+%token CYTokenOpenBrace "{"
+%token CYTokenCloseBrace "}"
+%token CYTokenOpenBracket "["
+%token CYTokenCloseBracket "]"
+
%token CYTokenBreak "break"
%token CYTokenCase "case"
%token CYTokenCatch "catch"
%token CYTokenWhile "while"
%token CYTokenWith "with"
+%token CYTokenIdentifier
+%token CYTokenNumber
+%token CYTokenString
+
%%
-hello: ;
+Start
+ : Program
+ ;
+
+IdentifierOpt
+ : Identifier
+ |
+ ;
+
+Identifier
+ : CYTokenIdentifier
+ ;
+
+Literal
+ : NullLiteral
+ | BooleanLiteral
+ | NumericLiteral
+ | StringLiteral
+ ;
+
+NullLiteral
+ : "null"
+ ;
+
+BooleanLiteral
+ : "true"
+ | "false"
+ ;
+
+NumericLiteral
+ : CYTokenNumber
+ ;
+
+StringLiteral
+ : CYTokenString
+ ;
+
+/* Objective-C Extensions {{{ */
+VariadicCall
+ : "," AssignmentExpression VariadicCall
+ |
+ ;
+
+SelectorCall_
+ : SelectorCall
+ | VariadicCall
+ ;
+
+SelectorCall
+ : IdentifierOpt ":" AssignmentExpression SelectorCall_
+ ;
+
+SelectorList
+ : SelectorCall
+ | Identifier
+ ;
+
+ObjectiveCall
+ : "[" AssignmentExpression SelectorList "]"
+ ;
+/* }}} */
+
+/* 11.1 Primary Expressions {{{ */
+PrimaryExpression
+ : "this"
+ | Identifier
+ | Literal
+ | ArrayLiteral
+ | ObjectLiteral
+ | "(" Expression ")"
+ | ObjectiveCall
+ ;
+/* }}} */
+/* 11.1.4 Array Initialiser {{{ */
+ArrayLiteral
+ : "[" ElementList "]"
+ ;
+
+Element
+ : AssignmentExpression
+ |
+ ;
+
+ElementList_
+ : "," ElementList
+ |
+ ;
+
+ElementList
+ : Element ElementList_
+ ;
+/* }}} */
+/* 11.1.5 Object Initialiser {{{ */
+ObjectLiteral
+ : "{" PropertyNameAndValueListOpt "}"
+ ;
+
+PropertyNameAndValueList_
+ : "," PropertyNameAndValueList
+ |
+ ;
+
+PropertyNameAndValueListOpt
+ : PropertyNameAndValueList
+ |
+ ;
+
+PropertyNameAndValueList
+ : PropertyName ":" AssignmentExpression PropertyNameAndValueList_
+ ;
+
+PropertyName
+ : Identifier
+ | StringLiteral
+ | NumericLiteral
+ ;
+/* }}} */
+
+MemberExpression
+ : PrimaryExpression
+ | FunctionExpression
+ | MemberExpression "[" Expression "]"
+ | MemberExpression "." Identifier
+ | "new" MemberExpression Arguments
+ ;
+
+NewExpression
+ : MemberExpression
+ | "new" NewExpression
+ ;
+
+CallExpression
+ : MemberExpression Arguments
+ | CallExpression Arguments
+ | CallExpression "[" Expression "]"
+ | CallExpression "." Identifier
+ ;
+
+ArgumentList_
+ : "," ArgumentList
+ |
+ ;
+
+ArgumentListOpt
+ : ArgumentList
+ |
+ ;
+
+ArgumentList
+ : AssignmentExpression ArgumentList_
+ ;
+
+Arguments
+ : "(" ArgumentListOpt ")"
+ ;
+
+LeftHandSideExpression
+ : NewExpression
+ | CallExpression
+ ;
+
+PostfixExpression
+ : LeftHandSideExpression
+ | LeftHandSideExpression "++"
+ | LeftHandSideExpression "--"
+ ;
+
+UnaryExpression
+ : PostfixExpression
+ | "delete" UnaryExpression
+ | "void" UnaryExpression
+ | "typeof" UnaryExpression
+ | "++" UnaryExpression
+ | "--" UnaryExpression
+ | "+" UnaryExpression
+ | "-" UnaryExpression
+ | "~" UnaryExpression
+ | "!" UnaryExpression
+ | "*" UnaryExpression
+ | "&" UnaryExpression
+ ;
+
+MultiplicativeExpression
+ : UnaryExpression
+ | MultiplicativeExpression "*" UnaryExpression
+ | MultiplicativeExpression "/" UnaryExpression
+ | MultiplicativeExpression "%" UnaryExpression
+ ;
+
+AdditiveExpression
+ : MultiplicativeExpression
+ | AdditiveExpression "+" MultiplicativeExpression
+ | AdditiveExpression "-" MultiplicativeExpression
+ ;
+
+ShiftExpression
+ : AdditiveExpression
+ | ShiftExpression "<<" AdditiveExpression
+ | ShiftExpression ">>" AdditiveExpression
+ | ShiftExpression ">>>" AdditiveExpression
+ ;
+
+RelationalExpression
+ : ShiftExpression
+ | RelationalExpression "<" ShiftExpression
+ | RelationalExpression ">" ShiftExpression
+ | RelationalExpression "<=" ShiftExpression
+ | RelationalExpression ">=" ShiftExpression
+ | RelationalExpression "instanceof" ShiftExpression
+ | RelationalExpression "in" ShiftExpression
+ ;
+
+EqualityExpression
+ : RelationalExpression
+ | EqualityExpression "==" RelationalExpression
+ | EqualityExpression "!=" RelationalExpression
+ | EqualityExpression "===" RelationalExpression
+ | EqualityExpression "!==" RelationalExpression
+ ;
+
+BitwiseANDExpression
+ : EqualityExpression
+ | BitwiseANDExpression "&" EqualityExpression
+ ;
+
+BitwiseXORExpression
+ : BitwiseANDExpression
+ | BitwiseXORExpression "^" BitwiseANDExpression
+ ;
+
+BitwiseORExpression
+ : BitwiseXORExpression
+ | BitwiseORExpression "|" BitwiseXORExpression
+ ;
+
+LogicalANDExpression
+ : BitwiseORExpression
+ | LogicalANDExpression "&&" BitwiseORExpression
+ ;
+
+LogicalORExpression
+ : LogicalANDExpression
+ | LogicalORExpression "||" LogicalANDExpression
+ ;
+
+ConditionalExpression
+ : LogicalORExpression
+ | LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression
+ ;
+
+AssignmentExpression
+ : ConditionalExpression
+ | LeftHandSideExpression AssignmentOperator AssignmentExpression
+ ;
+
+AssignmentOperator
+ : "="
+ | "*="
+ | "/="
+ | "%="
+ | "+="
+ | "-="
+ | "<<="
+ | ">>="
+ | ">>>="
+ | "&="
+ | "^="
+ | "|="
+ ;
+
+Expression_
+ : "," Expression
+ |
+ ;
+
+ExpressionOpt
+ : Expression
+ |
+ ;
+
+Expression
+ : AssignmentExpression Expression_
+ ;
+
+Statement
+ : Block
+ | VariableStatement
+ | EmptyStatement
+ | ExpressionStatement
+ | IfStatement
+ | IterationStatement
+ | ContinueStatement
+ | BreakStatement
+ | ReturnStatement
+ | WithStatement
+ | LabelledStatement
+ | SwitchStatement
+ | ThrowStatement
+ | TryStatement
+ ;
+
+Block
+ : "{" StatementListOpt "}"
+ ;
+
+StatementListOpt
+ : Statement StatementListOpt
+ |
+ ;
+
+VariableStatement
+ : "var" VariableDeclarationList ";"
+ ;
+
+VariableDeclarationList_
+ : "," VariableDeclarationList
+ |
+ ;
+
+VariableDeclarationList
+ : VariableDeclaration VariableDeclarationList_
+ ;
+
+VariableDeclaration
+ : Identifier InitialiserOpt
+ ;
+
+InitialiserOpt
+ : Initialiser
+ |
+ ;
+
+Initialiser
+ : "=" AssignmentExpression
+ ;
+
+EmptyStatement
+ : ";"
+ ;
+
+ExpressionStatement
+ : Expression ";"
+ ;
+
+ElseStatementOpt
+ : "else" Statement
+ |
+ ;
+
+IfStatement
+ : "if" "(" Expression ")" Statement ElseStatementOpt
+ ;
+
+IterationStatement
+ : DoWhileStatement
+ | WhileStatement
+ | ForStatement
+ | ForInStatement
+ ;
+
+DoWhileStatement
+ : "do" Statement "while" "(" Expression ")" ";"
+ ;
+
+WhileStatement
+ : "while" "(" Expression ")" Statement
+ ;
+
+ForStatement
+ : "for" "(" ForStatementInitialiser ";" ExpressionOpt ";" ExpressionOpt ")" Statement
+ ;
+
+ForStatementInitialiser
+ : ExpressionOpt
+ | "var" VariableDeclarationList
+ ;
+
+ForInStatement
+ : "for" "(" ForInStatementInitialiser "in" Expression ")" Statement
+ ;
+
+ForInStatementInitialiser
+ : LeftHandSideExpression
+ | "var" VariableDeclaration
+ ;
+
+ContinueStatement
+ : "continue" IdentifierOpt ";"
+ ;
+
+BreakStatement
+ : "break" IdentifierOpt ";"
+ ;
+
+ReturnStatement
+ : "return" ExpressionOpt ";"
+ ;
+
+WithStatement
+ : "with" "(" Expression ")" Statement
+ ;
+
+SwitchStatement
+ : "switch" "(" Expression ")" CaseBlock
+ ;
+
+CaseBlock
+ : "{" CaseClausesOpt "}"
+ ;
+
+CaseClausesOpt
+ : CaseClause CaseClausesOpt
+ | DefaultClause CaseClausesOpt
+ |
+ ;
+
+CaseClause
+ : "case" Expression ":" StatementListOpt
+ ;
+
+DefaultClause
+ : "default" ":" StatementListOpt
+ ;
+
+LabelledStatement
+ : Identifier ":" Statement
+ ;
+
+ThrowStatement
+ : "throw" Expression ";"
+ ;
+
+TryStatement
+ : "try" Block CatchOpt FinallyOpt
+ ;
+
+CatchOpt
+ : "catch" "(" Identifier ")" Block
+ |
+ ;
+
+FinallyOpt
+ : "finally" Block
+ |
+ ;
+
+FunctionDeclaration
+ : "function" Identifier "(" FormalParameterList ")" "{" FunctionBody "}"
+ ;
+
+FunctionExpression
+ : "function" IdentifierOpt "(" FormalParameterList ")" "{" FunctionBody "}"
+ ;
+
+FormalParameterList_
+ : "," FormalParameterList
+ |
+ ;
+
+FormalParameterList
+ : Identifier FormalParameterList_
+ |
+ ;
+
+FunctionBody
+ : SourceElements
+ ;
+
+Program
+ : SourceElements
+ ;
+
+SourceElements
+ : SourceElement SourceElements
+ |
+ ;
+
+SourceElement
+ : Statement
+ | FunctionDeclaration
+ ;
%%
CFLog(kCFLogLevelNotice, CFSTR("_trace():%u"), __LINE__); \
} while (false)
-/* Objective-C Handle<> {{{ */
-template <typename Type_>
-class _H {
- typedef _H<Type_> This_;
-
- private:
- Type_ *value_;
-
- _finline void Retain_() {
- if (value_ != nil)
- [value_ retain];
- }
-
- _finline void Clear_() {
- if (value_ != nil)
- [value_ release];
- }
-
- public:
- _finline _H(const This_ &rhs) :
- value_(rhs.value_ == nil ? nil : [rhs.value_ retain])
- {
- }
-
- _finline _H(Type_ *value = NULL, bool mended = false) :
- value_(value)
- {
- if (!mended)
- Retain_();
- }
-
- _finline ~_H() {
- Clear_();
- }
-
- _finline operator Type_ *() const {
- return value_;
- }
-
- _finline This_ &operator =(Type_ *value) {
- if (value_ != value) {
- Type_ *old(value_);
- value_ = value;
- Retain_();
- if (old != nil)
- [old release];
- } return *this;
- }
-};
-/* }}} */
/* APR Pool Helpers {{{ */
void *operator new(size_t size, apr_pool_t *pool) {
return apr_palloc(pool, size);
echo "$$2 = ($$1, \"$$3\");"; \
done >$@
-Cycript.tab.c Cycript.tab.h: Cycript.y
- bison $<
+Cycript.tab.c Cycript.tab.h: Cycript.y makefile
+ bison -v $<
lex.cy.c: Cycript.l
flex $<
cp -a libcycript.plist package/usr/lib
dpkg-deb -b package $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
+test: package
+ dpkg -i $(shell grep ^Package: control | cut -d ' ' -f 2-)_$(shell grep ^Version: control | cut -d ' ' -f 2)_iphoneos-arm.deb
+ cycript
+
.PHONY: all clean extra package