Skip to content

Commit

Permalink
[foliaspec] fix for rust code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
proycon committed Sep 2, 2020
1 parent 5086ec3 commit 1ed0a35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions foliatools/foliaspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,15 +691,15 @@ def outputblock(block, target, varname, args, indent = ""):
if element['class'].endswith('Layer'):
if 'properties' in element and 'xmltag' in element['properties'] and element['properties']['xmltag'] and 'annotationtype' in element['properties']:
s += indent + " AnnotationType." + element['properties']['annotationtype'] + ': ' + element['class'] + ' ,\n'
s += indent + " AnnotationType.PREDICATE: SemanticRolesLayer\n"
s += indent + " AnnotationType.PREDICATE: ElementType::SemanticRolesLayer\n"
s += indent + "}"
elif target == 'rust':
s += indent + "match " + args[0] + " {\n"
for element in elements:
if element['class'].endswith('Layer'):
if 'properties' in element and 'xmltag' in element['properties'] and element['properties']['xmltag'] and 'annotationtype' in element['properties']:
s += indent + " AnnotationType::" + element['properties']['annotationtype'] + ' => Some(ElementType::' + element['class'] + '),\n'
s += indent + " AnnotationType::PREDICATE => Some(SemanticRolesLayer),\n"
s += indent + " AnnotationType::PREDICATE => Some(ElementType::SemanticRolesLayer),\n"
s += indent + " _ => None\n"
s += indent + "}"
else:
Expand Down

0 comments on commit 1ed0a35

Please sign in to comment.