Remove preceding_escaped_nl

It's no longer necessary for fish_indent
This commit is contained in:
ridiculousfish 2020-07-07 13:48:35 -07:00
parent 8d25ed962c
commit 72e35af381
4 changed files with 0 additions and 24 deletions

View file

@ -306,7 +306,6 @@ parse_token_t next_parse_token(tokenizer_t *tok, maybe_t<tok_t> *out_token, wcst
result.has_dash_prefix = !text.empty() && text.at(0) == L'-';
result.is_help_argument = result.has_dash_prefix && is_help_argument(text);
result.is_newline = (result.type == parse_token_type_end && text == L"\n");
result.preceding_escaped_nl = token.preceding_escaped_nl;
result.may_be_variable_assignment = variable_assignment_equals_pos(text).has_value();
result.tok_error = token.error;

View file

@ -28,7 +28,6 @@ struct parse_token_t {
bool has_dash_prefix{false}; // Hackish: whether the source contains a dash prefix
bool is_help_argument{false}; // Hackish: whether the source looks like '-h' or '--help'
bool is_newline{false}; // Hackish: if TOK_END, whether the source is a newline.
bool preceding_escaped_nl{false}; // Whether there was an escaped newline preceding this token.
bool may_be_variable_assignment{false}; // Hackish: whether this token is a string like FOO=bar
tokenizer_error_t tok_error{tokenizer_error_t::none}; // If this is a tokenizer error, that error.
source_offset_t source_start{SOURCE_OFFSET_INVALID};
@ -59,21 +58,6 @@ const wchar_t *keyword_description(parse_keyword_t type);
parse_error_code_t parse_error_from_tokenizer_error(tokenizer_error_t err);
// Node flags.
enum {
/// Flag indicating that the node has associated comment nodes.
parse_node_flag_has_comments = 1 << 0,
/// Flag indicating that the token was preceded by an escaped newline, e.g.
/// echo abc | \
/// cat
parse_node_flag_preceding_escaped_nl = 1 << 1,
};
typedef uint8_t parse_node_flags_t;
/// Node-type specific tag value.
typedef uint8_t parse_node_tag_t;
namespace ast {
class ast_t;
}

View file

@ -498,12 +498,10 @@ maybe_t<tok_t> tokenizer_t::next() {
// Consume non-newline whitespace. If we get an escaped newline, mark it and continue past
// it.
bool preceding_escaped_nl = false;
for (;;) {
if (this->token_cursor[0] == L'\\' && this->token_cursor[1] == L'\n') {
this->token_cursor += 2;
this->continue_line_after_comment = true;
preceding_escaped_nl = true;
} else if (iswspace_not_nl(this->token_cursor[0])) {
this->token_cursor++;
} else {
@ -527,7 +525,6 @@ maybe_t<tok_t> tokenizer_t::next() {
tok_t result(token_type_t::comment);
result.offset = comment_start - this->start;
result.length = comment_len;
result.preceding_escaped_nl = preceding_escaped_nl;
return result;
}
while (iswspace_not_nl(this->token_cursor[0])) this->token_cursor++;
@ -651,7 +648,6 @@ maybe_t<tok_t> tokenizer_t::next() {
}
}
assert(result.has_value() && "Should have a token");
result->preceding_escaped_nl = preceding_escaped_nl;
return result;
}

View file

@ -71,9 +71,6 @@ struct tok_t {
// If an error, this is the error code.
tokenizer_error_t error{tokenizer_error_t::none};
// Whether the token was preceded by an escaped newline.
bool preceding_escaped_nl{false};
// If an error, this is the offset of the error within the token. A value of 0 means it occurred
// at 'offset'.
size_t error_offset_within_token{size_t(-1)};