Package gudusoft.gsqlparser.parser
Class SoqlSqlParser
Object
gudusoft.gsqlparser.parser.AbstractSqlParser
gudusoft.gsqlparser.parser.SoqlSqlParser
- All Implemented Interfaces:
SqlParser
Salesforce SOQL (Salesforce Object Query Language) parser implementation.
This parser handles SOQL-specific SQL syntax including:
- SOQL SELECT statements
- SOQL relationship queries
- SOQL aggregate functions
- Salesforce-specific syntax elements
Design Notes:
- Extends
AbstractSqlParserusing the template method pattern - Uses
TLexerSoqlfor tokenization - Uses
TParserSoqlfor parsing - Tokenization follows MSSQL pattern
- Delimiter character: ';' for SOQL statements
- Since:
- 3.2.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class gudusoft.gsqlparser.parser.AbstractSqlParser
AbstractSqlParser.PreparedSqlReader -
Field Summary
FieldsFields inherited from class gudusoft.gsqlparser.parser.AbstractSqlParser
defaultDelimiterStr, delimiterChar, frameStack, globalContext, globalFrame, lexer, parserContext, sourcetokenlist, sqlcmds, sqlEnv, sqlstatements, syntaxErrors, vendor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCall SOQL-specific raw statement extraction logic.protected TCustomLexergetLexer(ParserContext context) Return the SOQL lexer instance.protected TCustomParsergetParser(ParserContext context, TSourceTokenList tokens) Return the SOQL parser instance with updated token list.protected voidperformInterpreter(ParserContext context, TStatementList statements) Perform interpretation/evaluation on parsed statements.protected TStatementListperformParsing(ParserContext context, TCustomParser parser, TCustomParser secondaryParser, TSourceTokenList tokens, TStatementList rawStatements) Perform full parsing of statements with syntax checking.protected voidperformSemanticAnalysis(ParserContext context, TStatementList statements) Perform semantic analysis on parsed statements.protected voidSetup SOQL parser for raw statement extraction.protected voidCall SOQL-specific tokenization logic.Methods inherited from class gudusoft.gsqlparser.parser.AbstractSqlParser
afterStatementParsed, attemptErrorRecovery, copyErrorsFromStatement, doAfterTokenize, doExtractRawStatements, extractRawStatements, getanewsourcetoken, getDefaultDelimiterStr, getDelimiterChar, getErrorCount, getrawsqlstatements, getSecondaryParser, getSyntaxErrors, getVendor, handleStatementParsingException, initializeGlobalContext, isDollarFunctionDelimiter, onRawStatementComplete, onRawStatementCompleteVendorSpecific, parse, performTokenization, prepareSqlReader, processTokensBeforeParse, processTokensInTokenTable, setTokenHandle, tokenize, toString, towinlinebreak
-
Field Details
-
flexer
The SOQL lexer used for tokenization
-
-
Constructor Details
-
SoqlSqlParser
public SoqlSqlParser()Construct SOQL parser.Configures the parser for Salesforce SOQL with default delimiter (;).
-
-
Method Details
-
getLexer
Return the SOQL lexer instance.- Specified by:
getLexerin classAbstractSqlParser- Parameters:
context- the parser context- Returns:
- configured lexer instance (never null)
-
getParser
Return the SOQL parser instance with updated token list.- Specified by:
getParserin classAbstractSqlParser- Parameters:
context- the parser contexttokens- the source token list- Returns:
- configured parser instance (never null)
-
tokenizeVendorSql
Call SOQL-specific tokenization logic.SOQL uses MSSQL-like tokenization.
- Specified by:
tokenizeVendorSqlin classAbstractSqlParser
-
setupVendorParsersForExtraction
Setup SOQL parser for raw statement extraction.- Specified by:
setupVendorParsersForExtractionin classAbstractSqlParser
-
extractVendorRawStatements
Call SOQL-specific raw statement extraction logic.- Specified by:
extractVendorRawStatementsin classAbstractSqlParser- Parameters:
builder- the result builder to populate with raw statements
-
performParsing
protected TStatementList performParsing(ParserContext context, TCustomParser parser, TCustomParser secondaryParser, TSourceTokenList tokens, TStatementList rawStatements) Perform full parsing of statements with syntax checking.- Specified by:
performParsingin classAbstractSqlParser- Parameters:
context- the parser contextparser- the main parser instancesecondaryParser- secondary parser (may be null)tokens- the source token listrawStatements- raw statements already extracted (never null)- Returns:
- statement list with parsed AST (never null)
-
performSemanticAnalysis
Description copied from class:AbstractSqlParserPerform semantic analysis on parsed statements.Hook Method: Default implementation does nothing. Override to provide vendor-specific semantic analysis.
Typical Implementation:
- Column-to-table resolution (TSQLResolver)
- Dataflow analysis
- Reference resolution
- Scope resolution
- Overrides:
performSemanticAnalysisin classAbstractSqlParser- Parameters:
context- the parser contextstatements- the parsed statements (mutable)
-
performInterpreter
Description copied from class:AbstractSqlParserPerform interpretation/evaluation on parsed statements.Hook Method: Default implementation does nothing. Override to provide AST interpretation/evaluation.
Typical Implementation:
- Execute simple SQL statements
- Evaluate expressions
- Constant folding
- Static analysis
- Overrides:
performInterpreterin classAbstractSqlParser- Parameters:
context- the parser contextstatements- the parsed statements (mutable)
-