#include <llvmexpr/frontend/infix2postfix/Parser.hpp>
Definition at line 40 of file Parser.hpp.
◆ Parser()
| infix2postfix::Parser::Parser |
( |
const std::vector< Token > & | tokens | ) |
|
|
explicit |
◆ parse()
Definition at line 32 of file Parser.cpp.
32 {
33 auto program = std::make_unique<Program>();
34 while (!isAtEnd()) {
35
36 while (match({TokenType::Newline, TokenType::Semicolon})) {
37 }
38 if (isAtEnd()) {
39 break;
40 }
41
42 int pos_before = current;
43 auto stmt = parseDeclaration();
44 if (stmt) {
45 program->statements.push_back(std::move(stmt));
46 }
47 panic_mode = false;
48
49 if (current == pos_before && !isAtEnd() && !errors.empty()) {
50 advance();
51 }
52 }
53
54 return ParseResult{.ast = std::move(program), .errors = std::move(errors)};
55}
Referenced by infix2postfix::AnalysisEngine::runAnalysis().
The documentation for this class was generated from the following files: