* refactor: rename flinksql to flink * refactor: rename pgsql to postgresql * refactor: rename trinosql to trino * refactor: replace all default exports with named export * refactor: rename basicParser to basicSQL * refactor: rename basic-parser-types to types * refactor: replace arrow func with plain func
18 lines
533 B
TypeScript
18 lines
533 B
TypeScript
import * as antlr from "antlr4ng";
|
|
export abstract class SQLParserBase<T = antlr.ParserRuleContext> extends antlr.Parser{
|
|
public constructor(input: antlr.TokenStream) {
|
|
super(input);
|
|
}
|
|
|
|
public abstract program(): T;
|
|
|
|
public caretTokenIndex = -1;
|
|
|
|
public entityCollecting = false;
|
|
|
|
public shouldMatchEmpty () {
|
|
return this.entityCollecting
|
|
&& this.tokenStream.LT(-1).tokenIndex <= this.caretTokenIndex
|
|
&& this.tokenStream.LT(1).tokenIndex >= this.caretTokenIndex
|
|
}
|
|
} |