Instances For
Instances For
Return character after position pos
Instances For
Maximal (and function application) precedence.
In the standard lean language, no parser has precedence higher than maxPrec
.
Note that nothing prevents users from using a higher precedence, but we strongly discourage them from doing it.
Instances For
Instances For
- input : String
- fileName : String
- fileMap : Lean.FileMap
Input string and related data. Recall that the FileMap
is a helper structure for mapping
String.Pos
in the input string to line/column information.
Instances For
- env : Lean.Environment
- options : Lean.Options
- currNamespace : Lake.Name
- openDecls : List Lean.OpenDecl
Input context derived from elaboration of previous commands.
Instances For
- prec : Nat
- quotDepth : Nat
- suppressInsideQuot : Bool
- savedPos? : Option String.Pos
- forbiddenTk? : Option Lean.Parser.Token
Parser context parts that can be updated without invalidating the parser cache.
Instances For
- input : String
- fileName : String
- fileMap : Lean.FileMap
- env : Lean.Environment
- options : Lean.Options
- currNamespace : Lake.Name
- openDecls : List Lean.OpenDecl
- prec : Nat
- quotDepth : Nat
- suppressInsideQuot : Bool
- savedPos? : Option String.Pos
- forbiddenTk? : Option Lean.Parser.Token
- tokens : Lean.Parser.TokenTable
Parser context updateable in adaptUncacheableContextFn
.
Instances For
Opaque parser context updateable using adaptCacheableContextFn
and adaptUncacheableContextFn
.
Instances For
- unexpectedTk : Lean.Syntax
If not
missing
, used for lazily calculatingunexpected
message and range inmkErrorMessage
. Otherwise,ParserState.pos
is used as an empty range. - unexpected : String
Instances For
Instances For
- startPos : String.Pos
- stopPos : String.Pos
- token : Lean.Syntax
Instances For
- prec : Nat
- quotDepth : Nat
- suppressInsideQuot : Bool
- savedPos? : Option String.Pos
- forbiddenTk? : Option Lean.Parser.Token
- parserName : Lake.Name
- pos : String.Pos
Instances For
- stx : Lean.Syntax
- lhsPrec : Nat
- newPos : String.Pos
- errorMsg : Option Lean.Parser.Error
Instances For
- tokenCache : Lean.Parser.TokenCacheEntry
Instances For
- raw : Array Lean.Syntax
- drop : Nat
A syntax array with an inaccessible prefix, used for sound caching.
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
- stxStack : Lean.Parser.SyntaxStack
- lhsPrec : Nat
Set to the precedence of the preceding (not surrounding) parser by
runLongestMatchParser
for the use ofcheckLhsPrec
in trailing parsers. Note that with chaining, the preceding parser can be another trailing parser: in1 * 2 + 3
, the preceding parser is '*' when '+' is executed. - pos : String.Pos
- cache : Lean.Parser.ParserCache
- errorMsg : Option Lean.Parser.Error
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Instances For
Reports given 'expected' messages at range of top stack element (assumed to be a single token).
Replaces the element with missing
and resets position to the token position.
iniPos
can be specified to avoid this position lookup but still must be identical to the token position.
Instances For
Reports given 'expected' message at range of top stack element (assumed to be a single token).
Replaces the element with missing
and resets position to the token position.
iniPos
can be specified to avoid this position lookup but still must be identical to the token position.
Instances For
Instances For
- epsilon: Lean.Parser.FirstTokens
- unknown: Lean.Parser.FirstTokens
- tokens: List Lean.Parser.Token → Lean.Parser.FirstTokens
- optTokens: List Lean.Parser.Token → Lean.Parser.FirstTokens
Instances For
Instances For
- collectTokens : List Lean.Parser.Token → List Lean.Parser.Token
- collectKinds : Lean.Parser.SyntaxNodeKindSet → Lean.Parser.SyntaxNodeKindSet
- firstTokens : Lean.Parser.FirstTokens
Instances For
- info : Lean.Parser.ParserInfo
- fn : Lean.Parser.ParserFn
Instances For
Create a simple parser combinator that inherits the info
of the nested parser.
Instances For
Run p
with a fresh cache, restore outer cache afterwards.
p
may access the entire syntax stack.
Instances For
Run p
with a fresh cache, restore outer cache afterwards.
p
may access the entire syntax stack.
Instances For
Run p
under the given context transformation with a fresh cache (see also withResetCacheFn
).
Instances For
Run p
and record result in parser cache for any further invocation with this parserName
, parser context, and parser state.
p
cannot access syntax stack elements pushed before the invocation in order to make caching independent of parser history.
As this excludes trailing parsers from being cached, we also reset lhsPrec
, which is not read but set by leading parsers, to 0
in order to increase cache hits. Finally, errorMsg
is also reset to none
as a leading parser should not be called in the first
place if there was an error.
Instances For
Run p
and record result in parser cache for any further invocation with this parserName
, parser context, and parser state.
p
cannot access syntax stack elements pushed before the invocation in order to make caching independent of parser history.
As this excludes trailing parsers from being cached, we also reset lhsPrec
, which is not read but set by leading parsers, to 0
in order to increase cache hits. Finally, errorMsg
is also reset to none
as a leading parser should not be called in the first
place if there was an error.