Lots of work on the lua read-eval-print loop
This commit is contained in:
@@ -200,6 +200,24 @@ bool is_lua_comment(string_view s) {
|
||||
return s.substr(start, 2) == "--";
|
||||
}
|
||||
|
||||
bool is_possible_long_lua_expression(string_view s) {
|
||||
read_space(s);
|
||||
string_view id = read_lua_identifier(s);
|
||||
if (id.empty()) return false;
|
||||
if ((id == "function") || (id == "if") || (id == "while") || (id == "for") || (id == "repeat") || (id == "do")) return true;
|
||||
if (id == "local")
|
||||
{
|
||||
read_space(s);
|
||||
id = read_lua_identifier(s);
|
||||
}
|
||||
read_space(s);
|
||||
read_prefix(s, "="); // If not present, returns false but we continue anyway.
|
||||
read_space(s);
|
||||
if (has_prefix(s, "[")) return true;
|
||||
if (has_prefix(s, "(")) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_whitespace(string_view s) {
|
||||
for (int i = 0; i < int(s.size()); i++) {
|
||||
if (!ascii_isspace(s[i])) {
|
||||
|
||||
Reference in New Issue
Block a user