mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Remove 255-character limit on symbol names
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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)!
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
SECTION "Test", ROM0
|
||||
|
||||
MACRO a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
|
||||
println "truncated :("
|
||||
ENDM
|
||||
|
||||
a012:
|
||||
a012.local
|
||||
|
||||
a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012:
|
||||
a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012.local
|
||||
@@ -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)!
|
||||
@@ -1 +0,0 @@
|
||||
truncated :(
|
||||
@@ -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)!
|
||||
@@ -1 +1 @@
|
||||
000000042
|
||||
00000002a
|
||||
|
||||
15
test/asm/long-local.asm
Normal file
15
test/asm/long-local.asm
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user