Mon, 26 Jan 2015 01:16:56 +0200
- commit work done on scripting
921
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | #include "parser.h" |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | Script::Parser::Parser(QString text) : |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | m_data (text) {} |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | void Script::Parser::parse() |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | { |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | m_position.reset(); |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | } |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | bool Script::Parser::next(TokenType desiredType) |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | { |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | SavedPosition oldpos = position(); |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | } |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | void Script::Parser::mustGetNext(TokenType desiredType) |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | { |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | } |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | bool Script::Parser::peekNext(Token& tok) |
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 | |
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 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | const Script::SavedPosition& Script::Parser::position() const |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | { |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | return m_position; |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | } |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | void Script::Parser::setPosition(const SavedPosition& pos) |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | { |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | m_position = pos; |
e2e9f594de66
- commit work done on scripting
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | } |