diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2013-10-09 15:57:10 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2013-10-09 20:37:07 -0700 |
commit | 58447c147f20d55555ed4035e3add1ccafec2998 (patch) | |
tree | 2a6ba8a69b73e8e393bbe683a14b915a18e4d37f /parse_tree.h | |
parent | e763345f25f1ddc6b4f149da12fe947a9c2c8a71 (diff) |
Make the new parser LL(2). Support for correct handling of e.g. 'command
--help'
Diffstat (limited to 'parse_tree.h')
-rw-r--r-- | parse_tree.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/parse_tree.h b/parse_tree.h index b83e47ab..941ddd4e 100644 --- a/parse_tree.h +++ b/parse_tree.h @@ -112,8 +112,12 @@ enum parse_keyword_t parse_keyword_not, parse_keyword_command, parse_keyword_builtin, + + /* The following are not really keywords but are necessary for e.g. "command --help" to work */ + parse_keyword_dash_h, + parse_keyword_dashdash_help, - LAST_KEYWORD = parse_keyword_builtin + LAST_KEYWORD = parse_keyword_dashdash_help }; @@ -243,7 +247,12 @@ public: bool argument_list_is_root(const parse_node_t &node) const; /* Utilities */ + + /* Given a plain statement, get the decoration (from the parent node), or none if there is no decoration */ enum parse_statement_decoration_t decoration_for_plain_statement(const parse_node_t &node) const; + + /* Given a plain statement, get the command by reference (from the child node). Returns true if successful. Clears the command on failure. */ + bool command_for_plain_statement(const parse_node_t &node, const wcstring &src, wcstring *out_cmd) const; }; |