diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2013-10-12 18:17:03 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2013-10-12 18:17:03 -0700 |
commit | ddf98661e4f16f75bb3deea26ec0c1e3bc651263 (patch) | |
tree | d811a53831ba23bfb81254d61798ba459f93357c /parse_tree.h | |
parent | cbd8a27a6d1ec705032486851203f8c4d1b4f56f (diff) |
Adopt new parser in tab completions
Diffstat (limited to 'parse_tree.h')
-rw-r--r-- | parse_tree.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/parse_tree.h b/parse_tree.h index c1bcbab9..62ffb622 100644 --- a/parse_tree.h +++ b/parse_tree.h @@ -224,6 +224,12 @@ public: else return wcstring(str, this->source_start, this->source_length); } + + /* Returns whether the given location is within the source range or at its end */ + bool location_in_or_at_end_of_source_range(size_t loc) const + { + return has_source() && source_start <= loc && loc - source_start <= source_length; + } }; /* Statement decorations. This matches the order of productions in decorated_statement */ @@ -254,6 +260,9 @@ public: /* Finds the last node of a given type underneath a given node, or NULL if it could not be found. If parent is NULL, this finds the last node in the tree of that type. */ const parse_node_t *find_last_node_of_type(parse_token_type_t type, const parse_node_t *parent = NULL) const; + /* Finds a node containing the given source location */ + const parse_node_t *find_node_matching_source_location(parse_token_type_t type, size_t source_loc, const parse_node_t *parent) const; + /* Indicate if the given argument_list or arguments_or_redirections_list is a root list, or has a parent */ bool argument_list_is_root(const parse_node_t &node) const; |