diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index 143020f6..67501c55 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -94,9 +94,6 @@ } while (0) #endif // !( defined(_MSC_VER) || defined(__MINGW32__) ) -// FIXME: get rid of this limitation -#define MAXSYMLEN 255 - // Bison 3.6 changed token "types" to "kinds"; cast to int for simple compatibility #define T_(name) (int)yy::parser::token::name @@ -565,11 +562,6 @@ static uint32_t readBracketedMacroArgNum() { shiftChar(); } - if (symName.length() > MAXSYMLEN) { - warning(WARNING_LONG_STR, "Bracketed symbol name too long, got truncated\n"); - symName.resize(MAXSYMLEN); - } - Symbol const *sym = sym_FindScopedValidSymbol(symName.c_str()); if (!sym) { @@ -1130,20 +1122,15 @@ static bool continuesIdentifier(int c) { static Token readIdentifier(char firstChar) { // Lex while checking for a keyword - std::string yylval(1, firstChar); + std::string identifier(1, firstChar); int tokenType = firstChar == '.' ? T_(LOCAL_ID) : T_(ID); // Continue reading while the char is in the symbol charset for (int c = peek(); continuesIdentifier(c); c = peek()) { shiftChar(); - if (yylval.length() == MAXSYMLEN) { - warning(WARNING_LONG_STR, "Symbol name too long, got truncated\n"); - break; - } - // Write the char to the identifier's name - yylval += c; + identifier += c; // If the char was a dot, mark the identifier as local if (c == '.') @@ -1151,8 +1138,8 @@ static Token readIdentifier(char firstChar) { } // Attempt to check for a keyword - auto search = keywordDict.find(yylval.c_str()); - return search != keywordDict.end() ? Token(search->second) : Token(tokenType, yylval); + auto search = keywordDict.find(identifier.c_str()); + return search != keywordDict.end() ? Token(search->second) : Token(tokenType, identifier); } // Functions to read strings @@ -1188,10 +1175,6 @@ static char const *readInterpolation(size_t depth) { break; } else if (c == ':' && !fmt.isFinished()) { // Format spec, only once shiftChar(); - if (fmtBuf.length() > MAXSTRLEN) { - warning(WARNING_LONG_STR, "Format spec too long, got truncated\n"); - fmtBuf.resize(MAXSTRLEN); - } for (char f : fmtBuf) fmt.useCharacter(f); fmt.finishCharacters(); @@ -1204,11 +1187,6 @@ static char const *readInterpolation(size_t depth) { } } - if (fmtBuf.length() > MAXSYMLEN) { - warning(WARNING_LONG_STR, "Interpolated symbol name too long, got truncated\n"); - fmtBuf.resize(MAXSYMLEN); - } - // Don't return before `lexerState->disableInterpolation` is reset! lexerState->disableInterpolation = disableInterpolation; diff --git a/test/asm/bracketed-macro-args.err b/test/asm/bracketed-macro-args.err index dc451831..f080ed30 100644 --- a/test/asm/bracketed-macro-args.err +++ b/test/asm/bracketed-macro-args.err @@ -8,8 +8,6 @@ error: bracketed-macro-args.asm(33) -> bracketed-macro-args.asm::bad(29): Macro argument '\<2>' not defined error: bracketed-macro-args.asm(33) -> bracketed-macro-args.asm::bad(30): Macro argument '\<2>' not defined -warning: bracketed-macro-args.asm(39) -> bracketed-macro-args.asm::toolong(36): [-Wlong-string] - Bracketed symbol name too long, got truncated error: bracketed-macro-args.asm(39) -> bracketed-macro-args.asm::toolong(36): - Bracketed symbol "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu" does not exist + Bracketed symbol "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" does not exist error: Assembly aborted (6 errors)! diff --git a/test/asm/local-truncated.asm b/test/asm/local-truncated.asm deleted file mode 100644 index 8b842f3c..00000000 --- a/test/asm/local-truncated.asm +++ /dev/null @@ -1,11 +0,0 @@ -SECTION "Test", ROM0 - -MACRO a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 - println "truncated :(" -ENDM - -a012: - a012.local - -a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012: - a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012.local diff --git a/test/asm/local-truncated.err b/test/asm/local-truncated.err deleted file mode 100644 index 5bf5d0f2..00000000 --- a/test/asm/local-truncated.err +++ /dev/null @@ -1,7 +0,0 @@ -warning: local-truncated.asm(10): [-Wlong-string] - Symbol name too long, got truncated -error: local-truncated.asm(10): - 'a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001' already defined at local-truncated.asm(3) -warning: local-truncated.asm(11): [-Wlong-string] - Symbol name too long, got truncated -error: Assembly aborted (1 error)! diff --git a/test/asm/local-truncated.out b/test/asm/local-truncated.out deleted file mode 100644 index 2044da52..00000000 --- a/test/asm/local-truncated.out +++ /dev/null @@ -1 +0,0 @@ -truncated :( diff --git a/test/asm/long-format-spec.err b/test/asm/long-format-spec.err deleted file mode 100644 index 7f3adc8a..00000000 --- a/test/asm/long-format-spec.err +++ /dev/null @@ -1,5 +0,0 @@ -warning: long-format-spec.asm(3): [-Wlong-string] - Format spec too long, got truncated -error: long-format-spec.asm(3): - Invalid format spec '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009' -error: Assembly aborted (1 error)! diff --git a/test/asm/long-format-spec.out b/test/asm/long-format-spec.out index 595d3c17..2321edfb 100644 --- a/test/asm/long-format-spec.out +++ b/test/asm/long-format-spec.out @@ -1 +1 @@ -000000042 +00000002a diff --git a/test/asm/long-local.asm b/test/asm/long-local.asm new file mode 100644 index 00000000..9e11089c --- /dev/null +++ b/test/asm/long-local.asm @@ -0,0 +1,15 @@ +SECTION "Test", ROM0 + +a012: + a012.local + +assert DEF(a012) +assert DEF(a012.local) + +; Symbol names can be arbitrarily long! + +a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012: + a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012.local000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034 + +assert DEF(a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012) +assert DEF(a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012.local000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034)