numeric literal fix
This commit is contained in:
parent
be0c8590bf
commit
ea2b77b323
@ -1,8 +1,13 @@
|
|||||||
function submit(text)
|
function setup_variables()
|
||||||
local x,y,z = player.get_pos(0)
|
local x,y,z = player.get_pos(0)
|
||||||
console.set('pos.x', x)
|
console.set('pos.x', x)
|
||||||
console.set('pos.y', y)
|
console.set('pos.y', y)
|
||||||
console.set('pos.z', z)
|
console.set('pos.z', z)
|
||||||
|
end
|
||||||
|
|
||||||
|
function submit(text)
|
||||||
|
setup_variables()
|
||||||
|
|
||||||
local status, result = pcall(function() return console.execute(text) end)
|
local status, result = pcall(function() return console.execute(text) end)
|
||||||
if result ~= nil then
|
if result ~= nil then
|
||||||
document.log.text = document.log.text..tostring(result)..'\n'
|
document.log.text = document.log.text..tostring(result)..'\n'
|
||||||
|
|||||||
@ -31,11 +31,11 @@ inline bool is_whitespace(int c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_identifier_start(int c) {
|
inline bool is_identifier_start(int c) {
|
||||||
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_' || c == '-' || c == '.';
|
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_' || c == '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_identifier_part(int c) {
|
inline bool is_identifier_part(int c) {
|
||||||
return is_identifier_start(c) || is_digit(c);
|
return is_identifier_start(c) || is_digit(c) || c == '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int hexchar2int(int c) {
|
inline int hexchar2int(int c) {
|
||||||
|
|||||||
@ -13,7 +13,7 @@ inline bool is_cmd_identifier_part(char c, bool allowColon) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_cmd_identifier_start(char c) {
|
inline bool is_cmd_identifier_start(char c) {
|
||||||
return is_identifier_start(c) || c == '.' || c == '$';
|
return (is_identifier_start(c) || c == '.' || c == '$');
|
||||||
}
|
}
|
||||||
|
|
||||||
class CommandParser : BasicParser {
|
class CommandParser : BasicParser {
|
||||||
@ -75,9 +75,13 @@ public:
|
|||||||
nextChar();
|
nextChar();
|
||||||
return parseString(c);
|
return parseString(c);
|
||||||
}
|
}
|
||||||
if (c == '+' || c == '-' || is_digit(c)) {
|
if (c == '+' || c == '-') {
|
||||||
|
nextChar();
|
||||||
return parseNumber(c == '-' ? -1 : 1);
|
return parseNumber(c == '-' ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
if (is_digit(c)) {
|
||||||
|
return parseNumber(1);
|
||||||
|
}
|
||||||
throw error("invalid character '"+std::string({c})+"'");
|
throw error("invalid character '"+std::string({c})+"'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user