src/script/parser.h

branch
scripting
changeset 942
afbd122f3eff
parent 925
2f316b57b508
--- a/src/script/parser.h	Tue Feb 03 15:30:30 2015 +0200
+++ b/src/script/parser.h	Sat Aug 22 13:04:58 2015 +0300
@@ -95,7 +95,7 @@
 		qreal real;
 	};
 
-	struct SavedState
+	struct State
 	{
 		int position;
 		int lineNumber;
@@ -127,21 +127,21 @@
 		Parser(QString text);
 		~Parser();
 
-		void parse();
-		void scriptError (QString text);
-		bool next (TokenType desiredType = TOK_Any);
+		bool isAtEnd() const { return m_state.position >= m_data.length(); }
 		void mustGetNext (TokenType desiredType = TOK_Any);
+		bool next (TokenType desiredType = TOK_Any);
+		void parse();
 		bool peekNext (Token& tok);
-		const SavedState& state() const;
-		void setState(const SavedState& pos);
 		void preprocess();
 		QString preprocessedScript() const { return QString::fromAscii (m_data); }
 		char read();
-		void unread();
+		void scriptError (QString text);
+		void setState (const State& pos);
 		void skipSpace();
-		bool isAtEnd() const { return m_state.position >= m_data.length(); }
+		State state() const { return m_state; }
+		void tokenMustBe (TokenType desiredType);
 		bool tryMatch (const char* text, bool caseSensitive);
-		void tokenMustBe (TokenType desiredType);
+		void unread();
 
 		template<typename... Args>
 		void scriptError (QString text, Args... args)
@@ -153,7 +153,7 @@
 		QString m_script;
 		QByteArray m_data;
 		QVector<int> m_lineEndings;
-		SavedState m_state;
+		State m_state;
 		Ast::RootPointer m_astRoot;
 		Token m_rejectedToken;
 

mercurial