From ebf31b39e50d5536c52d19b4bcd14da625bb8cdb Mon Sep 17 00:00:00 2001 From: rocky Date: Wed, 11 Dec 2024 14:21:27 -0500 Subject: [PATCH] Sort error message strings and add stresc Also, in the scanner "sntooct{1,2} do not provide a file/line combination --- mathics/builtin/messages.py | 17 +++++++++-------- mathics/core/evaluation.py | 3 +-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mathics/builtin/messages.py b/mathics/builtin/messages.py index 75996aebf..ed0ea48cb 100644 --- a/mathics/builtin/messages.py +++ b/mathics/builtin/messages.py @@ -582,16 +582,17 @@ class Syntax(Builtin): # Extension: WMA does not provide lineno and filename in its error messages messages = { - "snthex": r"4 hexadecimal digits are required after \: to construct a 16-bit character (line `4` of `5`).", - "sntoct1": r"3 octal digits are required after \ to construct an 8-bit character (line `4` of `5`).", - "sntoct2": r"2 hexadecimal digits are required after \. to construct an 8-bit character (line `4` of `5`).", - "sntxi": "Incomplete expression; more input is needed (line `4` of `5`).", - "sntxb": "Expression cannot begin with `1` (line `4` of `5`).", - "sntxf": "`1` cannot be followed by `2` (line `4` of `5`).", - "bktwrn": "`1` represents multiplication; use `2` to represent a function (line `4` of `5`).", # TODO "bktmch": "`1` must be followed by `2`, not `3` (line `4` of `5`).", + "bktwrn": "`1` represents multiplication; use `2` to represent a function (line `4` of `5`).", # TODO + "com": "Warning: comma encountered with no adjacent expression. The expression will be treated as Null (line `4` of `5`).", + "snthex": r"4 hexadecimal digits are required after \: to construct a 16-bit character (line `4` of `5`).", + "sntoct1": r"3 octal digits are required after \ to construct an 8-bit character.", + "sntoct2": r"2 hexadecimal digits are required after \. to construct an 8-bit character.", "sntue": "Unexpected end of file; probably unfinished expression (line `4` of `5`).", "sntufn": "Unknown unicode longname `1` (line `4` of `5`).", - "com": "Warning: comma encountered with no adjacent expression. The expression will be treated as Null (line `4` of `5`).", + "sntxb": "Expression cannot begin with `1` (line `4` of `5`).", + "sntxf": "`1` cannot be followed by `2` (line `4` of `5`).", + "sntxi": "Incomplete expression; more input is needed (line `4` of `5`).", + "stresc": "Unknown string escape `1`", } summary_text = "syntax messages" diff --git a/mathics/core/evaluation.py b/mathics/core/evaluation.py index d3920b06b..cf550ccf1 100644 --- a/mathics/core/evaluation.py +++ b/mathics/core/evaluation.py @@ -401,8 +401,7 @@ def get_quiet_messages(self): def message(self, symbol_name: str, tag, *msgs) -> Optional["Message"]: """ - Format message given its components, ``symbol``, ``tag`` - + Format message given its components, ``symbol_name``, ``tag`` """ from mathics.core.expression import Expression