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
This commit is contained in:
Kurtis Rader
2016-04-09 18:56:13 -07:00
parent 7ad6a90ea2
commit 59f0261dba
5 changed files with 45 additions and 7 deletions

View File

@@ -1078,9 +1078,11 @@ bool parse_ll_t::top_node_handle_terminal_types(parse_token_t token)
if (matched)
{
// Success. Tell the node that it matched this token, and what its source range is
// In the parse phase, we only set source ranges for terminal types. We propagate ranges to parent nodes afterwards.
// Success. Tell the node that it matched this token, and what its source range is in
// the parse phase, we only set source ranges for terminal types. We propagate ranges to
// parent nodes afterwards.
parse_node_t &node = node_for_top_symbol();
node.keyword = token.keyword;
node.source_start = token.source_start;
node.source_length = token.source_length;
}