mirror of https://github.com/zachjs/sv2v.git
allow array struct fields
This commit is contained in:
parent
a1cd6941ae
commit
8e8d44f421
|
|
@ -496,7 +496,13 @@ StructItems :: { [(Type, Identifier)] }
|
|||
: StructItem { $1 }
|
||||
| StructItems StructItem { $1 ++ $2 }
|
||||
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 }
|
||||
: "packed" OptSigning { Packed $2 }
|
||||
|
|
@ -1321,4 +1327,9 @@ makeParamDecls s t items =
|
|||
(tf, rs) = typeRanges t
|
||||
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
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue