%DeepSee.SQL.Parser
Class %DeepSee.SQL.Parser Extends %RegisteredObject
Include %qaqplex
Properties
%Input
Property %Input As %String [ MultiDimensional ];
%TokenList
Property %TokenList As %DynamicArray;
The ordered list of complete tokens
%Position
Property %Position As %Integer [ InitialExpression = 0 ];
Current position in the string
%InputPart
Property %InputPart As %Integer [ InitialExpression = 0 ];
Current part of the input being processed
%CurrentToken
Property %CurrentToken As %String;
Accumulator for the current token
%LastToken
Property %LastToken As %String;
Container for the last complete token. This is used for looking back when there are multiple tokens in a succession.
state
Property state As %DynamicObject;
Any state information can be packed into this object, which can be pushed or popped from a stack if needed.
stack
Property stack As %DynamicArray;
Stack for changing state
Methods
%OnNew
Method %OnNew(pInput As %String) As %Status
Optionally set the input as the object is created.
%InitializeState
Method %InitializeState() As %Status
Initialize the state object.
%SetInput
Method %SetInput(pInput) As %Status
Set the current input to be analyzed.
%Tokenize
Method %Tokenize() As %Status
Walk through the string per character and tokenize.
%CheckDollar
Method %CheckDollar(pString As %String = "") As %Integer [ Private ]
Investigate the current position for $ tokens. Returns the number of consecutive dollar sign characters beginning at the current position
%IsWhiteSpace
Method %IsWhiteSpace(pChar As %String = "") As %Boolean [ Private ]
Test for white space character
%IsSeparatorChar
Method %IsSeparatorChar(pChar As %String = "", pPosition As %Integer = {..%Position}) As %Boolean [ Private ]
Test for a characer separating two different terms.
%IsOperatorChar
Method %IsOperatorChar(pChar As %String = "", Output pOpLength) As %Boolean
Test for a single-character operator
%IsOperatorToken
Method %IsOperatorToken(pToken As %String = "") As %Boolean
Test for an opertor token of arbitrary length
%IsFunction
Method %IsFunction(pToken As %String = "", Output pFunctionArity) As %Boolean [ Private ]
Test for a supported function
%IsScalarFunction
Method %IsScalarFunction(pToken As %String = "", Output pFunctionArity) As %Boolean [ Private ]
Test for a supported scalar function
%IsAggFunction
Method %IsAggFunction(pToken As %String = "", Output pFunctionArity) As %Boolean [ Private ]
%IsCastType
Method %IsCastType(pToken As %String = "", pFunctionArity) As %Boolean [ Private ]
Type arguments in the CAST function can look like
%IsDSMacro
Method %IsDSMacro(pToken As %String = "", pFunctionArity) As %Boolean [ Private ]
Test for one of the DeepSee-specific macro functions
%IsUserFunction
Method %IsUserFunction(pFunction, pLastToken = {..%LastToken}) As %Boolean
%PushCurrentToken
Method %PushCurrentToken() As %Status [ Private ]
%PushState
Method %PushState() As %Status [ Private ]
Push the current parser state to the stack and initialize a new state object
%PopState
Method %PopState() As %Status [ Private ]
Restore the last state from the top of the stack.
%ParseSelect
ClassMethod %ParseSelect(pSelectTokens As %DynamicArray, Output pParsedTree, Output pSpecialTokens) As %Status
Parse SELECT list for a DeepSee listing. The output pParsedTree is a %DynamicArray containing the individual select terms.
%GetTokenList
Method %GetTokenList() As %DynamicArray
Returns the current %TokenList array
%PrintInput
Method %PrintInput(pVerbose = 1) As %String
Print the current inputas set by %SetInput. If pVerbose = 1, print the string to the current device.
%PrintTokenList
Method %PrintTokenList(pVerbose = 1) As %String
%ProcessSelectItem
Method %ProcessSelectItem(pSelectItemTokens As %DynamicArray, pHeaderPos, pDomain As %String = "", Output pSelectItemPair, pLocalize As %Boolean = 0) As %Status
Reassemble the select Item in both the logical and display versions. The parameter pLocalize allows the caller to request translation of the header string to the current locale. A default domain for this translation can be supplied via pDomain. When defined, this default is used if there is no domain explicitly declared as the second argument of $$$TEXT.
%ProcessDsTEXT
Method %ProcessDsTEXT(pTextMacroTokens As %DynamicArray, pDomain As %String = "", Output pStatus, pLocalize As %Boolean = 0) As %String
Extract the display header from the $$$TEXT macro. The parameter pLocalize allows the caller to request translation of the header string to the current locale. A default domain for this translation can be supplied via pDomain. When defined, this default is used if there is no domain explicitly declared as the second argument of $$$TEXT.