MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit 66343619 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib][antlr] Update imports to antlr4; #2

parent 7f21b14c
......@@ -49,7 +49,7 @@ from cadbiom.models.biosignal.sig_expr import SigDefaultExpr, SigIdentExpr, \
SigEventExpr, SigWhenExpr, SigSyncBinExpr
from cadbiom.models.biosignal.translators.sigexpr_compiler import sigexpr_compiler
from cadbiom.models.biosignal.translators.sigexpr_lexer import sigexpr_lexer
from antlr3 import ANTLRStringStream, CommonTokenStream, RecognitionException
from antlr4 import InputStream, CommonTokenStream, RecognitionException
class Reporter(object):
......@@ -185,7 +185,7 @@ class TestExpressionAnalyzer(unittest.TestCase):
default left associativity
"""
sig_str = "X1 default X2 default X3 $"
reader = ANTLRStringStream(sig_str)
reader = InputStream(sig_str)
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(self.err_rep)
......@@ -204,7 +204,7 @@ class TestExpressionAnalyzer(unittest.TestCase):
"""
when left associativity
"""
reader = ANTLRStringStream("X3 when X4 when X2 $")
reader = InputStream("X3 when X4 when X2 $")
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(self.err_rep)
......@@ -222,7 +222,7 @@ class TestExpressionAnalyzer(unittest.TestCase):
"""
priority of when over default
"""
reader = ANTLRStringStream("(X1 default X3 when X4)$")
reader = InputStream("(X1 default X3 when X4)$")
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(self.err_rep)
......@@ -241,7 +241,7 @@ class TestExpressionAnalyzer(unittest.TestCase):
"""
void string : default value True
"""
reader = ANTLRStringStream(" $")
reader = InputStream(" $")
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(self.err_rep)
......@@ -266,7 +266,7 @@ class TestExpressionAnalyzer(unittest.TestCase):
"""
boolean operator precedence on when operators
"""
reader = ANTLRStringStream("X3 when X4 or X2 $")
reader = InputStream("X3 when X4 or X2 $")
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(self.err_rep)
......@@ -294,7 +294,7 @@ class TestExpressionAnalyzer(unittest.TestCase):
('S2', False, 'state', 1, -1)
"""
reader = ANTLRStringStream("X3 default (S3 or S2) $")
reader = InputStream("X3 default (S3 or S2) $")
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(self.err_rep)
......@@ -325,7 +325,7 @@ class TestExpressionAnalyzer(unittest.TestCase):
('X2', False, 'input', 1, -1)
"""
reader = ANTLRStringStream("X3 when (S3 or X2) $")
reader = InputStream("X3 when (S3 or X2) $")
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(self.err_rep)
......
......@@ -41,7 +41,7 @@
"""
Utilities for compiling conditions, event and constraints
"""
from antlr3 import ANTLRStringStream, CommonTokenStream, RecognitionException
from antlr4 import InputStream, CommonTokenStream, RecognitionException
from cadbiom.models.biosignal.translators.sigexpr_lexer import sigexpr_lexer
from cadbiom.models.biosignal.translators.sigexpr_compiler import sigexpr_compiler
......@@ -67,7 +67,7 @@ def compile_cond(text, symb_table, error_reporter, deep=-1, message=""):
@return: a tree representing the expression
"""
text_c = text + " $"
reader = ANTLRStringStream(text_c)
reader = InputStream(text_c)
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.deep = deep
......@@ -98,7 +98,7 @@ def compile_constraint(const_txt, symb_table, error_reporter):
@return: a tree representing the expression
"""
text_c = const_txt + " $"
reader = ANTLRStringStream(text_c)
reader = InputStream(text_c)
lexer = sigexpr_lexer(reader)
parser = sigexpr_compiler(CommonTokenStream(lexer))
parser.set_error_reporter(error_reporter)
......@@ -124,7 +124,7 @@ def compile_event(text, symb_table, free_clocks, error_reporter):
fc is the free clocks used in the event expression.
"""
text_c = text + " $"
reader = ANTLRStringStream(text_c)
reader = InputStream(text_c)
lexer = sigexpr_lexer(reader)
# default options on compiler (state_only = False)
parser = sigexpr_compiler(CommonTokenStream(lexer))
......
......@@ -179,7 +179,7 @@ sq_frontier_solutions(self, query, max_step, max_sol):
"""
from __future__ import print_function
from antlr3 import ANTLRFileStream, CommonTokenStream
from antlr4 import FileStream, CommonTokenStream
from cadbiom.models.guard_transitions.translators.chart_xml import \
MakeModelFromXmlFile
......@@ -321,7 +321,7 @@ class MCLAnalyser(object):
@param file_name: str - path of .cal file
"""
creporter = self.reporter
fstream = ANTLRFileStream(file_name)
fstream = FileStream(file_name)
lexer = cadlangLexer(fstream)
lexer.set_error_reporter(creporter)
parser = cadlangParser(CommonTokenStream(lexer))
......
......@@ -51,7 +51,7 @@ import unittest
import sys
import pkg_resources
from antlr3 import ANTLRFileStream, CommonTokenStream
from antlr4 import FileStream, CommonTokenStream
from cadbiom.models.guard_transitions.translators.chart_xml_pid import MakeModelFromPidFile
from cadbiom.models.guard_transitions.translators.chart_lang import LangVisitor
......@@ -95,7 +95,7 @@ class TestExtractVisitors(unittest.TestCase):
"""
file_name = 'translators/tests/ext1.cal'
reporter = Reporter()
readf = ANTLRFileStream(file_name)
readf = FileStream(file_name)
lexer = cadlangLexer(readf)
lexer.set_error_reporter(reporter)
parser = cadlangParser(CommonTokenStream(lexer))
......
......@@ -48,7 +48,7 @@ from collections import OrderedDict, Counter
import json
# Custom imports
from antlr3 import ANTLRFileStream, CommonTokenStream
from antlr4 import FileStream, CommonTokenStream
from cadbiom.models.biosignal.translators.gt_visitors import compile_cond, compile_event
from cadbiom.models.guard_transitions.translators.cadlangLexer import cadlangLexer
from cadbiom.models.guard_transitions.translators.cadlangParser import cadlangParser
......@@ -85,7 +85,7 @@ class StaticAnalyzer(object):
"""
crep = self.reporter
fstream = ANTLRFileStream(file_name)
fstream = FileStream(file_name)
lexer = cadlangLexer(fstream)
lexer.set_error_reporter(crep)
parser = cadlangParser(CommonTokenStream(lexer))
......
......@@ -68,7 +68,7 @@ from __future__ import print_function
from math import sqrt
from collections import defaultdict
import itertools as it
from antlr3 import ANTLRStringStream, ANTLRFileStream, CommonTokenStream
from antlr4 import InputStream, FileStream, CommonTokenStream
from condexpLexer import condexpLexer
from condexpParser import condexpParser
......@@ -221,7 +221,7 @@ class ChartModel(object):
@param file_name: str - path of .cal file
"""
crep = reporter
fstream = ANTLRFileStream(file_name)
fstream = FileStream(file_name)
lexer = cadlangLexer(fstream)
lexer.set_error_reporter(crep)
parser = cadlangParser(CommonTokenStream(lexer))
......@@ -2061,7 +2061,7 @@ class CTransition(object):
if not self.condition:
return set()
text_c = self.condition + "$"
reader = ANTLRStringStream(text_c)
reader = InputStream(text_c)
lexer = condexpLexer(reader)
parser = condexpParser(CommonTokenStream(lexer))
try:
......
......@@ -46,7 +46,7 @@ from __future__ import print_function
import sys
import unittest
import pkg_resources
from antlr3 import ANTLRFileStream, CommonTokenStream
from antlr4 import FileStream, CommonTokenStream
from cadbiom.models.guard_transitions.translators.cadlangLexer import cadlangLexer
from cadbiom.models.guard_transitions.translators.cadlangParser import cadlangParser
......@@ -77,7 +77,7 @@ class CadlangTest(unittest.TestCase):
__name__, # package name
"tests/test1.cal"
)
r = ANTLRFileStream(filename)
r = FileStream(filename)
lexer = cadlangLexer(r)
lexer.set_error_reporter(err)
parser = cadlangParser(CommonTokenStream(lexer))
......@@ -99,7 +99,7 @@ class CadlangTest(unittest.TestCase):
__name__, # package name
"tests/testPID3.cal"
)
r = ANTLRFileStream(filename)
r = FileStream(filename)
lexer = cadlangLexer(r)
lexer.set_error_reporter(err)
parser = cadlangParser(CommonTokenStream(lexer))
......@@ -121,7 +121,7 @@ class CadlangTest(unittest.TestCase):
__name__, # package name
"tests/testclock1.cal"
)
r = ANTLRFileStream(filename)
r = FileStream(filename)
lexer = cadlangLexer(r)
lexer.set_error_reporter(err)
parser = cadlangParser(CommonTokenStream(lexer))
......@@ -143,7 +143,7 @@ class CadlangTest(unittest.TestCase):
__name__, # package name
"tests/testconst1.cal"
)
r = ANTLRFileStream(filename)
r = FileStream(filename)
lexer = cadlangLexer(r)
lexer.set_error_reporter(err)
parser = cadlangParser(CommonTokenStream(lexer))
......
......@@ -46,7 +46,7 @@ from __future__ import print_function
import sys
import unittest
import pkg_resources
from antlr3 import ANTLRFileStream, CommonTokenStream
from antlr4 import FileStream, CommonTokenStream
from cadbiom.models.guard_transitions.translators.pintlangLexer import pintlangLexer
from cadbiom.models.guard_transitions.translators.pintlangParser import pintlangParser
......@@ -76,7 +76,7 @@ class PintlangTest(unittest.TestCase):
__name__, # package name
"tests/test1.ph"
)
r = ANTLRFileStream(filename)
r = FileStream(filename)
lexer = pintlangLexer(r)
lexer.set_error_reporter(err)
parser = pintlangParser(CommonTokenStream(lexer))
......@@ -97,7 +97,7 @@ class PintlangTest(unittest.TestCase):
__name__, # package name
"tests/test2.ph"
)
r = ANTLRFileStream(filename)
r = FileStream(filename)
lexer = pintlangLexer(r)
lexer.set_error_reporter(err)
parser = pintlangParser(CommonTokenStream(lexer))
......@@ -118,7 +118,7 @@ class PintlangTest(unittest.TestCase):
__name__, # package name
"tests/test3.ph"
)
r = ANTLRFileStream(filename)
r = FileStream(filename)
lexer = pintlangLexer(r)
lexer.set_error_reporter(err)
parser = pintlangParser(CommonTokenStream(lexer))
......
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