protected override bool TryParseToken(CommonScriptCursor cursor, out Token token) { if (!base.TryParseToken(cursor, out token)) { return(false); } if (token.Type is TokenType.MultiLineComment or TokenType.SingeLineComment) { var(offset, length) = token.Span.GetOffsetAndLength(cursor.Length); ReadOnlySpan <char> span = cursor.Value.AsSpan(offset, length); if (ImpalaUtility.IsCommentPlanHint(span)) { token = new Token(TokenType.Fragment, token.Span); } } return(true); }
public IQsiTreeNode Parse(QsiScript script, CancellationToken cancellationToken = default) { var parser = ImpalaUtility.CreateParserInternal( script.Script, Dialect ); var stmt = parser.root().stmt(); switch (stmt.children[0]) { case Query_stmtContext queryStmt: return(TableVisitor.VisitQueryStmt(queryStmt)); case Create_view_stmtContext createViewStmt: return(ActionVisitor.VisitCreateViewStmt(createViewStmt)); case Create_tbl_as_select_stmtContext createTblAsSelectStmt: return(ActionVisitor.VisitCreateTblAsSelectStmt(createTblAsSelectStmt)); case Use_stmtContext useStmt: return(ActionVisitor.VisitUseStmt(useStmt)); case Upsert_stmtContext upsertStmt: return(ActionVisitor.VisitUpsertStmt(upsertStmt)); case Update_stmtContext updateStmt: return(ActionVisitor.VisitUpdateStmt(updateStmt)); case Insert_stmtContext insertStmt: return(ActionVisitor.VisitInsertStmt(insertStmt)); case Delete_stmtContext deleteStmt: return(ActionVisitor.VisitDeleteStmt(deleteStmt)); default: throw TreeHelper.NotSupportedTree(stmt.children[0]); } }
protected bool IsCommentPlanHint() { return(ImpalaUtility.IsCommentPlanHint(Text)); }
public ImpalaLanguageService(Version version) { Dialect = ImpalaUtility.CreateDialect(version); }
protected override (ITree Tree, string[] RuleNames) ParseAntlrTree(string input) { var parser = ImpalaUtility.CreateParserInternal(input, _dialect); return(parser.root(), parser.RuleNames); }
protected override IRawTreeParser CreateRawTreeParser() { return(new ImpalaRawParser(ImpalaUtility.CreateDialect(_verseion))); }