aboutsummaryrefslogtreecommitdiff
path: root/build2/parser
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-10-19 15:01:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:30 +0200
commit56eb8c36b5b408e08760fa18cf893e5e8a613b7a (patch)
treef55960286ec185f6e3679cf9661b27c53a53c39f /build2/parser
parent93f38c7b1e4bf3c7bf14af6785146c81614cbac5 (diff)
Implement pre-parsing mode for subset of buildfile parsing functions
Diffstat (limited to 'build2/parser')
-rw-r--r--build2/parser12
1 files changed, 10 insertions, 2 deletions
diff --git a/build2/parser b/build2/parser
index c51f18f..59cdac2 100644
--- a/build2/parser
+++ b/build2/parser
@@ -134,14 +134,19 @@ namespace build2
// parse the attribute sequence until ']' setting the 'has' flag and
// storing the result on the stack. Then get the next token and, if
// standalone is false, verify it is not newline/eos (i.e., there is
- // something after it). Return the top of the stack.
+ // something after it). Return the indication of whether there are
+ // any attributes and their location.
//
- attributes&
+ // Note that during pre-parsing nothing is pushed into the stack and
+ // the returned attributes object indicates there are no attributes.
+ //
+ pair<bool, location>
attributes_push (token&, token_type&, bool standalone = false);
attributes
attributes_pop ()
{
+ assert (!pre_parse_);
attributes r (move (attributes_.top ()));
attributes_.pop ();
return r;
@@ -157,6 +162,8 @@ namespace build2
// The what argument is used in diagnostics (e.g., "expected <what>
// instead of ...".
//
+ // In pre-parse mode always return empty list of names.
+ //
names
parse_names (token& t, token_type& tt,
bool chunk = false,
@@ -400,6 +407,7 @@ namespace build2
assert (replay_ == replay::stop);
replay_data_ = move (d);
+ replay_i_ = 0;
replay_ = replay::play;
}