Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
OpenGEODE
Commits
c37e0cc0
Commit
c37e0cc0
authored
May 30, 2015
by
Maxime Perrotin
Browse files
Add support for USE clause with path
Support USE package/item1, item2,...;
parent
c55cac60
Changes
3
Hide whitespace changes
Inline
Side-by-side
opengeode/ogParser.py
View file @
c37e0cc0
...
...
@@ -2337,6 +2337,7 @@ def text_area_content(root, ta_ast, context):
# in order to have the types properly defined
signals
.
append
(
child
)
elif
child
.
type
==
lexer
.
USE
:
entities
=
[]
# USE clauses can contain a CIF comment with the ASN.1 filename
for
each
in
child
.
getChildren
():
if
each
.
type
==
lexer
.
ASN1
:
...
...
@@ -2346,7 +2347,13 @@ def text_area_content(root, ta_ast, context):
use_cmt
,
_
,
_
=
end
(
each
)
ta_ast
.
asn1_files
.
append
(
use_cmt
.
inputString
)
else
:
ta_ast
.
use_clauses
.
append
(
each
.
text
)
entities
.
append
(
each
.
text
)
if
len
(
entities
)
==
1
:
ta_ast
.
use_clauses
.
append
(
entities
[
0
])
elif
len
(
entities
)
>
1
:
ta_ast
.
use_clauses
.
extend
(
'{}/{}'
.
format
(
entities
[
0
],
each
)
for
each
in
entities
[
1
:])
else
:
warnings
.
append
(
'Unsupported construct in text area content, type: '
+
...
...
@@ -3971,11 +3978,17 @@ def pr_file(root):
use_clause_subs
=
child
.
getChildren
()
asn1_filename
=
None
for
clause
in
use_clause_subs
:
entities
=
[]
if
clause
.
type
==
lexer
.
ASN1
:
asn1_filename
=
clause
.
getChild
(
0
).
text
[
1
:
-
1
]
ast
.
asn1_filenames
.
append
(
asn1_filename
)
else
:
ast
.
use_clauses
.
append
(
clause
.
text
)
entities
.
append
(
clause
.
text
)
if
len
(
entities
)
==
1
:
ast
.
use_clauses
.
append
(
entities
[
0
])
elif
len
(
entities
)
>
1
:
ast
.
use_clauses
.
extend
(
'{}/{}'
.
format
(
entities
[
0
],
each
)
for
each
in
entities
[
1
:])
# if not asn1_filename:
# # Look for case insentitive pr file and add it to AST
# search = fnmatch.translate(clause.text + '.pr')
...
...
sdl92.g
View file @
c37e0cc0
...
...
@@ -152,9 +152,16 @@ system_definition
use_clause
: use_asn1?
USE package_name end
-> ^(USE use_asn1? end? package_name);
USE package_name
('/' def_selection_list )?
end
-> ^(USE use_asn1? end? package_name def_selection_list?);
/*
In USE clause: USE package/X, Y, Z;
*/
def_selection_list
: ID (','! ID)*;
/* Entity in system:
Declare signals, external procedures, connections and blocks
...
...
tests/regression/test-processfpar2/og.pr
View file @
c37e0cc0
SYSTEM og;
/* CIF TEXT (159, 221), (287, 1
8
8) */
/* CIF TEXT (159, 221), (287,
2
18) */
-- Text area for declarations and comments
use dv comment 'dataview-uniq.asn';
--use dv2 comment 'dataview2.asn';
-- use clause with sub definitions:
use qt/qgraphicscene, qgraphicsview;
signal dd(Type2);
signal we(Some_Thing);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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