} YYSTYPE;
#define YYSTYPE YYSTYPE
-@if Bison24 }
@if Bison24 %code provides {
int cylex(YYSTYPE *, cy::location *, void *);
@if Bison24 }
+@if Bison23 %}
+@if Bison23 %union {
+@if Bison23 }
+@if Bison23 %{
+
+@if Bison24 }
@if Bison23 %}
%name-prefix="cy"
%token <identifier_> Typedef "typedef"
%token <identifier_> Unsigned "unsigned"
%token <identifier_> Signed "signed"
+%token <identifier_> Extern "extern"
@end
@begin C
@begin C
%type <typedIdentifier_> ArrayedType
-%type <expression_> EncodedType
%type <modifier_> FunctionedType
%type <specifier_> IntegerType
%type <specifier_> IntegerTypeOpt
%type <selector_> SelectorExpressionOpt
%type <argument_> SelectorList
%type <word_> SelectorWordOpt
-%type <expression_> TypeOpt
+%type <typedIdentifier_> TypeOpt
%type <argument_> VariadicCall
@end
| "typedef" { $$ = $1; }
| "unsigned" { $$ = $1; }
| "signed" { $$ = $1; }
+ | "extern" { $$ = $1; }
@end
@begin ObjectiveC
| "YES" { $$ = $1; }
: ArrayedType { $$ = $1; }
| "(" LexPushInOff "^" TypeQualifierRight ")" LexPopIn "(" LexPushInOff TypedParameterListOpt ")" LexPopIn { $$ = $4; $$->modifier_ = CYNew CYTypeBlockWith($9, $$->modifier_); }
| TypeParenthetical FunctionedType { $$ = $1; CYSetLast($2) = $$->modifier_; $$->modifier_ = $2; }
+ | IdentifierType FunctionedType { $$ = CYNew CYTypedIdentifier($1); CYSetLast($2) = $$->modifier_; $$->modifier_ = $2; }
| FunctionedType { $$ = CYNew CYTypedIdentifier(); CYSetLast($1) = $$->modifier_; $$->modifier_ = $1; }
;
: TypeQualifierLeft PrimitiveType TypeQualifierRight { $$ = $3; $$->specifier_ = $2; CYSetLast($1) = $$->modifier_; $$->modifier_ = $1; }
;
-EncodedType
- : TypedIdentifier { $$ = CYNew CYEncodedType($1); }
- ;
-
PrimaryExpression
- : "@encode" "(" EncodedType ")" { $$ = $3; }
+ : "@encode" "(" TypedIdentifier ")" { $$ = CYNew CYEncodedType($3); }
;
/* }}} */
@end
;
TypeOpt
- : "(" LexSetRegExp EncodedType ")" { $$ = $3; }
+ : "(" LexSetRegExp TypedIdentifier ")" { $$ = $3; }
| { $$ = NULL; }
;
/* }}} */
/* Cycript (C): Type Definitions {{{ */
Statement__
- : "typedef" TypedIdentifier Terminator { $$ = CYNew CYTypeDefinition($2); }
+ : "typedef" TypedIdentifier { if ($2->identifier_ == NULL) YYABORT; } Terminator { $$ = CYNew CYTypeDefinition($2); }
;
/* }}} */
+/* Cycript (C): extern "C" {{{ */
+Statement__
+ : "extern" StringLiteral { if (strcmp($2->Value(), "C") != 0) YYABORT; } TypedIdentifier Terminator { $$ = CYNew CYExternal($2, $4); }
+ ;
+/* }}} */
+
@end
/* YUI: Documentation Comments {{{ */