Commit 4c671954 authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Fix string formatting for antlr...

parent f42da54e
......@@ -69,13 +69,13 @@ import string
# message of the error
error_msg = self.getErrorMessage(re, tokens_names)
self.error_reporter.display(
"RecognitionError: sig_exp -> %s; %s; %s" % (header, error_msg, self.message)
"RecognitionError: sig_exp -> {}; {}; {}".format(header, error_msg, self.message)
)
def displayExceptionMessage(self, e):
"""Display ExceptionMessage in the reporter"""
error_msg = self.getErrorMessage(self, e, tokenNames)
self.error_reporter.display("Exception: sig_exp -> %s" % error_msg)
self.error_reporter.display("Exception: sig_exp -> " + error_msg)
# semantic checks for compilers
def check_ident(self, symbol_table, st_only, free_clock, deep, message, name):
......@@ -89,18 +89,24 @@ import string
# for condition compiler
if st_only and state_type not in ("state", "input"):
self.error_reporter.display(
"Type error: '%s' has not an expected state: '%s'; %s" % (name, state_type, message)
"Type error: '{}' has not an expected state: '{}'; {}".format(
name, state_type, message
)
)
elif deep >= 0 and deepness >= deep:
self.error_reporter.display(
"Type error: '%s' not declared in a surrounding macro state; %s" % (name, message)
"Type error: '{}' not declared in a surrounding macro state; {}".format(
name, message
)
)
except KeyError:
if free_clock and not st_only:
self.free_clocks.append(name)
else:
self.error_reporter.display(
"Declaration error: Undeclared event or state: '%s'; %s" % (name, message)
"Declaration error: Undeclared event or state: '{}'; {}".format(
name, message
)
)
return SigIdentExpr(name)
......@@ -113,7 +119,7 @@ import string
state_type, _ = symbol_table[id]
except KeyError:
self.error_reporter.display(
"Declaration error: Undeclared state in variation: '%s'" % id
"Declaration error: Undeclared state in variation: '{}'".format(id)
)
state_type = None
......@@ -126,7 +132,7 @@ import string
return SigIdentExpr(name)
else:
self.error_reporter.display(
"Type error: Up and Down can only be derived from a state: '%s'" % id
"Type error: Up and Down can only be derived from a state: '{}'".format(id)
)
def check_change(self, symbol_table, id):
......@@ -135,7 +141,7 @@ import string
state_type, _ = symbol_table[id]
except KeyError:
self.error_reporter.display(
"Declaration error: Undeclared signal in variation: '%s'" % id
"Declaration error: Undeclared signal in variation: '{}'".format(id)
)
state_type = None
......@@ -145,7 +151,7 @@ import string
return SigWhenExpr(SigConstExpr(True),SigDiffExpr(st_expr, refresh_expr))
else:
self.error_reporter.display(
"Type error: Change can only be derived from a state: '%s'" % id
"Type error: Change can only be derived from a state: '{}'".format(id)
)
def check_sync(self, lexp):
......
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