summaryrefslogtreecommitdiff
path: root/src/parser.mly
diff options
context:
space:
mode:
authorKathy Gray2013-08-22 15:17:06 +0100
committerKathy Gray2013-08-22 15:17:06 +0100
commit86b3a50f56dd38999fa8eca7375fbd59d29603cb (patch)
treecb2e4da94e71d5db5c9c6d0b6a6c033e05db64aa /src/parser.mly
parentf3b7dba070562940427405b92b3c47cc29ee2a51 (diff)
Pretty printer for whole AST; due to parenthesis not always being placed where needed, what is generated may not parse
Diffstat (limited to 'src/parser.mly')
-rw-r--r--src/parser.mly14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/parser.mly b/src/parser.mly
index 60969ebd..1d4b7a0e 100644
--- a/src/parser.mly
+++ b/src/parser.mly
@@ -120,7 +120,7 @@ let star = "*"
/*Terminals with no content*/
-%token And As Bits By Case Clause Const Default Dec Effect Effects End Enum Else False
+%token And As Bits By Case Clause Const Default Dec Effect Effects End Enumerate Else False
%token Forall Foreach Function_ If_ In IN Inc Let_ Member Nat Order Pure Rec Register
%token Scattered Struct Switch Then True Type TYPE Typedef Union With Val
@@ -924,6 +924,14 @@ index_range_atomic:
| Lparen index_range Rparen
{ $2 }
+enum_body:
+ | id
+ { [$1] }
+ | id Semi
+ { [$1] }
+ | id Semi enum_body
+ { $1::$3 }
+
index_range:
| index_range_atomic
{ $1 }
@@ -968,6 +976,10 @@ type_def:
{ tdloc (TD_variant($2, $3, mk_typqn (), fst $8, snd $8)) }
| Typedef id Eq Const Union Lcurly c_def_body Rcurly
{ tdloc (TD_variant($2, mk_namesectn (), mk_typqn (), fst $7, snd $7)) }
+ | Typedef id Eq Enumerate Lcurly enum_body Rcurly
+ { tdloc (TD_enum($2, mk_namesectn (), $6,false)) }
+ | Typedef id name_sect Eq Enumerate Lcurly enum_body Rcurly
+ { tdloc (TD_enum($2,$3,$7,false)) }
| Typedef id Eq Register Bits Lsquare typ Colon typ Rsquare Lcurly r_def_body Rcurly
{ tdloc (TD_register($2, $7, $9, $12)) }