X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/56e02e5b879e679302c8d9a20654b8a193791a3a..5b75838211f16d9c88fb1bae3193e3693a1bee39:/Cycript.yy.in?ds=inline diff --git a/Cycript.yy.in b/Cycript.yy.in index d049537..fe1873f 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -481,6 +481,7 @@ int cylex(YYSTYPE *, cy::location *, void *); %type MessageScope %type ModifiedType %type PrefixedType +%type PrimitiveType %type QualifiedType %type SelectorCall_ %type SelectorCall @@ -792,7 +793,7 @@ ObjectLiteral PropertyDefinitionList_ : "," PropertyDefinitionList { $$ = $2; } - | "," { $$ = NULL; } + | "," LexSetRegExp { $$ = NULL; } | { $$ = NULL; } ; @@ -802,7 +803,7 @@ PropertyDefinitionList PropertyDefinitionListOpt : PropertyDefinitionList { $$ = $1; } - | { $$ = NULL; } + | LexSetRegExp { $$ = NULL; } ; PropertyDefinition @@ -1212,7 +1213,7 @@ BreakStatement /* }}} */ /* 12.9 The return Statement {{{ */ ReturnStatement - : "return" "\n" StrictSemi { $$ = CYNew CYReturn(NULL); } + : "return" LexSetRegExp "\n" StrictSemi { $$ = CYNew CYReturn(NULL); } | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); } ; /* }}} */ @@ -1252,7 +1253,7 @@ LabelledStatement /* }}} */ /* 12.13 The throw Statement {{{ */ ThrowStatement - : "throw" "\n" StrictSemi { YYABORT; } + : "throw" LexSetRegExp "\n" StrictSemi { YYABORT; } | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); } ; /* }}} */ @@ -1325,7 +1326,7 @@ ArrowParameters ConciseBody : AssignmentExpression { $$ = CYNew CYReturn($1); } - | ";{" LexPushInOff FunctionBody LexPopIn "}" { $$ = $3; } + | LexSetRegExp ";{" LexPushInOff FunctionBody LexPopIn "}" { $$ = $4; } ; /* }}} */ /* 14 Program {{{ */ @@ -1357,8 +1358,13 @@ PrefixedType | "*" PrefixedType { CYSetLast($2->type_) = CYNew CYTypePointerTo(); $$ = $2; } ; +PrimitiveType + : Variable { $$ = $1; } + | "void" { $$ = CYNew cy::Syntax::New(CYNew CYVariable(CYNew CYIdentifier("Type")), CYNew CYArgument(CYNew CYString("v"))); } + ; + QualifiedType - : Variable { $$ = CYNew CYTypeVariable($1); } + : PrimitiveType { $$ = CYNew CYTypeVariable($1); } | "const" QualifiedType { $$ = CYNew CYTypeConstant($2); } ; @@ -1389,7 +1395,7 @@ ClassSuperOpt ClassFieldListOpt : Expression Identifier ";" ClassFieldListOpt { $$ = CYNew CYField($1, $2, $4); } - | { $$ = NULL; } + | LexSetRegExp { $$ = NULL; } ; ClassFields @@ -1403,7 +1409,6 @@ MessageScope TypeOpt : "(" LexSetRegExp EncodedType ")" { $$ = $3; } - | "(" LexSetRegExp "void" ")" { $$ = CYNew CYString("v"); } | { $$ = NULL; } ;