Commit 0b73b935 authored by Anna Vernerová's avatar Anna Vernerová
Browse files

frame parsing: more thorough data errors

parent 67fab663
Pipeline #185327866 passed with stages
in 10 minutes and 51 seconds
......@@ -501,7 +501,6 @@ def parse_frame(body) -> Frame:
"""
elts = []
grouped_functors = False
for token in body:
if isinstance(token, tok.FunctorTupleList):
if ' ' in token._val:
......@@ -518,13 +517,14 @@ def parse_frame(body) -> Frame:
data_error('parser:txt', error.INVALID_ATTR_VALUE, token._loc, 'Invalid obligatory type', oblig, 'while parsing frame')
else:
forms, oblig = token._args.split(','), None # type: ignore
data_error('parser:txt', error.INVALID_ATTR_VALUE, token._loc, 'Bracket after functor does not contain a semicolon:', token._args, 'while parsing frame')
if elts and elts[-1].functor.endswith('|'): # grouped Functors (e.g. BEN(;obl)|MANN(;obl)|MEANS(;obl)) parsed into a single ValencySlot
if list(filter(None, forms)):
elts[-1].forms.append(forms)
if oblig and oblig != elts[-1].oblig:
if elts[-1].oblig:
elts[-1].oblig += (', ' + oblig)
# Muze mit skupina Functoru ruzne priznaky obl/opt/...? Pokud ne logovat errorovou hlasku.
data_error('parser:txt', error.INVALID_ATTR_VALUE, token._loc, 'Alternative functors with differing obligatoriness', elts[-1].oblig, 'while parsing frame')
else:
elts[-1].oblig = oblig
elts[-1].functor += token._val
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment