Commit 68d172c5 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Avoid exceptions when parsing newtype

NEWTYPE isn't supported by Opengeode but at least it must be parsed
properly.
parent 4dbda643
......@@ -2267,8 +2267,12 @@ def newtype(root, ta_ast, context):
newtype = type(str(newtypename), (object,), {
"Line": root.getLine(),
"CharPositionInLine": root.getCharPositionInLine()})
if (root.getChild(1).type == lexer.ARRAY):
if len(root.children) < 2:
warnings.append('Use newtype definitions for arrays and records only')
newtype.kind = "BooleanType"
DV.types[str(newtypename)] = newtype
LOG.debug("Boolean newtype " + newtypename)
elif (root.getChild(1).type == lexer.ARRAY):
newtype.kind = "SequenceOfType"
newtype.type = get_array_type(root.getChild(1))
newtype.Min = "Min"
......
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