From 59f0261dba993a5d632ce6e9963270a582d162e6 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Sat, 9 Apr 2016 18:56:13 -0700 Subject: enhance fish_indent to normalize keywords Fish keywords can be quoted and split across lines. Prior to this change `fish_indent` would retain such odd, obfuscated, formatting. This change results in all keywords being converted to their canonical form. This required fixing a bug: the keyword member of parse_node_t wasn't being populated. This hadn't been noticed prior to now because it wasn't used. Fixes #2921 --- src/parse_constants.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/parse_constants.h') diff --git a/src/parse_constants.h b/src/parse_constants.h index 03dffd28..4668516b 100644 --- a/src/parse_constants.h +++ b/src/parse_constants.h @@ -73,6 +73,7 @@ enum parse_token_type_t parse_special_type_parse_error, parse_special_type_tokenizer_error, parse_special_type_comment, + LAST_TOKEN_TYPE = parse_special_type_comment, FIRST_TERMINAL_TYPE = parse_token_type_string, LAST_TERMINAL_TYPE = parse_token_type_terminate, @@ -85,7 +86,11 @@ enum parse_token_type_t // Array of strings corresponding to the enums above instantiated in parse_tree.cpp. extern const wchar_t * const parser_token_types[]; -/* These must be maintained in sorted order (except for none, which isn't a keyword). This enables us to do binary search. */ +// These must be maintained in sorted order (except for none, which isn't a keyword). This enables +// us to do binary search. +// +// IMPORTANT: If the following enum is modified you must update the corresponding keyword_map array +// in parse_tree.cpp. enum parse_keyword_t { parse_keyword_none, -- cgit v1.2.3