Class PartialEk9StringToInstructionBlock
- All Implemented Interfaces:
Function<String, PartialEk9StringToInstructionBlock.Result>
instructionBlock — a contiguous run
of block statements (the body of a method / function / loop / branch). This is
the sub-rule counterpart to PartialEk9StringToTypeDef: instead of the
whole compilation unit, ANTLR is entered at the instructionBlock rule.
Used by the extract-method analysis: the selected block's raw text is
re-parsed here to (a) get an isolated tree to classify variable def/use on, and
(b) validate the selection lands on statement boundaries — a snippet that does
not parse cleanly as an instruction block is a mid-statement / unbalanced
selection, surfaced through PartialEk9StringToInstructionBlock.Result.hasErrors().
Indentation: instructionBlock itself carries no enclosing
INDENT/DEDENT (the grammar wraps it in block for that), so the snippet
should be supplied left-trimmed to column 0; any nested if/for/
while bodies keep their relative indent and the indentation lexer emits
their INDENT/DEDENT pairs. The text must end with a newline (the rule requires
each statement be followed by NL+).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe parse outcome: the block context (may be partial when there are errors) and the error listener so callers can gate on a clean parse. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription
-
Constructor Details
-
PartialEk9StringToInstructionBlock
public PartialEk9StringToInstructionBlock()
-
-
Method Details
-
apply
- Specified by:
applyin interfaceFunction<String, PartialEk9StringToInstructionBlock.Result>
-