diff options
author | 2013-10-09 15:57:10 -0700 | |
---|---|---|
committer | 2013-10-09 20:37:07 -0700 | |
commit | 58447c147f20d55555ed4035e3add1ccafec2998 (patch) | |
tree | 2a6ba8a69b73e8e393bbe683a14b915a18e4d37f /highlight.cpp | |
parent | e763345f25f1ddc6b4f149da12fe947a9c2c8a71 (diff) |
Make the new parser LL(2). Support for correct handling of e.g. 'command
--help'
Diffstat (limited to 'highlight.cpp')
-rw-r--r-- | highlight.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/highlight.cpp b/highlight.cpp index 8fe9989b..ffd5953c 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -337,12 +337,10 @@ bool plain_statement_get_expanded_command(const wcstring &src, const parse_node_ assert(plain_statement.type == symbol_plain_statement); bool result = false; - // Get the command - const parse_node_t *cmd_node = tree.get_child(plain_statement, 0, parse_token_type_string); - if (cmd_node != NULL && cmd_node->has_source()) + /* Get the command */ + wcstring cmd; + if (tree.command_for_plain_statement(plain_statement, src, &cmd)) { - wcstring cmd(src, cmd_node->source_start, cmd_node->source_length); - /* Try expanding it. If we cannot, it's an error. */ if (expand_one(cmd, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES | EXPAND_SKIP_JOBS)) { |