ParsedInput Module
Holds operations for working with the untyped abstract syntax tree (ParsedInput).
Functions and values
Function or value |
Description
|
Full Usage:
ParsedInput.exists predicate position parsedInput
Parameters:
SyntaxVisitorPath -> SyntaxNode -> bool
-
The predicate to match each node against.
position : pos
-
The position in the input file down to which to apply the function.
parsedInput : ParsedInput
-
The AST to search.
Returns: bool
True if a matching node is found, or false if no matching node is found.
|
Applies the given predicate to each node of the AST and its context (path) down to a given position, returning true if a matching node is found, otherwise false. Traversal is short-circuited if no matching node is found through the given position.
Example
val isInTypeDefn: obj
|
Full Usage:
ParsedInput.fold folder state parsedInput
Parameters:
'State -> SyntaxVisitorPath -> SyntaxNode -> 'State
-
The function to use to update the state given each node and its context.
state : 'State
-
The initial state.
parsedInput : ParsedInput
-
The AST to fold over.
Returns: 'State
The final state.
|
Applies a function to each node of the AST and its context (path), threading an accumulator through the computation.
Example
val unnecessaryParentheses: obj
union case Option.Some: Value: 'T -> Option<'T>
val ignore: value: 'T -> unit
|
Full Usage:
ParsedInput.foldWhile folder state parsedInput
Parameters:
'State -> SyntaxVisitorPath -> SyntaxNode -> 'State option
-
The function to use to update the state given each node and its context, or to stop traversal by returning None .
state : 'State
-
The initial state.
parsedInput : ParsedInput
-
The AST to fold over.
Returns: 'State
The final state.
|
Applies a function to each node of the AST and its context (path)
until the folder returns
|
Full Usage:
ParsedInput.tryNode position parsedInput
Parameters:
pos
-
The position in the input file down to which to dive.
parsedInput : ParsedInput
-
The AST to search.
Returns: (SyntaxNode * SyntaxVisitorPath) option
The deepest node containing the given position, along with the path taken through the node's ancestors to find it.
|
Dives to the deepest node that contains the given position,
returning the node and its path if found, or
|
Full Usage:
ParsedInput.tryPick chooser position parsedInput
Parameters:
SyntaxVisitorPath -> SyntaxNode -> 'T option
-
The function to apply to each node and its context to derive an optional value.
position : pos
-
The position in the input file down to which to apply the function.
parsedInput : ParsedInput
-
The AST to search.
Returns: 'T option
The first value for which the function returns Some , or None if no matching node is found.
|
Applies the given function to each node of the AST and its context (path)
down to a given position, returning
Example
val range: obj
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
|
Full Usage:
ParsedInput.tryPickLast chooser position parsedInput
Parameters:
SyntaxVisitorPath -> SyntaxNode -> 'T option
-
The function to apply to each node and its context to derive an optional value.
position : pos
-
The position in the input file down to which to apply the function.
parsedInput : ParsedInput
-
The AST to search.
Returns: 'T option
The last (deepest) value for which the function returns Some , or None if no matching node is found.
|
Applies the given function to each node of the AST and its context (path)
down to a given position, returning
Example
val range: obj
union case Option.Some: Value: 'T -> Option<'T>
union case Option.None: Option<'T>
|