aboutsummaryrefslogtreecommitdiff
path: root/build/parser
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-10 09:12:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-10 09:12:47 +0200
commit1b86963946082e10e879283fad51ba7ce4e942e2 (patch)
treed0c3dc12900336665a9f5c781bc37aee9b5fefae /build/parser
parent1e61471d480575d069f96b858e4b46f43ba0530f (diff)
Add support for chunking name parsing
Diffstat (limited to 'build/parser')
-rw-r--r--build/parser19
1 files changed, 12 insertions, 7 deletions
diff --git a/build/parser b/build/parser
index 0678a62..7787568 100644
--- a/build/parser
+++ b/build/parser
@@ -48,7 +48,7 @@ namespace build
// Recursive descent parser.
//
- private:
+ protected:
void
clause (token&, token_type&);
@@ -79,17 +79,22 @@ namespace build
names_type
eval (token&, token_type&);
+ // If chunk is true, then parse the smallest but complete, name-wise,
+ // chunk of input. Note that in this case you may still end up with
+ // multiple names, for example, {foo bar}.
+ //
names_type
- names (token& t, token_type& tt)
+ names (token& t, token_type& tt, bool chunk = false)
{
names_type ns;
- names (t, tt, ns, 0, nullptr, nullptr, nullptr);
+ names (t, tt, ns, chunk, 0, nullptr, nullptr, nullptr);
return ns;
}
void
names (token&, token_type&,
names_type&,
+ bool chunk,
std::size_t pair,
const std::string* prj,
const dir_path* dir,
@@ -102,7 +107,7 @@ namespace build
// Utilities.
//
- private:
+ protected:
// Switch to a new current scope. Note that this function might
// also have to switch to a new root scope if the new current
@@ -122,7 +127,7 @@ namespace build
// Lexer.
//
- private:
+ protected:
token_type
next (token&, token_type&);
@@ -138,10 +143,10 @@ namespace build
// Diagnostics.
//
- private:
+ protected:
const fail_mark<failed> fail;
- private:
+ protected:
const std::string* path_; // Path processed by diag_relative().
lexer* lexer_;
target* target_; // Current target, if any.