HTTP stuff now uses keyword parser.

This commit is contained in:
2022-07-22 17:07:40 -04:00
parent 28ec61e47c
commit a5ef765524
6 changed files with 135 additions and 101 deletions

View File

@@ -531,14 +531,15 @@ class LuaKeywordParser {
};
};
private:
bool not_table_;
lua_State *L_;
int slot_;
eng::set<const char *, cmp_char> parsed_;
void init(const lua_State *L, int slot);
public:
// The constructor will throw a lua error if the
// slot is not a table.
// If the slot is not a table, sets the not_table
// flag and creates a dummy table in the slot.
LuaKeywordParser(lua_State *L, int slot);
LuaKeywordParser(const LuaStack &LS, LuaSlot slot) : LuaKeywordParser(LS.state(), slot.index()) {}
@@ -546,9 +547,12 @@ public:
// Return true if the value is non-nil.
bool parse(LuaSlot slot, const char *kw);
// Check if there are any keywords in the table that
// were never parsed. If so, throw an error.
void check_unparsed_keywords();
// Check if there were any errors. If so, return an
// error message.
eng::string final_check();
// Check if there are any errors. If so, throw a lua error.
void final_check_throw();
// Fetch the state pointer.
lua_State *state() const { return L_; }