%token Plus "+"
%token PlusEqual "+="
%token PlusPlus "++"
+%token QuestionPeriod "?."
%token Right ">"
%token RightEqual ">="
%token RightRight ">>"
;
SuffixedType
- : SuffixedTypeOpt[typed] "[" NumericLiteral[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
+ : SuffixedTypeOpt[typed] "[" AssignmentExpression[size] "]" { $$ = $typed; $$->modifier_ = CYNew CYTypeArrayOf($size, $$->modifier_); }
| "(" "^" TypeQualifierRightOpt[typed] ")" "(" TypedParameters[parameters] ")" { $$ = $typed; $$->modifier_ = CYNew CYTypeBlockWith($parameters, $$->modifier_); }
| TypeSignifier[typed] "(" ParameterTail[modifier] { $$ = $typed; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
| "("[parenthesis] ParameterTail[modifier] { $$ = CYNew CYTypedName(@parenthesis); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
| "float" { $$ = CYNew CYTypeFloating(0); }
| "double" { $$ = CYNew CYTypeFloating(1); }
| "long" "double" { $$ = CYNew CYTypeFloating(2); }
+ | "void" { $$ = CYNew CYTypeVoid(); }
;
PrimitiveReference
;
TypedIdentifierMaybe
- : TypeQualifierLeft[modifier] "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
- | "void" TypeQualifierRight[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
- | TypeQualifierLeftOpt[modifier] PrimitiveReference[specifier] TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = $specifier; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
+ : TypeQualifierLeftOpt[modifier] PrimitiveReference[specifier] TypeQualifierRightOpt[typed] { $$ = $typed; $$->specifier_ = $specifier; CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
;
TypedIdentifierYes
TypedIdentifierEncoding
: TypedIdentifierNo[pass] { $$ = $pass; }
| TypedIdentifierTagged[typed] { if ($typed->name_ != NULL) CYERR($typed->location_, "unexpected identifier"); $$ = $typed; }
- | "void" TypeSignifierNone[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
;
TypedIdentifierDefinition
: TypedIdentifierYes[pass] { $$ = $pass; }
| TypeQualifierLeftOpt[modifier] "struct" IdentifierTypeOpt[name] "{" StructFieldListOpt[fields] "}" TypeQualifierRightOpt[typed] { if ($typed->name_ == NULL) CYERR($typed->location_, "expected identifier"); $$ = $typed; $$->specifier_ = CYNew CYTypeStruct($name, CYNew CYStructTail($fields)); CYSetLast($modifier) = $$->modifier_; $$->modifier_ = $modifier; }
- | "void" TypeSignifier[typed] { $$ = $typed; $$->specifier_ = CYNew CYTypeVoid(); }
;
PrimaryExpression
TypedParameterListOpt
: TypedParameterList[pass] { $$ = $pass; }
- | "void" { $$ = CYNew CYTypedFormal(false); }
| { $$ = CYNew CYTypedFormal(false); }
;
: "." "[" AssignmentExpression[property] "]" { $$ = CYNew CYSubscriptMember(NULL, $property); }
;
/* }}} */
+/* JavaScript FTW: Undefined Monad {{{ */
+MemberAccess
+ : "?." IdentifierName[property] { $$ = CYNew CYAttemptMember(NULL, CYNew CYString($property)); }
+ | "?." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; }
+ ;
+/* }}} */
/* JavaScript FTW: Java "Anonymous Inner Classes" {{{ */
BracedParameter