Commit bb893258 authored by Maxime Perrotin's avatar Maxime Perrotin

Added ASN.1 parser using ASN1SCC compiler

parent 9b43d914
This diff is collapsed.
......@@ -42,6 +42,7 @@ from sdl92Parser import sdl92Parser
import samnmax
import ogAST
from Asn1scc import parse_asn1, ASN1
LOG = logging.getLogger(__name__)
......@@ -1214,8 +1215,8 @@ def expression(root, context):
elif root.type in (lexer.PLUS,
lexer.ASTERISK,
lexer.DASH,
lexer.APPEND,
lexer.DIV,
lexer.APPEND,
lexer.REM,
lexer.MOD):
expr.exprType = expr.left.exprType
......@@ -2821,20 +2822,18 @@ def pr_file(root):
ast.use_clauses.append(clause.text)
try:
global DV
if not DV:
# Here XXX call asn1.exe to create DataView.py
# (Currently done in buildsupport)
DV = importlib.import_module('DataView')
else:
reload(DV)
DV = parse_asn1(tuple(ast.asn1_filenames),
ast_version=ASN1.UniqueEnumeratedNames,
flags=[ASN1.AstOnly])
ast.dataview = types()
ast.asn1Modules = DV.asn1Modules
# Add constants defined in the ASN.1 modules (for visibility)
for mod in ast.asn1Modules:
ast.asn1_constants.extend(DV.exportedVariables[mod])
except (ImportError, NameError):
except (ImportError, NameError) as err:
# Can happen if DataView.py is not there
LOG.info('USE Clause did not contain ASN.1 filename')
LOG.debug(str(err))
for child in systems:
LOG.debug('found SYSTEM')
system, err, warn = system_definition(child, parent=ast)
......
......@@ -29,6 +29,10 @@ from itertools import chain
# Added to please py2exe - NOQA makes flake8 ignore the following lines:
# pylint: disable=W0611
import subprocess # NOQA
import tempfile # NOQA
import uuid # NOQA
import importlib # NOQA
import antlr3 # NOQA
import antlr3.tree # NOQA
import importlib # NOQA
......@@ -42,7 +46,8 @@ import sdl92Parser # NOQA
import genericSymbols # NOQA
import sdlSymbols
import PySide.QtXml # NOQA
import singledispatch # NOQA
import singledispatch # NOQA
import Asn1scc # NOQA
#from PySide import phonon
......@@ -678,12 +683,12 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
''' Parse the graphical items and returns a PR string '''
pr_data = deque()
for each in self.processes:
pr_data.append(each.parse_gr())
pr_data.append(each.PR())
for item in chain(self.texts, self.procs, self.start):
pr_data.append(item.PR())
for item in self.floating_labels:
pr_data.append(item.parse_gr())
pr_data.append(item.PR_floating())
composite = set(self.composite_states.keys())
for item in self.states:
if item.is_composite():
......@@ -692,7 +697,7 @@ class SDL_Scene(QtGui.QGraphicsScene, object):
pr_data.appendleft(item.parse_composite_state())
except KeyError:
pass
pr_data.append(item.parse_gr())
pr_data.append(item.PR_state())
return list(pr_data)
......@@ -1777,7 +1782,7 @@ def opengeode():
LOG.setLevel(level)
for module in (sdlSymbols, genericSymbols, ogAST, ogParser, Lander,
AdaGenerator, undoCommands, Renderer, Clipboard, Statechart,
Helper, LlvmGenerator):
Helper, LlvmGenerator, Asn1scc):
module.LOG.addHandler(handler_console)
module.LOG.setLevel(level)
......
......@@ -26,5 +26,6 @@
<file>fonts/Ubuntu-R.ttf</file>
<file>fonts/Ubuntu-RI.ttf</file>
<file>misc/lander.mp3</file>
<file>misc/python.stg</file>
</qresource>
</RCC>
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-05-19 19:58:33
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-06-05 14:01:59
import sys
from antlr3 import *
......
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-05-19 19:58:32
# $ANTLR 3.1.3 Mar 17, 2009 19:23:44 sdl92.g 2014-06-05 14:01:58
import sys
from antlr3 import *
......
This diff is collapsed.
......@@ -6,7 +6,7 @@ generate-code:
compile: generate-code
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c *.adb
gnatmake -c -gnat2012 *.adb
#gcc -c test.c
gnatbind -n trafficlight.ali
#gnatlink -o testcase test.o trafficlight.ali -lgnat -lm
......
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