src/Lexer.h

changeset 91
427eb377d53e
parent 89
029a330a9bef
child 99
44c0c7f31ae8
--- a/src/Lexer.h	Mon Feb 03 11:23:56 2014 +0200
+++ b/src/Lexer.h	Mon Feb 03 20:12:44 2014 +0200
@@ -58,6 +58,10 @@
 	int		GetOneSymbol (const StringList& syms);
 	void	TokenMustBe (EToken tok);
 	bool	PeekNext (Token* tk = null);
+	String	PeekNextString (int a = 1);
+	String	DescribePosition();
+
+	static Lexer* GetCurrentLexer();
 
 	inline bool HasValidToken() const
 	{
@@ -80,6 +84,21 @@
 		return GetToken()->type;
 	}
 
+	inline void Skip (int a = 1)
+	{
+		mTokenPosition += a;
+	}
+
+	inline int GetPosition()
+	{
+		return mTokenPosition - mTokens.begin();
+	}
+
+	inline void SetPosition (int pos)
+	{
+		mTokenPosition = mTokens.begin() + pos;
+	}
+
 	// If @tok is given, describes the token. If not, describes @tok_type.
 	static inline String DescribeTokenType (EToken toktype)
 	{
@@ -91,16 +110,6 @@
 		return DescribeTokenPrivate (tok->type, tok);
 	}
 
-	static Lexer* GetCurrentLexer();
-
-	inline void Skip (int a = 1)
-	{
-		mTokenPosition += a;
-	}
-
-	String PeekNextString (int a = 1);
-	String DescribePosition();
-
 private:
 	TokenList		mTokens;
 	Iterator		mTokenPosition;

mercurial