summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-12 09:52:22 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-12 09:52:22 +0100
commit384ce9acc4877a8bbdbabc50ade3767ff31a8d1c (patch)
tree4bec160c388339560cbaee3754e96afa19724f98
parent8e775b6adb76bbd4f2bf844b5b119d4c869e372a (diff)
64asm: Allow characters for mangler.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--64x0-Drivers/64asm.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/64x0-Drivers/64asm.cc b/64x0-Drivers/64asm.cc
index 2c0b127..fee511d 100644
--- a/64x0-Drivers/64asm.cc
+++ b/64x0-Drivers/64asm.cc
@@ -448,15 +448,11 @@ namespace detail::algorithm
{
return !(isalpha(c) || isdigit(c) || (c == ' ') || (c == '\t') || (c == ',') ||
(c == '(') || (c == ')') || (c == '"') || (c == '\'') || (c == '[') || (c == ']')
- || (c == '+') || (c == '_'));
+ || (c == '+') || (c == '_') || (c == ':') || (c == '@') || (c == '.'));
}
bool is_valid(const std::string &str)
{
- if (ParserKit::find_word(str, "export ") ||
- ParserKit::find_word(str, "import "))
- return true;
-
return find_if(str.begin(), str.end(), is_not_alnum_space) == str.end();
}
}
@@ -483,15 +479,24 @@ static std::string masm_check_line(std::string& line, const std::string& file)
ParserKit::find_word(line, ";") ||
ParserKit::find_word(line, "layout"))
{
+
if (line.find('#') != std::string::npos)
{
line.erase(line.find('#'));
}
-
- if (line.find(';') != std::string::npos)
+ else if (line.find(';') != std::string::npos)
{
line.erase(line.find(';'));
}
+ else
+ {
+ // now check the line for validity
+ if (!detail::algorithm::is_valid(line))
+ {
+ err_str = "Line contains non alphanumeric characters.\nhere -> ";
+ err_str += line;
+ }
+ }
return err_str;
}