31 std::vector<std::pair<std::string::iterator, std::size_t>>
m_it_to_row;
32 std::string::iterator
m_it, m_next_it;
42 void registerNewLine(std::string::iterator it, std::size_t row);
52 void initParser(
const std::string& filename,
const std::string& code);
56 [[nodiscard]]
CodeErrorContext generateErrorContext(
const std::string& expr);
64 void error(
const std::string& error, std::string exp,
const std::optional<CodeErrorContext>& additional_context = std::nullopt);
72 void errorWithNextToken(
const std::string& message,
const std::optional<CodeErrorContext>& additional_context = std::nullopt);
81 void expectSuffixOrError(
char suffix,
const std::string& context,
const std::optional<CodeErrorContext>& additional_context = std::nullopt);
87 long getCount() {
return std::distance(m_str.begin(), m_it); }
93 [[nodiscard]] std::size_t
getSize()
const {
return m_str.size(); }
99 [[nodiscard]]
bool isEOF()
const {
return m_it == m_str.end(); }
106 void backtrack(
long n);
115 bool accept(
const CharPred& t, std::string* s =
nullptr);
123 bool expect(
const CharPred& t, std::string* s =
nullptr);
125 [[nodiscard]] std::string peek()
const;
129 bool space(std::string* s =
nullptr);
130 bool inlineSpace(std::string* s =
nullptr);
131 bool comment(std::string* s =
nullptr);
132 bool spaceComment(std::string* s =
nullptr);
133 bool newlineOrComment(std::string* s =
nullptr);
135 bool number(std::string* s =
nullptr);
136 bool signedNumber(std::string* s =
nullptr);
137 bool hexNumber(
unsigned length, std::string* s =
nullptr);
138 bool name(std::string* s =
nullptr);
139 bool sequence(
const std::string& s);
140 bool packageName(std::string* s =
nullptr);
149 bool anyUntil(
const CharPred& delim, std::string* s =
nullptr);
158 bool oneOf(std::initializer_list<std::string> words, std::string* s =
nullptr);