diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-12-18 21:53:18 -0600 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-12-18 21:53:18 -0600 |
| commit | 0db54af54f17c1e62dff4baa44ea40e6d14c676e (patch) | |
| tree | 668c0e9fe24604f0a4bad2bf4eb12c1002c8da44 | |
| parent | ad809242c839aba8fc13523d68cf99ea96817633 (diff) | |
| parent | 63c979ff928d60e8f28c544b091c252b9164bf65 (diff) | |
| download | nimterop-0db54af54f17c1e62dff4baa44ea40e6d14c676e.tar.gz nimterop-0db54af54f17c1e62dff4baa44ea40e6d14c676e.zip | |
Merge branch 'issue158'
| -rw-r--r-- | nimterop/grammar.nim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nimterop/grammar.nim b/nimterop/grammar.nim index 16e1b91..9f50ba4 100644 --- a/nimterop/grammar.nim +++ b/nimterop/grammar.nim @@ -332,8 +332,11 @@ proc initGrammar(): Grammar = fname = nimState.getIdentifier(nimState.data[i].val, nskField, nname) if i+1 < nimState.data.len-fend and nimState.data[i+1].name in gEnumVals: - let + # Struct field is an array where size is an expression + var flen = nimState.getNimExpression(nimState.data[i+1].val) + if "/" in flen: + flen = &"({flen}).int" nimState.typeStr &= &"{nimState.getComments()}\n {fname}*: {aptr}array[{flen}, {getPtrType(fptr&ftyp)}]" i += 2 elif i+1 < nimState.data.len-fend and nimState.data[i+1].name == "bitfield_clause": |
