PythonGrammarDefinition class

Complete grammar and parser definition for the Python programming language (3.12+).

Constructors

PythonGrammarDefinition()

Properties

hashCode → int
The hash code for this object.
no setterinherited
indent → Indent
The indentation manager instance.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

andToken() → Parser<Token<String>>
inherited
annAssignStatement() → Parser<AnnAssignNode>
inherited
asPattern() → Parser<PatternNode>
As pattern p as name.
inherited
assertStatement() → Parser<AssertNode>
inherited
assertToken() → Parser<Token<String>>
inherited
assignmentStatement() → Parser<StatementNode>
inherited
assignToken() → Parser<Token<String>>
Token for the assignment operator =, distinct from ==, :=, += etc.
inherited
asToken() → Parser<Token<String>>
inherited
asyncFunctionDef() → Parser<AsyncFunctionDefNode>
inherited
asyncToken() → Parser<Token<String>>
inherited
atom() → Parser<ExpressionNode>
Atoms: identifiers, literals, parenthesized expressions, tuples, lists, dicts, sets, comprehensions.
inherited
atomPattern() → Parser<PatternNode>
Atomic patterns.
inherited
attributeSelector() → Parser<ExpressionNode Function(ExpressionNode)>
inherited
augAssignStatement() → Parser<AugAssignNode>
inherited
awaitExpr() → Parser<ExpressionNode>
Await expression await x.
inherited
awaitToken() → Parser<Token<String>>
inherited
binaryLiteral() → Parser<ConstantNode>
inherited
bitwiseAnd() → Parser<ExpressionNode>
Bitwise AND &.
inherited
bitwiseOr() → Parser<ExpressionNode>
Bitwise OR |.
inherited
bitwiseXor() → Parser<ExpressionNode>
Bitwise XOR ^.
inherited
blankLine() → Parser<String>
A parser that matches a blank or comment-only line.
inherited
blankLines() → Parser<void>
A parser that skips zero or more blank or comment-only lines.
inherited
breakStatement() → Parser<BreakNode>
inherited
breakToken() → Parser<Token<String>>
inherited
build() → Parser<ModuleNode>
Builds the default composite parser starting at start.
inherited
buildFrom<T>(Parser<T> parser) → Parser<T>
Builds a composite parser starting with the specified parser.
inherited
callArg() → Parser<PythonNode>
inherited
callArgumentList() → Parser<({List<ExpressionNode> args, List<KeywordNode> kw})>
inherited
callSelector() → Parser<ExpressionNode Function(ExpressionNode)>
inherited
caseBlock() → Parser<MatchCaseNode>
inherited
caseToken() → Parser<Token<String>>
inherited
classArg() → Parser<PythonNode>
inherited
classArguments() → Parser<({List<ExpressionNode> bases, List<KeywordNode> kw})>
inherited
classDefinition() → Parser<StatementNode>
inherited
classDefRaw() → Parser<ClassDefNode>
inherited
classOrCapturePattern() → Parser<PatternNode>
Class pattern Point(x, y) or simple capture name.
inherited
classToken() → Parser<Token<String>>
inherited
closedPattern() → Parser<PatternNode>
Closed patterns or as-patterns.
inherited
comment() → Parser<String>
inherited
comparison() → Parser<ExpressionNode>
Comparison expressions with chaining: a < b <= c.
inherited
complexLiteral() → Parser<ConstantNode>
inherited
compOp() → Parser<String>
inherited
compoundStatement() → Parser<StatementNode>
inherited
comprehensionClause() → Parser<({ExpressionNode element, List<ComprehensionNode> generators})>
inherited
conditionalExpression() → Parser<ExpressionNode>
Conditional expression: test_or_expr if test else expr.
inherited
conjunction() → Parser<ExpressionNode>
Logical and: a and b and c.
inherited
continueStatement() → Parser<ContinueNode>
inherited
continueToken() → Parser<Token<String>>
inherited
decimalLiteral() → Parser<ConstantNode>
inherited
declaration() → Parser<StatementNode>
Main declaration parser (function or class definition).
inherited
decorator() → Parser<ExpressionNode>
inherited
decorators() → Parser<List<ExpressionNode>>
inherited
defToken() → Parser<Token<String>>
inherited
delimitedString(String quote) → Parser<String>
inherited
delStatement() → Parser<DeleteNode>
inherited
delToken() → Parser<Token<String>>
inherited
dictItems() → Parser<DictNode>
inherited
dictOrSetComp() → Parser<ExpressionNode>
inherited
dictOrSetItems() → Parser<ExpressionNode>
inherited
dictPair() → Parser<({ExpressionNode? key, ExpressionNode val})>
inherited
disjunction() → Parser<ExpressionNode>
Logical or: a or b or c.
inherited
dottedAsName() → Parser<AliasNode>
inherited
dottedAsNames() → Parser<List<AliasNode>>
inherited
dottedName() → Parser<String>
inherited
elifClause() → Parser<({List<StatementNode> body, ExpressionNode test})>
inherited
elifToken() → Parser<Token<String>>
inherited
elseClause() → Parser<List<StatementNode>>
inherited
elseToken() → Parser<Token<String>>
inherited
enclosedInBraces() → Parser<ExpressionNode>
inherited
enclosedInBrackets() → Parser<ExpressionNode>
inherited
enclosedInParen() → Parser<ExpressionNode>
inherited
exceptHandler() → Parser<ExceptHandlerNode>
inherited
exceptStarHandler() → Parser<ExceptHandlerNode>
inherited
exceptToken() → Parser<Token<String>>
inherited
explicitLineContinuation() → Parser<String>
inherited
exponentPart() → Parser<String>
inherited
expression() → Parser<ExpressionNode>
The main expression production.
inherited
expressionList() → Parser<ExpressionNode>
inherited
expressionStatement() → Parser<ExprStatementNode>
inherited
factorExpr() → Parser<ExpressionNode>
Unary operators +x, -x, ~x.
inherited
falseToken() → Parser<Token<String>>
inherited
finallyClause() → Parser<List<StatementNode>>
inherited
finallyToken() → Parser<Token<String>>
inherited
floatLiteral() → Parser<ConstantNode>
inherited
forIfClause() → Parser<ComprehensionNode>
inherited
forIfClauses() → Parser<List<ComprehensionNode>>
inherited
forStatement() → Parser<StatementNode>
inherited
forToken() → Parser<Token<String>>
inherited
fromToken() → Parser<Token<String>>
inherited
fStringDelimited(String quote) → Parser<List<ExpressionNode>>
inherited
fStringLiteral() → Parser<ExpressionNode>
inherited
fStringReplacementField() → Parser<FormattedValueNode>
inherited
functionDefinition() → Parser<StatementNode>
inherited
generatorExpr() → Parser<GeneratorExpNode>
inherited
generatorExpression() → Parser<({List<ExpressionNode> args, List<KeywordNode> kw})>
inherited
globalStatement() → Parser<GlobalNode>
inherited
globalToken() → Parser<Token<String>>
inherited
hexLiteral() → Parser<ConstantNode>
inherited
hiddenStuffWhitespace() → Parser<void>
inherited
hiddenWhitespace() → Parser<void>
inherited
identifier() → Parser<String>
inherited
identifierPart() → Parser<String>
inherited
identifierStart() → Parser<String>
inherited
ifClause() → Parser<ExpressionNode>
inherited
ifStatement() → Parser<IfNode>
inherited
ifToken() → Parser<Token<String>>
inherited
ignore<R>(Parser<R> parser) → Parser<T>
Suppresses newline sensitivity within parser by incrementing the bracket nesting depth, allowing physical newlines as whitespace.
inherited
importFrom() → Parser<ImportFromNode>
inherited
importName() → Parser<ImportNode>
inherited
importStatement() → Parser<StatementNode>
inherited
importToken() → Parser<Token<String>>
inherited
indentedBlock() → Parser<List<StatementNode>>
Indented block of statements.
inherited
indentedStatementLine() → Parser<List<StatementNode>>
inherited
indentedStatements() → Parser<List<StatementNode>>
inherited
inlineWhitespace() → Parser<String>
inherited
inToken() → Parser<Token<String>>
inherited
inversion() → Parser<ExpressionNode>
Logical not: not a.
inherited
isToken() → Parser<Token<String>>
inherited
keyValPattern() → Parser<({ExpressionNode? key, PatternNode? pat, String? rest})>
inherited
keyword(String name) → Parser<Token<String>>
Helper for keywords that must not be followed by an identifier character.
inherited
keywordPatternArg() → Parser<({String? kwd, PatternNode pat})>
inherited
lambdaExpression() → Parser<ExpressionNode>
Lambda expression: lambda [args]: body.
inherited
lambdaParameters() → Parser<ArgumentsNode>
Lambda parameters — like function params but without type annotations. Overridden by PythonDeclarationGrammar to support *args, **kwargs.
inherited
lambdaParamItem() → Parser<({ArgNode? arg, ExpressionNode? defaultVal, bool isBareStar, bool isKwarg, bool isSlash, bool isVararg})>
Like paramItem but without type annotations (for lambda params).
inherited
lambdaToken() → Parser<Token<String>>
inherited
listComp() → Parser<ListCompNode>
inherited
listItems() → Parser<ExpressionNode>
inherited
literalPattern() → Parser<PatternNode>
Literal pattern (numbers, strings, True, False, None).
inherited
mappingDoubleStarRest() → Parser<({ExpressionNode? key, PatternNode? pat, String? rest})>
inherited
mappingItems() → Parser<({List<ExpressionNode> keys, List<PatternNode> patterns, String? rest})>
inherited
mappingPattern() → Parser<PatternNode>
Mapping pattern {"key": val, **rest}.
inherited
matchStatement() → Parser<MatchNode>
inherited
matchToken() → Parser<Token<String>>
inherited
namedExpression() → Parser<ExpressionNode>
Named walrus expression: target := value.
inherited
newlineToken() → Parser<String>
Physical newline token or semicolon separating statements.
inherited
noneToken() → Parser<Token<String>>
inherited
nonlocalStatement() → Parser<NonlocalNode>
inherited
nonlocalToken() → Parser<Token<String>>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notToken() → Parser<Token<String>>
inherited
numberLiteral() → Parser<ConstantNode>
inherited
octalLiteral() → Parser<ConstantNode>
inherited
orPattern() → Parser<PatternNode>
Pattern alternative p1 | p2.
inherited
orToken() → Parser<Token<String>>
inherited
parameterList() → Parser<ArgumentsNode>
inherited
parameters() → Parser<ArgumentsNode>
inherited
paramItem() → Parser<({ArgNode? arg, ExpressionNode? defaultVal, bool isBareStar, bool isKwarg, bool isSlash, bool isVararg})>
inherited
paramWithAnnotation() → Parser<ArgNode>
inherited
passStatement() → Parser<PassNode>
inherited
passToken() → Parser<Token<String>>
inherited
patternArguments() → Parser<({List<String> kwdNames, List<PatternNode> kwdPatterns, List<PatternNode> pos})>
Pattern arguments in class pattern.
inherited
patternItem() → Parser<PatternNode>
inherited
patternItems() → Parser<List<PatternNode>>
inherited
powerExpr() → Parser<ExpressionNode>
Exponentiation ** (right associative).
inherited
primaryExpr() → Parser<ExpressionNode>
Primary expressions and postfix selectors ((), [], .attr).
inherited
pythonPattern() → Parser<PatternNode>
Entry point for pattern matching.
inherited
raiseStatement() → Parser<RaiseNode>
inherited
raiseToken() → Parser<Token<String>>
inherited
returnStatement() → Parser<ReturnNode>
inherited
returnToken() → Parser<Token<String>>
inherited
selector() → Parser<ExpressionNode Function(ExpressionNode)>
inherited
sequencePattern() → Parser<PatternNode>
Sequence pattern [p1, p2] or (p1, p2).
inherited
setItems() → Parser<SetNode>
inherited
shiftExpr() → Parser<ExpressionNode>
Shift expressions <<, >>.
inherited
simpleStatement() → Parser<StatementNode>
inherited
simpleStatements() → Parser<List<StatementNode>>
inherited
singleExpression() → Parser<ExpressionNode>
inherited
singleStringLiteral() → Parser<ExpressionNode>
inherited
sliceExpr() → Parser<SliceNode>
inherited
sliceItem() → Parser<ExpressionNode>
inherited
sliceOrExprList() → Parser<ExpressionNode>
inherited
standardAssignStatement() → Parser<AssignNode>
inherited
standardStringLiteral() → Parser<ConstantNode>
inherited
starOrSingleExpr() → Parser<ExpressionNode>
A star expression or a single expression, for use in tuple/list displays.
inherited
start() → Parser<ModuleNode>
Returns the starting production of this definition.
starTarget() → Parser<ExpressionNode>
inherited
starTargets() → Parser<ExpressionNode>
inherited
statementLine() → Parser<List<StatementNode>>
A line of statements (simple or compound).
inherited
statements() → Parser<List<StatementNode>>
Top-level module statements parser.
inherited
stringLiteral() → Parser<ExpressionNode>
inherited
stringPrefix() → Parser<String>
inherited
subscriptSelector() → Parser<ExpressionNode Function(ExpressionNode)>
inherited
suite() → Parser<List<StatementNode>>
Suite / Block of statements: either a simple inline statement or an indented block of statements.
inherited
sumExpr() → Parser<ExpressionNode>
Addition and subtraction +, -.
inherited
syncFunctionDef() → Parser<FunctionDefNode>
inherited
termExpr() → Parser<ExpressionNode>
Multiplication, division, modulo, matrix multiplication *, /, //, %, @.
inherited
token<T>(Object input) → Parser<Token<T>>
Helper to convert a string or parser into a trimmed token.
inherited
toString() → String
A string representation of this object.
inherited
tripleDelimitedString(String delimiter) → Parser<String>
inherited
tripleQuotedString() → Parser<ConstantNode>
inherited
trueToken() → Parser<Token<String>>
inherited
tryStatement() → Parser<StatementNode>
inherited
tryToken() → Parser<Token<String>>
inherited
tupleOrSingleExpr() → Parser<ExpressionNode>
inherited
typeAliasStatement() → Parser<TypeAliasNode>
inherited
typeParamItem() → Parser<TypeParamNode>
inherited
typeParamList() → Parser<List<TypeParamNode>>
inherited
typeParams() → Parser<List<TypeParamNode>>
inherited
typeToken() → Parser<Token<String>>
inherited
whileStatement() → Parser<WhileNode>
inherited
whileToken() → Parser<Token<String>>
inherited
wildcardPattern() → Parser<PatternNode>
Wildcard pattern _.
inherited
withItem() → Parser<WithItemNode>
inherited
withItems() → Parser<List<WithItemNode>>
inherited
withStatement() → Parser<StatementNode>
inherited
withToken() → Parser<Token<String>>
inherited
yieldExpression() → Parser<ExpressionNode>
Yield and Yield From.
inherited
yieldStatement() → Parser<ExprStatementNode>
inherited
yieldToken() → Parser<Token<String>>
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited