Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
68d172c5
Commit
68d172c5
authored
Sep 29, 2015
by
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
opengeode/ogParser.py
View file @
68d172c5
...
...
@@ -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"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment