diff options
| author | Ganesh Viswanathan <dev@genotrance.com> | 2019-12-18 21:17:27 -0600 |
|---|---|---|
| committer | Ganesh Viswanathan <dev@genotrance.com> | 2019-12-18 21:17:27 -0600 |
| commit | 63c979ff928d60e8f28c544b091c252b9164bf65 (patch) | |
| tree | e227f821088a3e61207db5a94517295aa35978fa | |
| parent | c4b6a01878f0f72d428a24c26153723c60f6695f (diff) | |
| download | nimterop-issue158.tar.gz nimterop-issue158.zip | |
Fix #158 - array size with divisionissue158
| -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": |
