X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FParse.hh;h=4303fc2a4d162dfb8ae21fa58253bb76fe28df64;hb=d498c7507e2eaa191e859ae525df97dc257e0d7a;hp=7afbaa1d2cb1b601066ba32defbf5da0edf848e4;hpb=4195e3fc4bb545f2f7921396e2aec77edaa8c8c3;p=senf.git diff --git a/Utils/Console/Parse.hh b/Utils/Console/Parse.hh index 7afbaa1..4303fc2 100644 --- a/Utils/Console/Parse.hh +++ b/Utils/Console/Parse.hh @@ -85,11 +85,12 @@ returned as punctuation tokens - - - - - + + + + + +
/path component separator
( )argument grouping
{ }directory grouping
;command terminator
, =punctuation tokens
#Comments are marked with '#' and continue to the end of the line
/path component separator
( )argument grouping
{ }directory grouping
;command terminator
, =punctuation tokens
\subsection console_basic Basic elements @@ -205,6 +206,8 @@ namespace senf { namespace console { + namespace detail { class FilePositionWithIndex; } + namespace detail { struct ParserAccess; } /** \brief Single argument token @@ -253,7 +256,10 @@ namespace console { }; Token(); ///< Create empty token - Token(TokenType type, std::string token); ///< Create token with given type and value + Token(TokenType type, std::string token); + ///< Create token with given type and value + Token(TokenType type, std::string token, detail::FilePositionWithIndex const & pos); + ///< Create token with given type and value std::string const & value() const; ///< String value of token @@ -261,6 +267,10 @@ namespace console { TokenType type() const; ///< Token type + unsigned line() const; ///< Line number of token in source + unsigned column() const; ///< Column number of token in source + unsigned index() const; ///< Index (char count) of token in source + bool is(unsigned tokens) const; ///< Check, whether tokens type matches \a tokens /**< \a tokens is a bit-mask of token types to check. */ @@ -272,6 +282,9 @@ namespace console { private: TokenType type_; std::string token_; + unsigned line_; + unsigned column_; + unsigned index_; }; std::ostream & operator<<(std::ostream & os, Token const & token);