public final class IslandRecognizer extends Object
IslandScopes over a Pp2TokenStream, using the
SQL scope (S20), clause membership (S21), and block scope (S19) results.
ClausePart at
the same SQL level become SELECT / FROM / JOIN / WHERE / GROUP_BY /
HAVING / ORDER_BY / INTO / INSERT_VALUES / UPDATE_SET islands. A clause
island whose only content is keyword(s) (no operand) is flagged
IncompleteReason.MISSING_OPERAND, and an IslandKind.ERROR_REGION
island is emitted over the dangling tokens (length-capped by
Pp2FormatOptions.maxErrorRegionSize).IslandKind.CTE island (if its ( is preceded by AS)
or a IslandKind.SUBQUERY island; an unclosed one is flagged
IncompleteReason.UNCLOSED_PAREN.CASE ... END spans (iterative, nesting-aware,
END CASE qualifier handled); an unterminated CASE is flagged
IncompleteReason.MISSING_END.MERGE statement span (light: keyword to
statement end).Islands may nest/overlap; the result is sorted by start index. The
recogniser is iterative (explicit ArrayDeque) and read-only — it does
not mutate any Pp2Token.
Plan reference: §7.3/S22, §7.4/S22.
| Constructor and Description |
|---|
IslandRecognizer() |
| Modifier and Type | Method and Description |
|---|---|
List<IslandScope> |
recognize(Pp2TokenStream stream,
SqlScopeDetector.SqlScopeResult sql,
ClauseScopeAnnotator.ClauseScopeResult clause,
Pp2FormatOptions opts)
Recognise islands over
stream. |
public IslandRecognizer()
public List<IslandScope> recognize(Pp2TokenStream stream, SqlScopeDetector.SqlScopeResult sql, ClauseScopeAnnotator.ClauseScopeResult clause, Pp2FormatOptions opts)
stream.stream - the token stream; must not be nullsql - S20 scope result for the same stream; must not be nullclause - S21 clause result for the same stream; must not be nullopts - pp2 options (for maxErrorRegionSize); must not be nullNullPointerException - if any argument is null