diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2014-03-30 21:58:32 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2014-03-30 21:58:32 -0700 |
commit | 28fd1a4c5dd27b3438d095435eec1d5ffb24491c (patch) | |
tree | 227fd34177b4dc97ccb144b8dd131ffde0eda24c /highlight.cpp | |
parent | bd895aa76c318ab3bc1b2d7d43d05fd7a2ccdf84 (diff) | |
parent | 1177daecded5b8dac03097801d4d6111330e1cff (diff) |
Merge branch 'master' of github.com:fish-shell/fish-shell
Diffstat (limited to 'highlight.cpp')
-rw-r--r-- | highlight.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/highlight.cpp b/highlight.cpp index 75dc7cb7..73b5f193 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -961,7 +961,7 @@ public: void highlighter_t::color_node(const parse_node_t &node, highlight_spec_t color) { // Can only color nodes with valid source ranges - if (! node.has_source()) + if (! node.has_source() || node.source_length == 0) return; // Fill the color array with our color in the corresponding range @@ -1332,7 +1332,6 @@ const highlighter_t::color_array_t & highlighter_t::highlight() case symbol_if_clause: case symbol_else_clause: case symbol_case_item: - case symbol_switch_statement: case symbol_boolean_statement: case symbol_decorated_statement: case symbol_if_statement: @@ -1341,6 +1340,15 @@ const highlighter_t::color_array_t & highlighter_t::highlight() } break; + case symbol_switch_statement: + { + const parse_node_t *literal_switch = this->parse_tree.get_child(node, 0, parse_token_type_string); + const parse_node_t *switch_arg = this->parse_tree.get_child(node, 1, symbol_argument); + this->color_node(*literal_switch, highlight_spec_command); + this->color_node(*switch_arg, highlight_spec_param); + } + break; + case symbol_for_header: { // Color the 'for' and 'in' as commands @@ -1357,6 +1365,7 @@ const highlighter_t::color_array_t & highlighter_t::highlight() case parse_token_type_background: case parse_token_type_end: + case symbol_optional_background: { this->color_node(node, highlight_spec_statement_terminator); } |