src/script/parser.h

Tue, 03 Feb 2015 15:26:07 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 03 Feb 2015 15:26:07 +0200
branch
scripting
changeset 924
d1ac217c9165
parent 923
e15a577a0bfe
child 925
2f316b57b508
permissions
-rw-r--r--

- ast: added root and macro nodes and processing of them

923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
1 /*
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
2 * LDForge: LDraw parts authoring CAD
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
3 * Copyright (C) 2013 - 2015 Teemu Piippo
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
4 *
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
5 * This program is free software: you can redistribute it and/or modify
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
6 * it under the terms of the GNU General Public License as published by
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
8 * (at your option) any later version.
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
9 *
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
10 * This program is distributed in the hope that it will be useful,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
13 * GNU General Public License for more details.
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
14 *
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
15 * You should have received a copy of the GNU General Public License
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
17 */
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
18
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
922
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
20 #include "../main.h"
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "ast.h"
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 namespace Script
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 {
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 enum TokenType
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 {
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
27 TOK_If,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
28 TOK_Then,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
29 TOK_Else,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
30 TOK_EndIf,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
31 TOK_EndMacro,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
32 TOK_Macro,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
33 TOK_For,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
34 TOK_While,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
35 TOK_Done,
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
36 TOK_Do,
922
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
37 TOK_DoubleEquals, // ==
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
38 TOK_AngleLeftEquals, // <=
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
39 TOK_AngleRightEquals, // >=
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
40 TOK_DoubleAmperstand, // &&
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
41 TOK_DoubleBar, // ||
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
42 TOK_NotEquals, // !=
922
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
43 TOK_Colon, // :
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
44 TOK_Semicolon, // ;
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
45 TOK_Dot, // .
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
46 TOK_Comma, // ,
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
47 TOK_Equals, // =
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
48 TOK_AngleLeft, // <
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
49 TOK_AngleRight, // >
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
50 TOK_QuestionMark, // ?
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
51 TOK_BraceLeft, // {
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
52 TOK_BraceRight, // }
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
53 TOK_BracketLeft, // [
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
54 TOK_BracketRight, // ]
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
55 TOK_ParenLeft, // (
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
56 TOK_ParenRight, // )
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
57 TOK_Minus, // -
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
58 TOK_Plus, // +
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
59 TOK_Asterisk, // *
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
60 TOK_Slash, // /
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
61 TOK_Backslash, // \.
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
62 TOK_Amperstand, // &
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
63 TOK_Caret, // ^
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
64 TOK_Bar, // |
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
65 TOK_Exclamation, // !
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
66 TOK_At, // @
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
67 TOK_Pound, // #
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
68 TOK_Tilde, // ~
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
69 TOK_GraveAccent, // `
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
70 TOK_Percent, // %
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
71 TOK_Variable, // $var
922
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
72 TOK_String, // "foo"
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
73 TOK_Symbol, // bar
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
74 TOK_Number, // 42
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
75 TOK_Any // for next() and friends, a token never has this
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
76 };
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
77
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
78 enum
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
79 {
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
80 LastNamedToken = TOK_Percent
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 };
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 enum Function
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 {
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 FUNC_Abs,
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 FUNC_Print,
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 FUNC_Typeof,
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 };
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 struct Token
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 {
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 TokenType type;
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 QString text;
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
94 qint32 number;
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
95 qreal real;
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 };
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
98 struct SavedState
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 {
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 int position;
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 int lineNumber;
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
102 Token token;
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 void reset()
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 {
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 position = 0;
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 lineNumber = 1;
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
108 token.number = token.real = 0;
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
109 token.text.clear();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
110 token.type = TOK_Any;
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 }
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 };
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
114 class ParseError
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 {
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 public:
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
117 ParseError (QString text) : m_text (text) {}
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
118 const QString& message() const { return m_text; }
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 private:
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 QString m_text;
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 };
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 class Parser
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 {
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 public:
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 Parser(QString text);
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 ~Parser();
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 void parse();
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
131 void scriptError (QString text);
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
132 bool next (TokenType desiredType = TOK_Any);
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
133 void mustGetNext (TokenType desiredType = TOK_Any);
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
134 bool peekNext (Token& tok);
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
135 const SavedState& state() const;
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
136 void setState(const SavedState& pos);
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
137 void preprocess();
922
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
138 QString preprocessedScript() const { return QString::fromAscii (m_data); }
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
139 char read();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
140 void unread();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
141 void skipSpace();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
142 bool isAtEnd() const { return m_state.position >= m_data.length(); }
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
143 bool tryMatch (const char* text, bool caseSensitive);
924
d1ac217c9165 - ast: added root and macro nodes and processing of them
Teemu Piippo <crimsondusk64@gmail.com>
parents: 923
diff changeset
144 void tokenMustBe (TokenType desiredType);
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
145
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
146 template<typename... Args>
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
147 void scriptError (QString text, Args... args)
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
148 {
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
149 scriptError (format (text, args...));
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
150 }
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 private:
922
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
153 QString m_script;
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
154 QByteArray m_data;
81887a77baa0 - more work on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents: 921
diff changeset
155 QVector<int> m_lineEndings;
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
156 SavedState m_state;
924
d1ac217c9165 - ast: added root and macro nodes and processing of them
Teemu Piippo <crimsondusk64@gmail.com>
parents: 923
diff changeset
157 Ast::RootPointer m_astRoot;
923
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
158 Token m_rejectedToken;
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
159
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
160 void parseString();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
161 bool parseNumber();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
162 QString parseEscapeSequence();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
163 QString parseIdentifier();
e15a577a0bfe - now parses to tokens
Teemu Piippo <crimsondusk64@gmail.com>
parents: 922
diff changeset
164 bool getNextToken();
921
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
165 };
e2e9f594de66 - commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
166 }

mercurial