+
+//
+// Helper class for parsing
+//
+
+
+class Parser {
+public:
+ ///
+ Parser(LyXLex & lex) : is_(lex.getStream()), lineno_(lex.getLineNo()) {}
+ ///
+ Parser(istream & is) : is_(is), lineno_(0) {}
+
+ ///
+ MathMacroTemplate * parse_macro();
+ ///
+ MathMatrixInset * parse_normal();
+ ///
+ void parse_into(MathArray & array, unsigned flags);
+ ///
+ int lineno() const { return lineno_; }
+
+private:
+ ///
+ int yylex();
+ ///
+ string lexArg(unsigned char lf, bool accept_spaces = false);
+ ///
+ unsigned char getuchar();
+ ///
+ void error(string const & msg);
+ ///
+ void parse_lines(MathGridInset * p, int col, bool numbered, bool outmost);
+ ///
+ latexkeys const * read_delim();
+
+private:
+ ///
+ istream & is_;
+ ///
+ int lineno_;
+
+ ///
+ int ival_;
+ ///
+ latexkeys const * lval_;
+ ///
+ string sval_;
+
+ ///
+ bool curr_num_;
+ ///
+ string curr_label_;
+ ///
+ string curr_skip_;
+};
+
+
+unsigned char Parser::getuchar()
+{
+ char c = 0;
+ if (!is_.good())
+ lyxerr << "The input stream is not well..." << endl;
+ is_.get(c);
+ return static_cast<unsigned char>(c);
+}
+
+
+string Parser::lexArg(unsigned char lf, bool accept_spaces = false)