diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2024-03-06 10:24:11 +0100 |
commit | 4538829ab86b5a1cd4e845e7eab165029c9d6d46 (patch) | |
tree | bbadf39aed0610c8f8f7b41fefff47773b8ac205 /xsd/type-map/lexer.hxx | |
parent | 23d41842168ac1a1580111b9c5c73500ceee3d57 (diff) | |
parent | aad5ad9bf0c02aa4e79bc6b7d6c934612fff4026 (diff) |
Update upstream source from tag 'upstream/4.2.0'
Update to upstream version '4.2.0'
with Debian dir 1b38df7bbcf313223de3c50107ac0255090fe647
Diffstat (limited to 'xsd/type-map/lexer.hxx')
-rw-r--r-- | xsd/type-map/lexer.hxx | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/xsd/type-map/lexer.hxx b/xsd/type-map/lexer.hxx new file mode 100644 index 0000000..a0e1e44 --- /dev/null +++ b/xsd/type-map/lexer.hxx @@ -0,0 +1,74 @@ +// file : xsd/type-map/lexer.hxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef XSD_TYPE_MAP_LEXER_HXX +#define XSD_TYPE_MAP_LEXER_HXX + +#include <locale> +#include <iosfwd> + +#include <xsd/types.hxx> + +namespace TypeMap +{ + class Lexer + { + public: + class Token + { + public: + enum Type + { + token, + punct, + eos + }; + + Token (Type type, String const& lexeme, size_t line) + : type_ (type), lexeme_ (lexeme), line_ (line) + { + } + + Type + type () const + { + return type_; + } + + String const& + lexeme () const + { + return lexeme_; + } + + size_t + line () const + { + return line_; + } + + private: + Type type_; + String lexeme_; + size_t line_; + }; + + Lexer (std::istream&, String const& path); + + struct Failed {}; + + Token + next (); + + private: + std::locale locale_; + std::istream& is_; + String path_; + size_t line_; + String held_lexeme_; + bool comment_; + }; + +} + +#endif // XSD_TYPE_MAP_LEXER_HXX |