mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
fixed parsing of "x.0.y", the second dot was seen as a decimal point.
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1058 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -204,7 +204,7 @@ void TokenIterator::readToken() {
|
||||
filename = include_file;
|
||||
InputStreamP is = package_manager.openFileFromPackage(package, include_file);
|
||||
input = read_utf8_line(*is, true, true);
|
||||
} else if (isAlpha(c) || c == _('_')) {
|
||||
} else if (isAlpha(c) || c == _('_') || (isDigit(c) && !buffer.empty() && buffer.back() == _("."))) {
|
||||
// name
|
||||
size_t start = pos - 1;
|
||||
while (pos < input.size() && isAlnum_(input.GetChar(pos))) ++pos;
|
||||
@@ -672,8 +672,11 @@ void parseOper(TokenIterator& input, Script& script, Precedence minPrec, Instruc
|
||||
else if (minPrec <= PREC_MUL && token==_("mod")) parseOper(input, script, PREC_POW, I_BINARY, I_MOD);
|
||||
else if (minPrec <= PREC_POW && token==_("^")) parseOper(input, script, PREC_POW, I_BINARY, I_POW);
|
||||
else if (minPrec <= PREC_FUN && token==_(".")) { // get member by name
|
||||
input.peek(1); // peek ahead, so the next token can see the preceding "."
|
||||
// that forces the next token to always be a TOK_NAME instead of TOK_INT/TOK_DOUBLE
|
||||
// (this is a bit of a hack)
|
||||
const Token& token = input.read();
|
||||
if (token == TOK_NAME || token == TOK_INT || token == TOK_DOUBLE || token == TOK_STRING) {
|
||||
if (token == TOK_NAME || token == TOK_STRING) {
|
||||
script.addInstruction(I_MEMBER_C, token.value);
|
||||
} else {
|
||||
input.expected(_("name"));
|
||||
|
||||
Reference in New Issue
Block a user