Class: CommandAstVisitor
Note: Neither Doxygen nor sphinx-csharp support Python record types. Introduced in C# 9.
Once record types are recognised then details for Token will appear below.
The token is a record with the following values:
readonly string Value - Text representing a token on the command line.
readonly Type Type - The type of the token.
And the following read only properties which return true if the record is the indicated type:
bool IsCommand
bool IsCommandExpression
bool IsCommandParameter
bool IsStringConstantExpression
Warning
doxygenclass: Cannot find class “PoshPredictiveText::Token” in doxygen xml output for project “PoshPredictiveText” from directory: /home/docs/checkouts/readthedocs.org/user_builds/posh-predictive-text/checkouts/latest/docs/source/xml
- class PoshPredictiveText.CommandAstVisitor : AstVisitor
Implements a visitor for the PowerShell abstract syntax tree. Reads the input no the command line and creates an ordered list of tokens representing user input.
Public Functions
- override AstVisitAction DefaultVisit (Ast ast)
Default action if the token has not been processed by a more specific token handler. Adds the token text with a generic text type.
- Param ast:
Node in the abstract syntax tree.
- Return:
Flag to continue processing the abstract syntax tree.
- override AstVisitAction VisitCommand (CommandAst commandAst)
Process commandAst node in the abstract syntax tree. Does not process this node and skips to next node in the tree.
- Param commandAst:
Node in the abstract syntax tree.
- Return:
Continue to next node.
- override AstVisitAction VisitCommandExpression (CommandExpressionAst commandExpressionAst)
Process CommandExpressionAst node in the abstract syntax tree. Add a token to the list of tokens on the command line.
- Param commandExpressionAst:
- Return:
Continue to next node
- override AstVisitAction VisitCommandParameter (CommandParameterAst commandParameterAst)
Process CommandParameterAst node in the abstract syntax tree. Add token to the list of tokens on the command line.
- Param commandParameterAst:
Node in the abstract syntax tree.
- Return:
Continue to next node.
- override AstVisitAction VisitConstantExpression (ConstantExpressionAst constantExpressionAst)
Process ConstantExpressionAst node in the abstract syntax tree. Add token to the list of tokens on the command line.
- Param constantExpressionAst:
Node in the abstract syntax tree.
- Return:
Continue to next node.
- override AstVisitAction VisitStringConstantExpression (StringConstantExpressionAst stringConstantExpressionAst)
Process stringConstantExpressionAst node in the abstract syntax tree.
Identifies Gnu/Posix formatted parameters which start with a double dash and reclassifies them as CommandParameterAst type.
Adds token to the list of tokens on the command line.
- Param stringConstantExpressionAst:
Node in the abstract syntax tree.
- Return:
Continue to next node.