%token Plus "+"
%token PlusEqual "+="
%token PlusPlus "++"
+%token QuestionPeriod "?."
%token Right ">"
%token RightEqual ">="
%token RightRight ">>"
%token ___proto___ "__proto__"
%token _prototype_ "prototype"
%token _public_ "public"
-%token ___restrict_ "__restrict"
-%token _restrict_ "restrict"
%token _set_ "set"
%token _short_ "short"
%token _static_ "static"
| "boolean" { $$ = CYNew CYIdentifier("boolean"); }
| "byte" { $$ = CYNew CYIdentifier("byte"); }
| "constructor" { $$ = CYNew CYIdentifier("constructor"); }
- | "double" { $$ = CYNew CYIdentifier("double"); }
| "each" { $$ = CYNew CYIdentifier("each"); }
| "eval" { $$ = CYNew CYIdentifier("eval"); }
| "final" { $$ = CYNew CYIdentifier("final"); }
- | "float" { $$ = CYNew CYIdentifier("float"); }
| "from" { $$ = CYNew CYIdentifier("from"); }
| "get" { $$ = CYNew CYIdentifier("get"); }
| "goto" { $$ = CYNew CYIdentifier("goto"); }
IdentifierNoOf
: IdentifierTypeNoOf
| "char" { $$ = CYNew CYIdentifier("char"); }
+ | "double" { $$ = CYNew CYIdentifier("double"); }
+ | "float" { $$ = CYNew CYIdentifier("float"); }
| "int" { $$ = CYNew CYIdentifier("int"); }
| "__int128" { $$ = CYNew CYIdentifier("__int128"); }
| "long" { $$ = CYNew CYIdentifier("long"); }
- | "__restrict" { $$ = CYNew CYIdentifier("__restrict"); }
- | "restrict" { $$ = CYNew CYIdentifier("restrict"); }
| "short" { $$ = CYNew CYIdentifier("short"); }
| "static" { $$ = CYNew CYIdentifier("static"); }
| "volatile" { $$ = CYNew CYIdentifier("volatile"); }
| TypeSignifierNone[pass] { $$ = $pass; }
;
-Restrict
- : "__restrict"
- | "restrict"
- ;
-
-RestrictOpt
- : Restrict
- |
- ;
-
-ParameterModifier
- : "throw" "(" ")"
- ;
-
-ParameterModifierOpt
- : ParameterModifier
- |
- ;
-
ParameterTail
- : TypedParameterListOpt[formal] ")" ParameterModifierOpt { $$ = CYNew CYTypeFunctionWith($formal->variadic_, $formal->parameters_); }
+ : TypedParameterListOpt[formal] ")" { $$ = CYNew CYTypeFunctionWith($formal->variadic_, $formal->parameters_); }
;
SuffixedType
- : SuffixedTypeOpt[typed] "[" RestrictOpt 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; }
| PrefixedType[pass] { $$ = $pass; }
| "const" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeConstant($$->modifier_); }
| "volatile" TypeQualifierRightOpt[typed] { $$ = $typed; $$->modifier_ = CYNew CYTypeVolatile($$->modifier_); }
- | Restrict TypeQualifierRightOpt[typed] { $$ = $typed; }
;
TypeQualifierRightOpt
| IntegerType[pass] { $$ = $pass; }
| TypeSigning[signing] "char" { $$ = CYNew CYTypeCharacter($signing); }
| TypeSigning[signing] "__int128" { $$ = CYNew CYTypeInt128($signing); }
+ | "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