X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FConsole%2FParse.hh;h=e7712e00c5e60787eb6e5c04bd9998e521f981f2;hb=bd9f9d3fd6fbcff0112a7bf48ab9284da9576b11;hp=7afbaa1d2cb1b601066ba32defbf5da0edf848e4;hpb=4195e3fc4bb545f2f7921396e2aec77edaa8c8c3;p=senf.git
diff --git a/Utils/Console/Parse.hh b/Utils/Console/Parse.hh
index 7afbaa1..e7712e0 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);
@@ -353,6 +366,7 @@ namespace console {
enum BuiltinCommand { NoBuiltin,
BuiltinCD,
BuiltinLS,
+ BuiltinLR,
BuiltinPUSHD,
BuiltinPOPD,
BuiltinEXIT,