Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenGEODE
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
TASTE
OpenGEODE
Commits
90746690
Commit
90746690
authored
Apr 11, 2019
by
Maxime Perrotin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete advanced support of "in" operator
parent
6aac21a9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
9 deletions
+12
-9
README.md
README.md
+4
-0
opengeode/AdaGenerator.py
opengeode/AdaGenerator.py
+1
-1
opengeode/ogAST.py
opengeode/ogAST.py
+0
-1
opengeode/ogParser.py
opengeode/ogParser.py
+4
-2
opengeode/opengeode.py
opengeode/opengeode.py
+1
-1
tests/regression/test-in-expression/og.pr
tests/regression/test-in-expression/og.pr
+2
-4
No files found.
README.md
View file @
90746690
...
...
@@ -135,6 +135,10 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
2.
0.38 (04/2019)
-
Support advanced "in" expressions (e.g. "someVar in {enum1, enum2}",
or "someVar in {{a 4, b false}, {a 1, b true}}"
2.
0.37 (04/2019)
-
Support substrings on the left part of an expression (a(1,2) := ...)
...
...
opengeode/AdaGenerator.py
View file @
90746690
...
...
@@ -2306,7 +2306,7 @@ def _expr_in(expr, **kwargs):
local_decl
.
extend
([
u'tmp{} : constant array (1 .. {}) of {} := ({});'
.
format
(
expr
.
tmpVar
,
size
,
sort
,
left_str
)])
ada_string
=
u'
for some var of tmp{} => var = {}
'
.
format
(
expr
.
tmpVar
,
ada_string
=
u'
(for some var of tmp{} => var = {})
'
.
format
(
expr
.
tmpVar
,
right_str
)
else
:
local_decl
.
extend
([
u'tmp{} : Boolean := False;'
.
format
(
expr
.
tmpVar
)])
...
...
opengeode/ogAST.py
View file @
90746690
...
...
@@ -183,7 +183,6 @@ class Primary(Expression):
self
.
charPositionInLine
=
primary
.
charPositionInLine
self
.
value
=
primary
.
value
self
.
exprType
=
primary
.
exprType
self
.
debugLine
=
primary
.
debugLine
else
:
self
.
inputString
=
inputString
self
.
line
=
line
...
...
opengeode/ogParser.py
View file @
90746690
...
...
@@ -1289,6 +1289,8 @@ def fix_expression_types(expr, context): # type: -> [warnings]
# (due to similarities, the following should be refactored FIXME)
if
isinstance
(
expr
.
right
,
ogAST
.
PrimSequence
):
#print "Left:", type_name(expr.left.exprType), "Right:", expr.right.inputString
#print traceback.print_stack()
# left side must have a known type
asn_type
=
find_basic_type
(
expr
.
left
.
exprType
)
if
asn_type
.
kind
!=
'SequenceType'
:
...
...
@@ -1828,13 +1830,13 @@ def in_expression(root, context):
# in "foo in {enum1, enum2}" we must check that enum1 and enum2 are both
# of the same type as foo
if
expr
.
left
.
is_raw
and
not
expr
.
right
.
is_raw
:
# we must check that all entries are compatible with
ref_typ
e
# we must check that all entries are compatible with
the other sid
e
# and if they were variables, but are in fact raw enumerants, they
# must be changed from ogAST.PrimVariable to ogAST.PrimEnumeratedValue
for
idx
,
value
in
enumerate
(
expr
.
left
.
value
):
check_expr
=
ogAST
.
ExprAssign
()
check_expr
.
left
=
ogAST
.
PrimVariable
(
debugLine
=
lineno
())
check_expr
.
left
.
exprType
=
ref_t
ype
check_expr
.
left
.
exprType
=
expr
.
right
.
exprT
ype
check_expr
.
right
=
value
try
:
warnings
.
extend
(
fix_expression_types
(
check_expr
,
context
))
...
...
opengeode/opengeode.py
View file @
90746690
...
...
@@ -141,7 +141,7 @@ except ImportError:
__all__
=
[
'opengeode'
,
'SDL_Scene'
,
'SDL_View'
,
'parse'
]
__version__
=
'2.0.3
7
'
__version__
=
'2.0.3
8
'
if
hasattr
(
sys
,
'frozen'
):
# Detect if we are running on Windows (py2exe-generated)
...
...
tests/regression/test-in-expression/og.pr
View file @
90746690
...
...
@@ -29,11 +29,9 @@ system og;
dcl someEnum Enum_T := enum2;
dcl somSeq Toto := {elem_1 1, elem_2 false};
dcl som
e
Seq Toto := {elem_1 1, elem_2 false};
dcl testincase ForTheSakeOfIt := {enum1, enum2};
/* CIF ENDTEXT */
/* CIF START (556, 221), (70, 35) */
START;
...
...
@@ -73,7 +71,7 @@ system og;
call writeln('ERROR 3');
enddecision;
/* CIF decision (388, 815), (406, 50) */
decision
'someSeq in {{elem_1 1, elem_2 false}, {elem_1 0, elem_2 true}}'
decision
someSeq in {{elem_1 1, elem_2 false}, {elem_1 0, elem_2 true}}
/* CIF comment (814, 822), (226, 35) */
comment 'cause bug in Ada backend: FIXME';
/* CIF ANSWER (475, 885), (70, 23) */
...
...
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