mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 13:45:32 +00:00
be a bit more relaxed about allowing - in names (Fixes #1593)
This commit is contained in:
parent
517b27e29a
commit
563c2e5730
2 changed files with 15 additions and 6 deletions
|
@ -343,17 +343,13 @@ namespace Compiler
|
|||
}
|
||||
else if (!(c=='"' && name.empty()))
|
||||
{
|
||||
if (!(std::isalpha (c) || std::isdigit (c) || c=='_' || c=='`' ||
|
||||
/// \todo add an option to disable the following hack. Also, find out who is
|
||||
/// responsible for allowing it in the first place and meet up with that person in
|
||||
/// a dark alley.
|
||||
(c=='-' && !name.empty() && std::isalpha (mStream.peek()))))
|
||||
if (!isStringCharacter (c))
|
||||
{
|
||||
putback (c);
|
||||
break;
|
||||
}
|
||||
|
||||
if (first && std::isdigit (c))
|
||||
if (first && (std::isdigit (c) || c=='`' || c=='-'))
|
||||
error = true;
|
||||
}
|
||||
|
||||
|
@ -499,6 +495,17 @@ namespace Compiler
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Scanner::isStringCharacter (char c, bool lookAhead)
|
||||
{
|
||||
return std::isalpha (c) || std::isdigit (c) || c=='_' ||
|
||||
/// \todo disable this when doing more stricter compiling
|
||||
c=='`' ||
|
||||
/// \todo disable this when doing more stricter compiling. Also, find out who is
|
||||
/// responsible for allowing it in the first place and meet up with that person in
|
||||
/// a dark alley.
|
||||
(c=='-' && (!lookAhead || isStringCharacter (mStream.peek(), false)));
|
||||
}
|
||||
|
||||
bool Scanner::isWhitespace (char c)
|
||||
{
|
||||
return c==' ' || c=='\t';
|
||||
|
|
|
@ -92,6 +92,8 @@ namespace Compiler
|
|||
|
||||
bool scanSpecial (char c, Parser& parser, bool& cont);
|
||||
|
||||
bool isStringCharacter (char c, bool lookAhead = true);
|
||||
|
||||
static bool isWhitespace (char c);
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in a new issue