MLIR  20.0.0git
Parser.h
Go to the documentation of this file.
1 //===- Parser.h - MLIR Base Parser Class ------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef MLIR_LIB_ASMPARSER_PARSER_H
10 #define MLIR_LIB_ASMPARSER_PARSER_H
11 
12 #include "ParserState.h"
13 #include "mlir/IR/Builders.h"
15 #include <optional>
16 
17 namespace mlir {
18 namespace detail {
19 //===----------------------------------------------------------------------===//
20 // Parser
21 //===----------------------------------------------------------------------===//
22 
23 /// This class implement support for parsing global entities like attributes and
24 /// types. It is intended to be subclassed by specialized subparsers that
25 /// include state.
26 class Parser {
27 public:
29 
31 
33  : builder(state.config.getContext()), state(state) {}
34 
35  // Helper methods to get stuff from the parser-global state.
36  ParserState &getState() const { return state; }
37  MLIRContext *getContext() const { return state.config.getContext(); }
38  const llvm::SourceMgr &getSourceMgr() { return state.lex.getSourceMgr(); }
39 
40  /// Parse a comma-separated list of elements up until the specified end token.
41  ParseResult
43  function_ref<ParseResult()> parseElement,
44  bool allowEmptyList = true);
45 
46  /// Parse a list of comma-separated items with an optional delimiter. If a
47  /// delimiter is provided, then an empty list is allowed. If not, then at
48  /// least one element will be parsed.
49  ParseResult
51  function_ref<ParseResult()> parseElementFn,
52  StringRef contextMessage = StringRef());
53 
54  /// Parse a comma separated list of elements that must have at least one entry
55  /// in it.
56  ParseResult
57  parseCommaSeparatedList(function_ref<ParseResult()> parseElementFn) {
58  return parseCommaSeparatedList(Delimiter::None, parseElementFn);
59  }
60 
61  /// Parse the body of a dialect symbol, which starts and ends with <>'s, and
62  /// may be recursive. Return with the 'body' StringRef encompassing the entire
63  /// body. `isCodeCompletion` is set to true if the body contained a code
64  /// completion location, in which case the body is only populated up to the
65  /// completion.
66  ParseResult parseDialectSymbolBody(StringRef &body, bool &isCodeCompletion);
67  ParseResult parseDialectSymbolBody(StringRef &body) {
68  bool isCodeCompletion = false;
69  return parseDialectSymbolBody(body, isCodeCompletion);
70  }
71 
72  // We have two forms of parsing methods - those that return a non-null
73  // pointer on success, and those that return a ParseResult to indicate whether
74  // they returned a failure. The second class fills in by-reference arguments
75  // as the results of their action.
76 
77  //===--------------------------------------------------------------------===//
78  // Error Handling
79  //===--------------------------------------------------------------------===//
80 
81  /// Emit an error and return failure.
82  InFlightDiagnostic emitError(const Twine &message = {});
83  InFlightDiagnostic emitError(SMLoc loc, const Twine &message = {});
84 
85  /// Emit an error about a "wrong token". If the current token is at the
86  /// start of a source line, this will apply heuristics to back up and report
87  /// the error at the end of the previous line, which is where the expected
88  /// token is supposed to be.
89  InFlightDiagnostic emitWrongTokenError(const Twine &message = {});
90 
91  /// Encode the specified source location information into an attribute for
92  /// attachment to the IR.
95  }
96 
97  //===--------------------------------------------------------------------===//
98  // Token Parsing
99  //===--------------------------------------------------------------------===//
100 
101  /// Return the current token the parser is inspecting.
102  const Token &getToken() const { return state.curToken; }
103  StringRef getTokenSpelling() const { return state.curToken.getSpelling(); }
104 
105  /// Return the last parsed token.
106  const Token &getLastToken() const { return state.lastToken; }
107 
108  /// If the current token has the specified kind, consume it and return true.
109  /// If not, return false.
110  bool consumeIf(Token::Kind kind) {
111  if (state.curToken.isNot(kind))
112  return false;
113  consumeToken(kind);
114  return true;
115  }
116 
117  /// Advance the current lexer onto the next token.
118  void consumeToken() {
119  assert(state.curToken.isNot(Token::eof, Token::error) &&
120  "shouldn't advance past EOF or errors");
123  }
124 
125  /// Advance the current lexer onto the next token, asserting what the expected
126  /// current token is. This is preferred to the above method because it leads
127  /// to more self-documenting code with better checking.
129  assert(state.curToken.is(kind) && "consumed an unexpected token");
130  consumeToken();
131  }
132 
133  /// Reset the parser to the given lexer position.
134  void resetToken(const char *tokPos) {
135  state.lex.resetPointer(tokPos);
138  }
139 
140  /// Consume the specified token if present and return success. On failure,
141  /// output a diagnostic and return failure.
142  ParseResult parseToken(Token::Kind expectedToken, const Twine &message);
143 
144  /// Parse an optional integer value from the stream.
146 
147  /// Parse an optional integer value only in decimal format from the stream.
149 
150  /// Parse a floating point value from an integer literal token.
151  ParseResult parseFloatFromIntegerLiteral(std::optional<APFloat> &result,
152  const Token &tok, bool isNegative,
153  const llvm::fltSemantics &semantics,
154  size_t typeSizeInBits);
155 
156  /// Returns true if the current token corresponds to a keyword.
157  bool isCurrentTokenAKeyword() const {
158  return getToken().isAny(Token::bare_identifier, Token::inttype) ||
159  getToken().isKeyword();
160  }
161 
162  /// Parse a keyword, if present, into 'keyword'.
163  ParseResult parseOptionalKeyword(StringRef *keyword);
164 
165  //===--------------------------------------------------------------------===//
166  // Resource Parsing
167  //===--------------------------------------------------------------------===//
168 
169  /// Parse a handle to a dialect resource within the assembly format.
170  FailureOr<AsmDialectResourceHandle>
171  parseResourceHandle(const OpAsmDialectInterface *dialect, StringRef &name);
172  FailureOr<AsmDialectResourceHandle> parseResourceHandle(Dialect *dialect);
173 
174  //===--------------------------------------------------------------------===//
175  // Type Parsing
176  //===--------------------------------------------------------------------===//
177 
178  /// Invoke the `getChecked` method of the given Attribute or Type class, using
179  /// the provided location to emit errors in the case of failure. Note that
180  /// unlike `OpBuilder::getType`, this method does not implicitly insert a
181  /// context parameter.
182  template <typename T, typename... ParamsT>
183  T getChecked(SMLoc loc, ParamsT &&...params) {
184  return T::getChecked([&] { return emitError(loc); },
185  std::forward<ParamsT>(params)...);
186  }
187 
188  ParseResult parseFunctionResultTypes(SmallVectorImpl<Type> &elements);
189  ParseResult parseTypeListNoParens(SmallVectorImpl<Type> &elements);
190  ParseResult parseTypeListParens(SmallVectorImpl<Type> &elements);
191 
192  /// Optionally parse a type.
194 
195  /// Parse an arbitrary type.
196  Type parseType();
197 
198  /// Parse a complex type.
200 
201  /// Parse an extended type.
203 
204  /// Parse a function type.
206 
207  /// Parse a memref type.
209 
210  /// Parse a non function type.
212 
213  /// Parse a tensor type.
215 
216  /// Parse a tuple type.
218 
219  /// Parse a vector type.
220  VectorType parseVectorType();
221  ParseResult parseVectorDimensionList(SmallVectorImpl<int64_t> &dimensions,
222  SmallVectorImpl<bool> &scalableDims);
223  ParseResult parseDimensionListRanked(SmallVectorImpl<int64_t> &dimensions,
224  bool allowDynamic = true,
225  bool withTrailingX = true);
226  ParseResult parseIntegerInDimensionList(int64_t &value);
227  ParseResult parseXInDimensionList();
228 
229  //===--------------------------------------------------------------------===//
230  // Attribute Parsing
231  //===--------------------------------------------------------------------===//
232 
233  /// Parse an arbitrary attribute with an optional type.
234  Attribute parseAttribute(Type type = {});
235 
236  /// Parse an optional attribute with the provided type.
238  Type type = {});
239  OptionalParseResult parseOptionalAttribute(ArrayAttr &attribute, Type type);
240  OptionalParseResult parseOptionalAttribute(StringAttr &attribute, Type type);
241  OptionalParseResult parseOptionalAttribute(SymbolRefAttr &result, Type type);
242 
243  /// Parse an optional attribute that is demarcated by a specific token.
244  template <typename AttributeT>
246  AttributeT &attr,
247  Type type = {}) {
248  if (getToken().isNot(kind))
249  return std::nullopt;
250 
251  if (Attribute parsedAttr = parseAttribute(type)) {
252  attr = cast<AttributeT>(parsedAttr);
253  return success();
254  }
255  return failure();
256  }
257 
258  /// Parse an attribute dictionary.
259  ParseResult parseAttributeDict(NamedAttrList &attributes);
260 
261  /// Parse a distinct attribute.
262  Attribute parseDistinctAttr(Type type);
263 
264  /// Parse an extended attribute.
265  Attribute parseExtendedAttr(Type type);
266 
267  /// Parse a float attribute.
268  Attribute parseFloatAttr(Type type, bool isNegative);
269 
270  /// Parse a decimal or a hexadecimal literal, which can be either an integer
271  /// or a float attribute.
272  Attribute parseDecOrHexAttr(Type type, bool isNegative);
273 
274  /// Parse a dense elements attribute.
275  Attribute parseDenseElementsAttr(Type attrType);
276  ShapedType parseElementsLiteralType(Type type);
277 
278  /// Parse a dense resource elements attribute.
279  Attribute parseDenseResourceElementsAttr(Type attrType);
280 
281  /// Parse a DenseArrayAttr.
282  Attribute parseDenseArrayAttr(Type type);
283 
284  /// Parse a sparse elements attribute.
285  Attribute parseSparseElementsAttr(Type attrType);
286 
287  /// Parse a strided layout attribute.
288  Attribute parseStridedLayoutAttr();
289 
290  //===--------------------------------------------------------------------===//
291  // Location Parsing
292  //===--------------------------------------------------------------------===//
293 
294  /// Parse a raw location instance.
295  ParseResult parseLocationInstance(LocationAttr &loc);
296 
297  /// Parse a callsite location instance.
298  ParseResult parseCallSiteLocation(LocationAttr &loc);
299 
300  /// Parse a fused location instance.
301  ParseResult parseFusedLocation(LocationAttr &loc);
302 
303  /// Parse a name or FileLineCol location instance.
304  ParseResult parseNameOrFileLineColLocation(LocationAttr &loc);
305 
306  //===--------------------------------------------------------------------===//
307  // Affine Parsing
308  //===--------------------------------------------------------------------===//
309 
310  /// Parse a reference to either an affine map, expr, or an integer set.
311  ParseResult parseAffineMapOrIntegerSetReference(AffineMap &map,
312  IntegerSet &set);
313  ParseResult parseAffineMapReference(AffineMap &map);
314  ParseResult
315  parseAffineExprReference(ArrayRef<std::pair<StringRef, AffineExpr>> symbolSet,
316  AffineExpr &expr);
317  ParseResult parseIntegerSetReference(IntegerSet &set);
318 
319  /// Parse an AffineMap where the dim and symbol identifiers are SSA ids.
320  ParseResult
321  parseAffineMapOfSSAIds(AffineMap &map,
322  function_ref<ParseResult(bool)> parseElement,
323  Delimiter delimiter);
324 
325  /// Parse an AffineExpr where dim and symbol identifiers are SSA ids.
326  ParseResult
327  parseAffineExprOfSSAIds(AffineExpr &expr,
328  function_ref<ParseResult(bool)> parseElement);
329 
330  //===--------------------------------------------------------------------===//
331  // Code Completion
332  //===--------------------------------------------------------------------===//
333 
334  /// The set of various code completion methods. Every completion method
335  /// returns `failure` to signal that parsing should abort after any desired
336  /// completions have been enqueued. Note that `failure` is does not mean
337  /// completion failed, it's just a signal to the parser to stop.
338 
339  ParseResult codeCompleteDialectName();
340  ParseResult codeCompleteOperationName(StringRef dialectName);
341  ParseResult codeCompleteDialectOrElidedOpName(SMLoc loc);
342  ParseResult codeCompleteStringDialectOrOperationName(StringRef name);
343  ParseResult codeCompleteExpectedTokens(ArrayRef<StringRef> tokens);
344  ParseResult codeCompleteOptionalTokens(ArrayRef<StringRef> tokens);
345 
346  Attribute codeCompleteAttribute();
347  Type codeCompleteType();
348  Attribute
349  codeCompleteDialectSymbol(const llvm::StringMap<Attribute> &aliases);
350  Type codeCompleteDialectSymbol(const llvm::StringMap<Type> &aliases);
351 
352 protected:
353  /// The Parser is subclassed and reinstantiated. Do not add additional
354  /// non-trivial state here, add it to the ParserState class.
356 };
357 } // namespace detail
358 } // namespace mlir
359 
360 #endif // MLIR_LIB_ASMPARSER_PARSER_H
Delimiter
These are the supported delimiters around operand lists and region argument lists,...
@ None
Zero or more operands with no delimiters.
Attributes are known-constant values of operations.
Definition: Attributes.h:25
This class is a general helper class for creating context-global objects like types,...
Definition: Builders.h:50
Dialects are groups of MLIR operations, types and attributes, as well as behavior associated with the...
Definition: Dialect.h:38
This class represents a diagnostic that is inflight and set to be reported.
Definition: Diagnostics.h:313
Token lexToken()
Definition: Lexer.cpp:73
const llvm::SourceMgr & getSourceMgr()
Definition: Lexer.h:28
Location getEncodedSourceLocation(SMLoc loc)
Encode the specified source location information into a Location object for attachment to the IR or e...
Definition: Lexer.cpp:50
void resetPointer(const char *newPointer)
Change the position of the lexer cursor.
Definition: Lexer.h:38
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Definition: Location.h:63
MLIRContext is the top-level object for a collection of MLIR operations.
Definition: MLIRContext.h:60
This class implements Optional functionality for ParseResult.
Definition: OpDefinition.h:39
MLIRContext * getContext() const
Return the MLIRContext to be used when parsing.
Definition: AsmState.h:474
This represents a token in the MLIR syntax.
Definition: Token.h:20
bool isKeyword() const
Return true if this is one of the keyword token kinds (e.g. kw_if).
Definition: Token.cpp:192
bool is(Kind k) const
Definition: Token.h:38
bool isAny(Kind k1, Kind k2) const
Definition: Token.h:40
bool isNot(Kind k) const
Definition: Token.h:50
StringRef getSpelling() const
Definition: Token.h:34
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition: Types.h:74
This class implement support for parsing global entities like attributes and types.
Definition: Parser.h:26
ParseResult parseOptionalKeyword(StringRef *keyword)
Parse a keyword, if present, into 'keyword'.
Definition: Parser.cpp:381
const Token & getLastToken() const
Return the last parsed token.
Definition: Parser.h:106
Attribute parseDenseArrayAttr(Type type)
Parse a DenseArrayAttr.
Attribute parseStridedLayoutAttr()
Parse a strided layout attribute.
Attribute parseDecOrHexAttr(Type type, bool isNegative)
Parse a decimal or a hexadecimal literal, which can be either an integer or a float attribute.
OpAsmParser::Delimiter Delimiter
Definition: Parser.h:28
ParseResult parseXInDimensionList()
Parse an 'x' token in a dimension list, handling the case where the x is juxtaposed with an element t...
Definition: TypeParser.cpp:595
T getChecked(SMLoc loc, ParamsT &&...params)
Invoke the getChecked method of the given Attribute or Type class, using the provided location to emi...
Definition: Parser.h:183
OptionalParseResult parseOptionalType(Type &type)
Optionally parse a type.
Definition: TypeParser.cpp:32
ParseResult parseToken(Token::Kind expectedToken, const Twine &message)
Consume the specified token if present and return success.
Definition: Parser.cpp:267
ParseResult parseCommaSeparatedListUntil(Token::Kind rightToken, function_ref< ParseResult()> parseElement, bool allowEmptyList=true)
Parse a comma-separated list of elements up until the specified end token.
Definition: Parser.cpp:173
ParseResult codeCompleteOperationName(StringRef dialectName)
Definition: Parser.cpp:442
OptionalParseResult parseOptionalDecimalInteger(APInt &result)
Parse an optional integer value only in decimal format from the stream.
Definition: Parser.cpp:312
Builder builder
Definition: Parser.h:30
Type parseType()
Parse an arbitrary type.
Definition: TypeParser.cpp:70
Attribute parseDenseElementsAttr(Type attrType)
Parse a dense elements attribute.
void consumeToken(Token::Kind kind)
Advance the current lexer onto the next token, asserting what the expected current token is.
Definition: Parser.h:128
ParseResult parseTypeListParens(SmallVectorImpl< Type > &elements)
Parse a parenthesized list of types.
Definition: TypeParser.cpp:112
ParserState & getState() const
Definition: Parser.h:36
Attribute parseDenseResourceElementsAttr(Type attrType)
Parse a dense resource elements attribute.
ParseResult parseVectorDimensionList(SmallVectorImpl< int64_t > &dimensions, SmallVectorImpl< bool > &scalableDims)
Parse a dimension list in a vector type.
Definition: TypeParser.cpp:494
Type parseMemRefType()
Parse a memref type.
Definition: TypeParser.cpp:179
Type parseNonFunctionType()
Parse a non function type.
Definition: TypeParser.cpp:271
Parser(ParserState &state)
Definition: Parser.h:32
Type codeCompleteType()
Definition: Parser.cpp:502
ParseResult parseAffineMapReference(AffineMap &map)
Location getEncodedSourceLocation(SMLoc loc)
Encode the specified source location information into an attribute for attachment to the IR.
Definition: Parser.h:93
Type parseExtendedType()
Parse an extended type.
Type parseTupleType()
Parse a tuple type.
Definition: TypeParser.cpp:430
InFlightDiagnostic emitError(const Twine &message={})
Emit an error and return failure.
Definition: Parser.cpp:192
ParserState & state
The Parser is subclassed and reinstantiated.
Definition: Parser.h:355
ParseResult codeCompleteDialectName()
The set of various code completion methods.
Definition: Parser.cpp:437
ParseResult parseAffineExprReference(ArrayRef< std::pair< StringRef, AffineExpr >> symbolSet, AffineExpr &expr)
Attribute parseAttribute(Type type={})
Parse an arbitrary attribute with an optional type.
const llvm::SourceMgr & getSourceMgr()
Definition: Parser.h:38
StringRef getTokenSpelling() const
Definition: Parser.h:103
ParseResult parseLocationInstance(LocationAttr &loc)
Parse a raw location instance.
void consumeToken()
Advance the current lexer onto the next token.
Definition: Parser.h:118
ParseResult codeCompleteExpectedTokens(ArrayRef< StringRef > tokens)
Definition: Parser.cpp:488
Attribute codeCompleteAttribute()
Definition: Parser.cpp:497
ParseResult parseIntegerInDimensionList(int64_t &value)
Definition: TypeParser.cpp:567
ParseResult parseAttributeDict(NamedAttrList &attributes)
Parse an attribute dictionary.
ParseResult parseDialectSymbolBody(StringRef &body, bool &isCodeCompletion)
Parse the body of a dialect symbol, which starts and ends with <>'s, and may be recursive.
ShapedType parseElementsLiteralType(Type type)
Shaped type for elements attribute.
Type parseComplexType()
Parse a complex type.
Definition: TypeParser.cpp:130
ParseResult parseDimensionListRanked(SmallVectorImpl< int64_t > &dimensions, bool allowDynamic=true, bool withTrailingX=true)
Parse a dimension list of a tensor or memref type.
Definition: TypeParser.cpp:530
ParseResult parseFunctionResultTypes(SmallVectorImpl< Type > &elements)
Parse a function result type.
Definition: TypeParser.cpp:81
ParseResult codeCompleteDialectOrElidedOpName(SMLoc loc)
Definition: Parser.cpp:452
ParseResult parseDialectSymbolBody(StringRef &body)
Definition: Parser.h:67
MLIRContext * getContext() const
Definition: Parser.h:37
Attribute parseDistinctAttr(Type type)
Parse a distinct attribute.
InFlightDiagnostic emitWrongTokenError(const Twine &message={})
Emit an error about a "wrong token".
Definition: Parser.cpp:215
ParseResult parseCommaSeparatedList(Delimiter delimiter, function_ref< ParseResult()> parseElementFn, StringRef contextMessage=StringRef())
Parse a list of comma-separated items with an optional delimiter.
Definition: Parser.cpp:84
VectorType parseVectorType()
Parse a vector type.
Definition: TypeParser.cpp:456
OptionalParseResult parseOptionalInteger(APInt &result)
Parse an optional integer value from the stream.
Definition: Parser.cpp:275
ParseResult parseFusedLocation(LocationAttr &loc)
Parse a fused location instance.
Type parseFunctionType()
Parse a function type.
Definition: TypeParser.cpp:153
Attribute parseSparseElementsAttr(Type attrType)
Parse a sparse elements attribute.
ParseResult parseAffineMapOrIntegerSetReference(AffineMap &map, IntegerSet &set)
Parse a reference to either an affine map, expr, or an integer set.
OptionalParseResult parseOptionalAttribute(Attribute &attribute, Type type={})
Parse an optional attribute with the provided type.
bool isCurrentTokenAKeyword() const
Returns true if the current token corresponds to a keyword.
Definition: Parser.h:157
ParseResult codeCompleteStringDialectOrOperationName(StringRef name)
Definition: Parser.cpp:475
ParseResult parseFloatFromIntegerLiteral(std::optional< APFloat > &result, const Token &tok, bool isNegative, const llvm::fltSemantics &semantics, size_t typeSizeInBits)
Parse a floating point value from an integer literal token.
Definition: Parser.cpp:351
ParseResult codeCompleteOptionalTokens(ArrayRef< StringRef > tokens)
Definition: Parser.cpp:492
ParseResult parseAffineMapOfSSAIds(AffineMap &map, function_ref< ParseResult(bool)> parseElement, Delimiter delimiter)
Parse an AffineMap where the dim and symbol identifiers are SSA ids.
Attribute parseFloatAttr(Type type, bool isNegative)
Parse a float attribute.
ParseResult parseCallSiteLocation(LocationAttr &loc)
Parse a callsite location instance.
ParseResult parseIntegerSetReference(IntegerSet &set)
ParseResult parseNameOrFileLineColLocation(LocationAttr &loc)
Parse a name or FileLineCol location instance.
ParseResult parseTypeListNoParens(SmallVectorImpl< Type > &elements)
Parse a list of types without an enclosing parenthesis.
Definition: TypeParser.cpp:97
void resetToken(const char *tokPos)
Reset the parser to the given lexer position.
Definition: Parser.h:134
ParseResult parseAffineExprOfSSAIds(AffineExpr &expr, function_ref< ParseResult(bool)> parseElement)
Parse an AffineExpr where dim and symbol identifiers are SSA ids.
Attribute parseExtendedAttr(Type type)
Parse an extended attribute.
const Token & getToken() const
Return the current token the parser is inspecting.
Definition: Parser.h:102
ParseResult parseCommaSeparatedList(function_ref< ParseResult()> parseElementFn)
Parse a comma separated list of elements that must have at least one entry in it.
Definition: Parser.h:57
FailureOr< AsmDialectResourceHandle > parseResourceHandle(const OpAsmDialectInterface *dialect, StringRef &name)
Parse a handle to a dialect resource within the assembly format.
Definition: Parser.cpp:395
Type parseTensorType()
Parse a tensor type.
Definition: TypeParser.cpp:372
bool consumeIf(Token::Kind kind)
If the current token has the specified kind, consume it and return true.
Definition: Parser.h:110
OptionalParseResult parseOptionalAttributeWithToken(Token::Kind kind, AttributeT &attr, Type type={})
Parse an optional attribute that is demarcated by a specific token.
Definition: Parser.h:245
Attribute codeCompleteDialectSymbol(const llvm::StringMap< Attribute > &aliases)
Definition: Parser.cpp:508
Include the generated interface declarations.
llvm::function_ref< Fn > function_ref
Definition: LLVM.h:152
This class refers to all of the state maintained globally by the parser, such as the current lexer po...
Definition: ParserState.h:51
const ParserConfig & config
The configuration used to setup the parser.
Definition: ParserState.h:63
Lexer lex
The lexer for the source file we're parsing.
Definition: ParserState.h:66
Token curToken
This is the next token that hasn't been consumed yet.
Definition: ParserState.h:69
Token lastToken
This is the last token that has been consumed.
Definition: ParserState.h:72