diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-19 11:54:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:30 +0200 |
commit | 93f38c7b1e4bf3c7bf14af6785146c81614cbac5 (patch) | |
tree | 8cc42dc40c45d31c57d2528aa0433a7c380b9f4d /build2/token | |
parent | 8e91d7935932066d17cf6dfb24705c5a62aa42f6 (diff) |
Various minor buildfile lexer/parser changes
Diffstat (limited to 'build2/token')
-rw-r--r-- | build2/token | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/build2/token b/build2/token index 517bf47..19e82dc 100644 --- a/build2/token +++ b/build2/token @@ -92,13 +92,33 @@ namespace build2 printer (&token_printer) {} }; - using tokens = vector<token>; - // Output the token value in a format suitable for diagnostics. // inline ostream& operator<< (ostream& o, const token& t) {t.printer (o, t, true); return o;} + // Extendable/inheritable enum-like class. + // + struct lexer_mode_base + { + enum { value_next }; + + using value_type = uint16_t; + + lexer_mode_base (value_type v = value_next): v_ (v) {} + operator value_type () const {return v_;} + value_type v_; + }; + + struct replay_token + { + build2::token token; + lexer_mode_base mode; + char pair_separator; + }; + + using replay_tokens = vector<replay_token>; + // Diagnostics plumbing. We assume that any diag stream for which we can use // token as location has its aux data pointing to pointer to path. // |