Add support for char enums - #119

This commit is contained in:
Ganesh Viswanathan 2019-05-07 22:22:25 -05:00
commit f8c433832e
4 changed files with 13 additions and 3 deletions

View file

@ -52,7 +52,7 @@ proc saveNodeData(node: TSNode, nimState: NimState): bool =
nimState.data.insert(("pointer_declarator", ""), nimState.data.len-1)
nimState.data.add(("function_declarator", ""))
elif name in gExpressions:
elif name in gExpressions and name != "escape_sequence":
if $node.tsNodeParent.tsNodeType() notin gExpressions:
nimState.data.add((name, node.getNodeVal()))

View file

@ -12,6 +12,7 @@ const
"field_identifier",
"identifier",
"number_literal",
"char_literal",
"preproc_arg",
"primitive_type",
"sized_type_specifier",
@ -22,12 +23,14 @@ const
"parenthesized_expression",
"bitwise_expression",
"shift_expression",
"math_expression"
"math_expression",
"escape_sequence"
].toSet()
gEnumVals {.used.} = @[
"identifier",
"number_literal"
"number_literal",
"char_literal"
].concat(toSeq(gExpressions.items))
type

View file

@ -73,6 +73,11 @@ enum ENUM5 {
enum15 = (1 << (1 & 1))
};
enum ENUM7 {
enum17 = '\0',
enum18 = 'A'
};
typedef void * VOIDPTR;
typedef int * INTPTR;

View file

@ -127,6 +127,8 @@ check e4 == enum11
check enum13 == 4
check enum14 == 9
check enum15 == 2
check enum17 == '\0'.ENUM7
check enum18 == 'A'.ENUM7
# Issue #58
multiline1()