swissChili | c71acc6 | 2021-12-07 08:03:37 -0800 | [diff] [blame^] | 1 | #pragma once |
| 2 | |
| 3 | #include <QString> |
| 4 | |
| 5 | #include "AstNode.h" |
| 6 | |
| 7 | class Parser |
| 8 | { |
| 9 | public: |
| 10 | explicit Parser(QString input); |
| 11 | |
| 12 | QChar peek(); |
| 13 | QChar get(); |
| 14 | bool atEnd(); |
| 15 | |
| 16 | void skip(); |
| 17 | |
| 18 | bool parseSymbol(AstNode *node); |
| 19 | bool parseIdentifier(AstNode *node); |
| 20 | bool parseNumber(AstNode *node); |
| 21 | bool parseVariable(AstNode *node); |
| 22 | bool parseParens(AstNode *node); |
| 23 | bool parseFunction(AstNode *node); |
| 24 | QList<AstNode> parseMany(); |
| 25 | bool parseOne(AstNode *node); |
| 26 | |
| 27 | private: |
| 28 | int _pos = 0; |
| 29 | QString _input; |
| 30 | }; |