#pragma once #include #include #include #include #include #include #include namespace NSQLComplete { struct TEditRange { size_t Begin = 0; size_t Length = 0; }; struct TLocalSyntaxContext { using TKeywords = THashMap>; struct TPragma { TString Namespace; }; struct TFunction { TString Namespace; ENodeKind ReturnType = ENodeKind::Any; }; struct THint { EStatementKind StatementKind; }; struct TCluster { TString Provider; }; struct TObject { TString Provider; TString Cluster; TString Path; THashSet Kinds; bool HasCluster() const { return !Cluster.empty(); } bool IsDeferred() const { return Kinds.empty(); } }; struct TColumn { TString Table; }; struct TQuotation { bool AtLhs = false; bool AtRhs = false; explicit operator bool() const { return AtLhs || AtRhs; } }; TKeywords Keywords; TMaybe Pragma; bool Type = false; TMaybe Function; TMaybe Hint; TMaybe Object; TMaybe Cluster; TMaybe Column; bool Binding = false; TQuotation IsQuoted; TEditRange ReplaceRange; TEditRange FilterRange; }; // TODO(YQL-19747): Make it thread-safe to make ISqlCompletionEngine thread-safe. class ILocalSyntaxAnalysis { public: using TPtr = THolder; virtual ~ILocalSyntaxAnalysis() = default; virtual TLocalSyntaxContext Analyze(TCompletionInput input) = 0; }; ILocalSyntaxAnalysis::TPtr MakeLocalSyntaxAnalysis( TLexerSupplier lexer, const THashSet& ignoredRules, const THashMap>& disabledPreviousByToken, const THashMap>& forcedPreviousByToken); } // namespace NSQLComplete