public final class TokenEquivalence extends Object
The contract — verified by 12 hand-built cases in
TokenEquivalenceTest — is that two SQL strings are equivalent
when:
caseInsensitive=true. Quoted identifiers, string
literals, and operator/punctuation tokens are always compared
byte-exact because case changes there alter semantics.This helper is the safety net for several downstream slices:
GuardedAstDelegate) — verifies that
FormatterFactory.pp()'s output preserves every solid
input token.The helper deliberately operates on raw SQL strings (not
Pp2TokenStream instances) because the comparison is between an
arbitrary input and an arbitrary output — there is no single pp2 stream
shared between the two. The internal tokenization uses the GSP lexer
directly with the same overlap-skip discipline as
Pp2TokenStreamBuilder.
Plan reference: §7.3/S10, §7.4/S10, Q8.
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equalsModuloFormatting(String left,
String right,
Pp2FormatOptions opts)
Case-insensitive comparison using the default Oracle dialect.
|
static boolean |
equalsModuloFormatting(String left,
String right,
Pp2FormatOptions opts,
EDbVendor vendor,
boolean caseInsensitive)
Full-control comparison.
|
public static boolean equalsModuloFormatting(String left, String right, Pp2FormatOptions opts)
public static boolean equalsModuloFormatting(String left, String right, Pp2FormatOptions opts, EDbVendor vendor, boolean caseInsensitive)
left - first SQL string; must not be nullright - second SQL string; must not be nullopts - pp2 options (currently unused, reserved for future
comment-tolerance settings); may be nullvendor - dialect to tokenize with; must not be nullcaseInsensitive - when true, keyword and unquoted
identifier comparisons are case-insensitive;
when false, all comparisons are
byte-exact on texttrue iff the two strings have the same token
sequence under the rules described in the class JavadocNullPointerException - if left, right, or
vendor is null