summaryrefslogtreecommitdiff
path: root/graphics/asymptote/camp.y
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/asymptote/camp.y')
-rw-r--r--graphics/asymptote/camp.y16
1 files changed, 15 insertions, 1 deletions
diff --git a/graphics/asymptote/camp.y b/graphics/asymptote/camp.y
index 9def3139c0..b8831bc9fa 100644
--- a/graphics/asymptote/camp.y
+++ b/graphics/asymptote/camp.y
@@ -114,7 +114,7 @@ using mem::string;
%token <pos> LOOSE ASSIGN '?' ':'
DIRTAG JOIN_PREC AND
'{' '}' '(' ')' '.' ',' '[' ']' ';' ELLIPSIS
- ACCESS UNRAVEL IMPORT INCLUDE FROM QUOTE STRUCT TYPEDEF NEW
+ ACCESS UNRAVEL IMPORT INCLUDE FROM QUOTE STRUCT TYPEDEF USING NEW
IF ELSE WHILE DO FOR BREAK CONTINUE RETURN_
THIS_TOK EXPLICIT
GARBAGE
@@ -456,6 +456,20 @@ fundec:
typedec:
STRUCT ID block { $$ = new recorddec($1, $2.sym, $3); }
| TYPEDEF vardec { $$ = new typedec($1, $2); }
+// See definition for decidstart. Following C++, "The syntax of the type-id
+// that names type T is exactly the syntax of a declaration of a variable or
+// function of type T, with the identifier omitted."
+// http://en.cppreference.com/w/cpp/language/type#Type_naming
+| USING ID ASSIGN type ';'
+ { decidstart *dis = new decidstart($2.pos, $2.sym);
+ $$ = new typedec($1, dis, $4); }
+| USING ID ASSIGN type '(' ')' ';'
+ { decidstart *dis = new fundecidstart($2.pos, $2.sym,
+ 0, new formals($5));
+ $$ = new typedec($1, dis, $4); }
+| USING ID ASSIGN type '(' formals ')' ';'
+ { decidstart *dis = new fundecidstart($2.pos, $2.sym, 0, $6);
+ $$ = new typedec($1, dis, $4); }
;
slice: