From 72e35af381b11fcd11648587f933ff187615d705 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Tue, 7 Jul 2020 13:48:35 -0700 Subject: [PATCH] Remove preceding_escaped_nl It's no longer necessary for fish_indent --- src/parse_tree.cpp | 1 - src/parse_tree.h | 16 ---------------- src/tokenizer.cpp | 4 ---- src/tokenizer.h | 3 --- 4 files changed, 24 deletions(-) diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index 30006bfd2..0d4876667 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -306,7 +306,6 @@ parse_token_t next_parse_token(tokenizer_t *tok, maybe_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; diff --git a/src/parse_tree.h b/src/parse_tree.h index 6df420a29..b5c5a8d0a 100644 --- a/src/parse_tree.h +++ b/src/parse_tree.h @@ -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; } diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 9ac6946cf..388fcf578 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -498,12 +498,10 @@ maybe_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 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 tokenizer_t::next() { } } assert(result.has_value() && "Should have a token"); - result->preceding_escaped_nl = preceding_escaped_nl; return result; } diff --git a/src/tokenizer.h b/src/tokenizer.h index a6e88cffb..223c01d61 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -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)};