Added support for lists (without index value)

This commit is contained in:
Raphael Coeffic
2021-11-10 11:07:00 +01:00
parent 77ff579355
commit a8f2212f2c
22 changed files with 124 additions and 75 deletions
+4 -3
View File
@@ -336,12 +336,12 @@ def parse_field_array(f, node):
if f.type != 'string':
elmt_decl = et.get_declaration()
use_idx = False
use_idx = True
ann = get_annotations(node)
if len(ann) > 0:
for a in ann:
if a['type'] == 'idx':
use_idx = True
if a['type'] == 'idx' and a['val'] == 'false':
use_idx = False
elif a['type'] == 'raw':
f.raw = a['val']
@@ -353,6 +353,7 @@ def parse_field_array(f, node):
f.var_name = elmt_st.var_name
# mark array usage for unions
elmt_st.used_in_arrays = True
elmt_st.use_idx = use_idx
elif elmt_decl.kind == CursorKind.TYPEDEF_DECL:
# it's some typedef
#print_error("TYPEDEF {} {}".format(f.name, elmt_decl.spelling));
+1 -1
View File
@@ -22,7 +22,7 @@ const struct YamlIdStr {{ enum.name }}[] = {
static const struct YamlNode {{ struct.name }}_elmts[] = {
{% else %}
static const struct YamlNode {{ struct.name }}[] = {
{% if struct.used_in_arrays %}
{% if struct.use_idx %}
YAML_IDX,
{% endif%}
{% endif %}