Allow newline and comma characters in strings
MODIFY
src/assembler.cpp
src/assembler.cpp
@@ -638,9 +638,12 @@ void Assembler::assembleAssemblerDirective(const QStringList& fields) {
QString string;
// Merge input fields
for (int i = 1; i < fields.length(); i++) {
- string += fields[i];
+ QString strarg = fields[i];
+ strarg.replace("\\n","\n");
+ string += strarg;
}
string.remove('\"');
+ string.append('\0');
byteArray = string.toUtf8();
} else if (DataAssemblerDirectives.contains(fields[0])) {
assembleWords(fields, byteArray, DataAssemblerSizes.value(fields[0]));

MODIFY
src/defines.h
src/defines.h
@@ -143,6 +143,6 @@ typedef struct {
uint32_t word = 0;
} Instruction;
-const static auto splitter = QRegularExpression(R"((\,|\t|\(|\)))");
+const static auto splitter = QRegularExpression(R"((\t|\(|\)))");
#endif // DEFINES_H

MODIFY
src/lexerutilities.h
src/lexerutilities.h
#include <QStringList>
static QStringList splitQuotes(const QStringList& list) {
- // Manual string splitter - splits at "\ " (space) characters, unless test is delimitered by "\""
+ // Manual string splitter - splits at ' ' (space) and ',' (comma) characters, unless test is delimitered by quotes
QStringList ret;
for (const auto& s : list) {
QString outString;
bool inQuote = false;
for (int i = 0; i < s.length(); i++) {
inQuote ^= s[i] == '"';
- if (s[i] == ' ' && !inQuote) {
+ if ((s[i] == ' ' || s[i] == ',') && !inQuote) {
ret.append(outString);
outString.clear();
} else {

Allow newline and comma characters in strings