Skip to content

Commit

Permalink
Templates: Update x.type to x.datatype
Browse files Browse the repository at this point in the history
This is to match the variable name in the code now.  It might be
necessary to do another update of templates in combination with the next
iteration of the parser, a.k.a. "data driven" parser.
  • Loading branch information
Gunnar Andersson authored and Gunnar Andersson committed Jun 20, 2022
1 parent af2af9b commit d3fe3b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
12 changes: 2 additions & 10 deletions templates/sds-bamm-macros.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@
{% else -%}
{% if member.datatype and not member.datatype.endswith("_t") %}
bamm:dataType {{ _render_datatype(member.datatype) }} .
{% elif member.type and not member.type.endswith("_t") %}
bamm:dataType {{ _render_datatype(member.type) }} .
{% else %}
bamm:dataType {{ _render_characteristic_type(member) }} .
{% endif %}
Expand All @@ -113,7 +111,7 @@ a bamm-c:RangeConstraint ;
{% endmacro -%}

{% macro _render_characteristic_definition(member) %}
{% set type = member.type if member.type else member.datatype -%}
{% set type = member.datatype -%}
{% if member.datatype and (member.min or member.max) %}
{{- "bamm-c:Trait" -}}
{% elif type.endswith("[]") %}
Expand Down Expand Up @@ -176,18 +174,12 @@ a bamm-c:RangeConstraint ;
{{ member.name }}
{%- elif member.datatype and member.datatype.endswith("_t") -%}
Characteristic{{ snake_to_camel(member.datatype.capitalize()) }}
{%- elif member.type and member.type.endswith("_t") -%}
Characteristic{{ snake_to_camel(member.type.capitalize()) }}
{%- else -%}
Characteristic{{ snake_to_camel(member.name.capitalize()) }}
{%- endif -%}
{%- endmacro -%}

{# Render characteristic datatype #}
{%- macro _render_characteristic_type(member) -%}
{%- if member.datatype -%}
:{{ snake_to_camel(member.datatype.capitalize()) }}
{%- else -%}
:{{ snake_to_camel(member.type.capitalize()) }}
{%- endif -%}
{%- endmacro -%}
{%- endmacro -%}
11 changes: 5 additions & 6 deletions templates/simple_overview.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Header
Struct: {{ x.name }}
-> {{ x.description }}
{% for x in x.members %}
member: {{ x.name }} (of type {{x.type}})
member: {{ x.name }} (of type {{x.datatype}})
{% endfor %}
{% endfor %}
{% for x in n.typedefs %}
Expand All @@ -32,24 +32,23 @@ Header
Method: {{ x.name }}
-> {{ x.description }}
{% for x in x.in_arguments %}
in: {{ x.name }} (of type {{x.type}})
in: {{ x.name }} (of type {{x.datatype}})
{% endfor %}
{% for x in x.out_arguments %}
out: {{ x.name }} (of type {{x.type}})
out: {{ x.name }} (of type {{x.datatype}})
{% endfor %}
{% endfor %}
{% for x in n.events %}
Event: {{ x.name }}
-> {{ x.description }}
{% for x in x.in_arguments %}
in: {{ x.name }} (of type {{x.type}})
in: {{ x.name }} (of type {{x.datatype}})
{% endfor %}
{% endfor %}
{% for x in n.properties %}
Property: {{ x.name }}
-> {{ x.description }}
-> Type: {{ x.type }}
-> Datatype: {{ x.datatype }}
-> Type: {{ x.datatype }}
{% endfor %}
{% endfor %}
{% endfor %}
Expand Down

0 comments on commit d3fe3b2

Please sign in to comment.