Commit 8e8d44f4 by Zachary Snow

allow array struct fields

parent a1cd6941
...@@ -496,7 +496,13 @@ StructItems :: { [(Type, Identifier)] } ...@@ -496,7 +496,13 @@ StructItems :: { [(Type, Identifier)] }
: StructItem { $1 } : StructItem { $1 }
| StructItems StructItem { $1 ++ $2 } | StructItems StructItem { $1 ++ $2 }
StructItem :: { [(Type, Identifier)] } StructItem :: { [(Type, Identifier)] }
: Type Identifiers ";" { map (\a -> ($1, a)) $2 } : Type FieldDecls ";" { map (fieldDecl $1) $2 }
FieldDecls :: { [(Identifier, [Range])] }
: FieldDecl { [$1] }
| FieldDecls "," FieldDecl { $1 ++ [$3] }
FieldDecl :: { (Identifier, [Range]) }
: Identifier Dimensions { ($1, $2) }
Packing :: { Packing } Packing :: { Packing }
: "packed" OptSigning { Packed $2 } : "packed" OptSigning { Packed $2 }
...@@ -1321,4 +1327,9 @@ makeParamDecls s t items = ...@@ -1321,4 +1327,9 @@ makeParamDecls s t items =
(tf, rs) = typeRanges t (tf, rs) = typeRanges t
mapper (x, e, a) = Param s (tf $ a ++ rs) x e mapper (x, e, a) = Param s (tf $ a ++ rs) x e
fieldDecl :: Type -> (Identifier, [Range]) -> (Type, Identifier)
fieldDecl t (x, rs2) =
(tf $ rs2 ++ rs1, x)
where (tf, rs1) = typeRanges t
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment