aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parse_tree.cpp
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-04-09 18:56:13 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-04-10 18:40:11 -0700
commit59f0261dba993a5d632ce6e9963270a582d162e6 (patch)
treeebc0be44c6259fc090c2612703f7e66366cc0ef3 /src/parse_tree.cpp
parent7ad6a90ea2e75388d42b5b223d9273119994037e (diff)
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
Diffstat (limited to 'src/parse_tree.cpp')
-rw-r--r--src/parse_tree.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp
index ca6e310b..adb2984f 100644
--- a/src/parse_tree.cpp
+++ b/src/parse_tree.cpp
@@ -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;
}