aboutsummaryrefslogtreecommitdiff
path: root/build2/lexer
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-23 16:09:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-25 08:05:43 +0200
commitad7d4bd0722aa70ba634900cebf93a1b1814fed9 (patch)
treefbfa28c4602dea0be178e63d1e6a1b2667e85190 /build2/lexer
parenta8bef4ff20100c518816c641ae1ff9783306c167 (diff)
Only do "effective escaping" (['"\$(]) on the command line
This will make things more convenient on Windows provided we use "sane" paths (no spaces, no (), etc).
Diffstat (limited to 'build2/lexer')
-rw-r--r--build2/lexer16
1 files changed, 12 insertions, 4 deletions
diff --git a/build2/lexer b/build2/lexer
index c856344..42222e6 100644
--- a/build2/lexer
+++ b/build2/lexer
@@ -37,10 +37,19 @@ namespace build2
class lexer: protected butl::char_scanner
{
public:
+ // If escape is not NULL then only escape sequences with characters from
+ // this string are considered "effective escapes" with all others passed
+ // through as is. Note that the escape string is not copied.
+ //
lexer (istream& is,
const path& name,
+ const char* escapes = nullptr,
void (*processor) (token&, const lexer&) = nullptr)
- : char_scanner (is), fail (name), processor_ (processor), sep_ (false)
+ : char_scanner (is),
+ fail (name),
+ escapes_ (escapes),
+ processor_ (processor),
+ sep_ (false)
{
mode (lexer_mode::normal);
}
@@ -100,9 +109,6 @@ namespace build2
bool
skip_spaces ();
- xchar
- escape ();
-
// Diagnostics.
//
private:
@@ -120,8 +126,10 @@ namespace build2
private:
fail_mark fail;
+ const char* escapes_;
void (*processor_) (token&, const lexer&);
+
struct state
{
lexer_mode mode;