aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_tree.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-10-12 02:46:49 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2013-10-12 02:46:49 -0700
commitddec870d252c0ae84fd80f8b4b75d91a97e99395 (patch)
treee20e089a65768da9ebbd26405fcb1c92246206c2 /parse_tree.h
parent77e358a001eea9a36e0c466b0af253d992c370bd (diff)
Rework decision process for whether to interpret keywords as structural
or as commands (for LL parser). Will allow 'builtin --' to parse as a plain statement, instead of a decorated statement '--'
Diffstat (limited to 'parse_tree.h')
-rw-r--r--parse_tree.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/parse_tree.h b/parse_tree.h
index c46eb911..c1bcbab9 100644
--- a/parse_tree.h
+++ b/parse_tree.h
@@ -113,13 +113,20 @@ enum parse_keyword_t
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,
- parse_keyword_dashdash,
- parse_keyword_dash_h,
- parse_keyword_dashdash_help,
+ LAST_KEYWORD = parse_keyword_builtin
+};
+
+
+/** A struct representing the token type that we use internally */
+struct parse_token_t
+{
+ enum parse_token_type_t type; // The type of the token as represented by the parser
+ enum parse_keyword_t keyword; // Any keyword represented by this token
+ bool has_dash_prefix; // Hackish: whether the source contains a dash prefix
+ size_t source_start;
+ size_t source_length;
- LAST_KEYWORD = parse_keyword_dashdash_help
+ wcstring describe() const;
};