Skip to content

Commit

Permalink
Cleanup a2l_listener.py
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph2 committed Jan 23, 2021
1 parent 8f85e07 commit 96c7508
Showing 1 changed file with 3 additions and 35 deletions.
38 changes: 3 additions & 35 deletions pya2l/a2l_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
__copyright__ = """
pySART - Simplified AUTOSAR-Toolkit for Python.
(C) 2010-2019 by Christoph Schueler <cpu12.gems.googlemail.com>
(C) 2010-2021 by Christoph Schueler <cpu12.gems.googlemail.com>
All Rights Reserved
Expand All @@ -27,15 +27,14 @@
__author__ = "Christoph Schueler"
__version__ = "0.1.0"

import re

from decimal import Decimal as D
import re

import antlr4

import pya2l.model as model
from pya2l.logger import Logger
from pya2l.preprocessor import blank_out


def delist(iterable, scalar=False):
if len(iterable) == 0:
Expand All @@ -55,37 +54,6 @@ def delist(iterable, scalar=False):
return [iterable[0]]


def cut_a2ml(data):
""""""
AML = re.compile(
r"""
/begin\s+A[23]ML
(.*?)
/end\s+A[23]ML
""",
re.VERBOSE | re.DOTALL | re.MULTILINE,
)

IF_DATA = re.compile(
r"""
/begin\s+IF_DATA
(.*?)
/end\s+IF_DATA
""",
re.VERBOSE | re.DOTALL | re.MULTILINE,
)
a2ml = None
# if_data = []
match = AML.search(data)
if match:
data = blank_out(data, match.span())

matches = list(IF_DATA.finditer(data))
if matches:
for idx, match in enumerate(matches):
data = blank_out(data, match.span())
return data, a2ml


class BaseListener(antlr4.ParseTreeListener):
""""""
Expand Down

0 comments on commit 96c7508

Please sign in to comment.