Major updates
- Improve ruby block detection heuristics - Add block information storage and block aware movements. - Other minor fixes
This commit is contained in:
@@ -33,6 +33,7 @@ struct alignas(2) RubyState {
|
||||
DEF_NAME = 0b10,
|
||||
MODULE_NAME = 0b11
|
||||
};
|
||||
static constexpr uint8_t NEWLINE = 1 << 5;
|
||||
static constexpr uint8_t ALLOW_INTERPOLATION = 1 << 6;
|
||||
static constexpr uint8_t EXPECTING_EXPRESSION = 1 << 7;
|
||||
uint8_t flags = 0;
|
||||
|
||||
@@ -11,6 +11,8 @@ struct RubyParser {
|
||||
uint32_t i = 0;
|
||||
bool heredoc_start_line = false;
|
||||
bool ending = true;
|
||||
bool op_last = false;
|
||||
bool set_op_last = false;
|
||||
|
||||
RubyParser(void **v_state, std::string_view line)
|
||||
: v_state(v_state), state((RubyState *)*v_state), line(line) {}
|
||||
@@ -58,7 +60,7 @@ struct RubyParser {
|
||||
.brace_level = 1,
|
||||
.lit_brace_level = 0,
|
||||
.state = RubyState::RubyInternalState::NONE,
|
||||
.flags = RubyState::RubyInternalState::EXPECTING_EXPRESSION,
|
||||
.flags = RubyState::RubyInternalState::EXPECTING_EXPRESSION | RubyState::RubyInternalState::NEWLINE,
|
||||
.delim_start = '\0',
|
||||
.delim_end = '\0'
|
||||
};
|
||||
|
||||
@@ -189,7 +189,6 @@ const static std::vector<std::string> methods = {
|
||||
"respond_to?",
|
||||
"equal?",
|
||||
"object_id",
|
||||
"class",
|
||||
"singleton_class",
|
||||
"clone",
|
||||
"freeze",
|
||||
|
||||
Reference in New Issue
Block a user