Table of Contents

Class SqlParser

Namespace
Alternet.Syntax.Parsers.Advanced
Assembly
Alternet.Syntax.Parsers.Advanced.v9.dll

Represents a class that performs syntax and lexical analysis of specified Sql code text.

[ToolboxBitmap(typeof(SqlParser), "Images.SQLParser.Icon.bmp")]
public class SqlParser : SyntaxParser, IComponent, IDisposable, ISyntaxParser, IParser, ILexer, INotify, IUpdate, IImport
Inheritance
SqlParser
Implements

Examples

Here is how to declare a SqlParser and assign it to the edit control from the C# code:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        var parser = new Alternet.Syntax.Parsers.Advanced.SqlParser();
        var edit = new Alternet.Editor.SyntaxEdit();
        edit.Parent = this;
        edit.Lexer = parser;

        string fileName = "myfile.txt";
        if (System.IO.File.Exists(fileName))
        {
            parser.FileName = fileName;
            edit.LoadFile(fileName);
        }
    }
}

Here is how to declare a SqlParser and assign it to the edit control from the Visual Basic code:

Partial Public Class Form1
    Inherits Form

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim parser = New Alternet.Syntax.Parsers.Advanced.SqlParser()
        Dim edit = New Alternet.Editor.SyntaxEdit()
        edit.Parent = Me
        edit.Lexer = parser
        Dim fileName As String = "myfile.txt"

        If System.IO.File.Exists(fileName) Then
            parser.FileName = fileName
            edit.LoadFile(fileName)
        End If
    End Sub
End Class

Remarks

SqlParser is a non-visual component designed to perform syntax highlighting for SQL language. This parser supports complete syntax analysis of the SQL code. When linked to the SyntaxEdit or TextEditor controls, this parser drives additional features such as code completion, code outlining, code formatting, and underlying syntax errors and warnings.

Here are some of the essential features provided by the SqlParser:

  • Syntax Highlighting
  • IntelliSense (Code completion)
  • Code Outlining
  • Structure guidelines
  • Formatting a selected block of text or the whole document.

Constructors

SqlParser()

Initializes a new instance of the SqlParser class with default settings.

Fields

ReswordStyle
lexCommentEndProc
lexCommentProc
lexIdentifierProc
lexNumberProc
lexStringProc
lexSymbolProc
lexWhitespaceProc
prevPosition

Properties

CaseSensitive

Gets or sets a boolean value that indicates whether SqlParser should perform case-sensitive analysis of its content.

FormatCase

Methods

AddAttribute(ISyntaxAttribute)
AddNode(ISyntaxNode)
ClearStack()
CreateExpressionNode(Point, string, int, ISyntaxNode, bool)
CreateListMembers()
CreateParameterInfo()
CreateRepository()

Creates ICodeCompletionRepository to perform code completion functionality for this parser.

Expected(SqlLexerToken)
Expected(SqlLexerToken, SqlLexerToken)
Expected(SqlLexerToken[])
Expected(int)
GetCompletionType(char)

Obtains type of code completion window from specifies char parameter.

GetLexerStyle(int)
IdentifierExpected()
InitLexer()
InitStyles()
IsDatatypeToken(int)
IsDateOrIntervalToken(int)
IsNextQueryToken()
IsReswordToken(int)
IsValidToken(int)
LexComment()
LexCommentEnd()
LexIdentifier()
LexNumber()
LexString()
LexSymbol()
LexWhitespace()
MoveNext()
ParseAdditiveExpression(ref ISyntaxNode)
ParseAlterCreateTable()
ParseAlterQuery()
ParseAlterTable()
ParseAlterTableAdd()
ParseAlterTableAlter()
ParseAlterTableDrop()
ParseAlterUser()
ParseAndExpression(ref ISyntaxNode)
ParseArgumentList(ref ISyntaxNode)
ParseCheckStatement()
ParseColumnDeclaration()
ParseColumnList()
ParseCommitQuery()
ParseCompactQuery()
ParseConstraintDeclaration()
ParseCreateQuery()
ParseCreateSchema()
ParseCreateSequence()
ParseCreateTable()
ParseCreateUser()
ParseCreateView()
ParseDatabaseObject(out string)
ParseDefaultStatement()
ParseDeleteQuery()
ParseDescribeQuery()
ParseDropQuery()
ParseDropSchema()
ParseDropSequence()
ParseDropTable()
ParseDropUser()
ParseDropView()
ParseEqualityExpression(ref ISyntaxNode)
ParseExpression(ref ISyntaxNode)
ParseExpressionList(ref ISyntaxNode)
ParseForeignKeyStatement()
ParseFromClause()
ParseFromStatement()
ParseGrantQuery()
ParseGroupbyStatement()
ParseHavingStatement()
ParseIdentifier(out string)
ParseIdentifierList(out string)
ParseInclusiveOrExpression(ref ISyntaxNode)
ParseInsertQuery()
ParseInvocationExpression(ref ISyntaxNode)
ParseLimitStatement()
ParseMemberAccess(ref ISyntaxNode)
ParseMultiplicativeExpression(ref ISyntaxNode)
ParseOptionalColumnList()
ParseOrderColumn()
ParseOrderbyStatement()
ParseParenthesizedExpression(ref ISyntaxNode)
ParsePrefixedUnaryExpression(ref ISyntaxNode)
ParsePrimaryExpression(ref ISyntaxNode)
ParsePrimaryKeyStatement()
ParseQualifiedIdentifier(out string)
ParseReferenceStatement()
ParseRelationalExpression(ref ISyntaxNode)
ParseRevokeQuery()
ParseRollbackQuery()
ParseSelectColumnList()
ParseSelectQuery()
ParseSelectTable()
ParseSetQuery()
ParseSetStatement()
ParseShowQuery()
ParseShutdownQuery()
ParseSimpleExpression(ref ISyntaxNode)
ParseSubQuery()
ParseTriggeredAction()
ParseType(out string)
ParseUniqueStatement()
ParseUnit()
ParseUnitBody()
ParseUpdateDeleteStatement()
ParseUpdateQuery()
ParseUser(out string)
ParseUserList(out string)
ParseWhereStatement()
ReparseBlock(Point)

Reparses syntax block at specified position.

ReparseText()

Reparses entire text.

ResetCodeCompletionChars()

Resets the CodeCompletionChars to the default value.

ResetOptions()

Resets Options to the default value.

ShouldSerializeCodeCompletionChars()

Indicates whether the CodeCompletionChars property should be persisted.

ShouldSerializeFormatCase()

Indicates whether the FormatCase property should be persisted.

ShouldSerializeOptions()

Indicates whether the Options property should be persisted.

SmartCapitalize(string, StringItemInfo[], ITextUndoList)
SmartFormatLine(int, string, StringItemInfo[], ITextUndoList, out bool)

Formats line according to the parser rules.

SyntaxError()
SyntaxError(int)
SyntaxError(string)
TryParsePostPrimaryExpression(ref ISyntaxNode)