Table of Contents

Class VbScriptParser

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

Represents a class that performs syntax and lexical analysis of the specified Visual Basic code.

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

Examples

Here is how to declare a VbScriptParser 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.VbScriptParser();
        var edit = new Alternet.Editor.SyntaxEdit();
        edit.Parent = this;
        edit.Lexer = parser;

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

Here is how to declare a VbScriptParser 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.VbScriptParser()
        Dim edit = New Alternet.Editor.SyntaxEdit()
        edit.Parent = Me
        edit.Lexer = parser
        Dim fileName As String = "myfile.vbs"

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

Remarks

VbScriptParser is a non-visual component designed to perform syntax highlighting for the Visual Basic Script language. This parser supports full syntax analysis of the Visual Basic Script 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 VbScriptParser:

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

Constructors

VbScriptParser()

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

Fields

ReswordStyle
StateNormal
lexCommentProc
lexIdentifierProc
lexNumberProc
lexStringProc
lexSymbolProc
lexWhitespaceProc
prevPosition
reswords
savePrevPosition

Properties

CaseSensitive

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

Methods

AddAttribute(ISyntaxAttribute)
AddNode(ISyntaxNode)
AfterDeclaration(ISyntaxNode)
AssignParser(ISyntaxParser)
BeforeDeclaration(ISyntaxNode)
CheckParentNodeWithSameType(ref ISyntaxNode)
ClearStack()
CreateExpressionNode(Point, string, int, ISyntaxNode, bool)
CreateListMembers()
CreateParameterInfo()
CreateRepository()

Creates ICodeCompletionRepository to perform code completion functionality for this parser.

EndExpression()
Expected(VbScriptLexerToken)
Expected(VbScriptLexerToken, VbScriptLexerToken)
Expected(int)
FinishParsing()

Commits parsing process.

GetAutoFormatNode(Point, bool, out Point)

Obtains block node at specified position.

GetBlockNode(ISyntaxNode, Point)
GetCompletionType(char)

Obtains type of code completion window from specifies char parameter.

GetIncompleteNode(ISyntaxNode)
GetLexerStyle(int)
GetSingleLineComment()

Gets the string that represents start symbol of single line comment.

GetStructureGuideLines(IList<IRange>)

Gets list of guide lines.

IdentifierExpected()
InitGlobalModules(IReflectionRepository)
InitLanguage()
InitLexer()
InitReswords()
InitStyles()
IsComment(int)
IsDeclaration(ISyntaxNode)

Indicates whether specified node is a declaration node (contains declaration of some syntax structure, such as class, namespace and so on).

IsDeclarationToken(int)
IsIdentifierToken(int)
IsIncompleteNode(ref ISyntaxNode)
IsInvalidBlockToken(int)
IsInvalidExpressionToken(int)
IsModifier(int)
IsParameterModifier(int)
IsReswordToken(int)
IsSymbol(int)
IsValidToken(int)
LexComment()
LexHexNumber()
LexIdentifier()
LexNumber()
LexString()
LexSymbol()
LexWhitespace()
MoveNext()
NextToken()

Parses text from current position to the next token and updates TokenPos, CurrentPos and TokenString properties.

ParseAdditiveExpression(ref ISyntaxNode)
ParseAndExpression(ref ISyntaxNode)
ParseArgument(ref ISyntaxNode)
ParseArgumentList(ref ISyntaxNode, bool)
ParseArraySizeInitializationModifier(out string)
ParseBlock()
ParseBlock(int)
ParseBlock(int[], ref bool)
ParseBlockStatement(int, int)
ParseBlockStatementEnd(int)
ParseCallStatement()
ParseCaseClause()
ParseCaseClauses()
ParseCaseStatement()
ParseCastTargetExpression(ref ISyntaxNode, VbScriptLexerToken)
ParseClassBody()
ParseClassDeclaration(ISyntaxAttributes)
ParseComment()
ParseDeclarationEnd(int)
ParseDefaultBlock()
ParseDoStatement()
ParseElseIfStatement()
ParseElseStatement(bool)
ParseEmbeddedStatement()
ParseEmbeddedStatement(ISyntaxAttributes)
ParseEqualityExpression(ref ISyntaxNode)
ParseEraseStatement()
ParseExclusiveOrExpression(ref ISyntaxNode)
ParseExecuteStatement(bool)
ParseExitStatement()
ParseExpression(ref ISyntaxNode)
ParseExpressionBlockStatement(int, int)
ParseExpressionStatement()
ParseFieldDeclaration(ISyntaxAttributes, Point, string, ISyntaxNodes, int)
ParseForEachStatement(ISyntaxNode)
ParseForIterator()
ParseForStatement()
ParseGotoStatement()
ParseIdentifier(out string)
ParseIfStatement()
ParseImpExpression(ref ISyntaxNode)
ParseInclusiveOrExpression(ref ISyntaxNode)
ParseInvocationExpression(ref ISyntaxNode, bool)
ParseLabelName(out string)
ParseLoopControlVariable()
ParseMemberAccess(ref ISyntaxNode)
ParseMemberAccess(ref ISyntaxNode, int)
ParseMethodBody(int)
ParseMethodDeclaration(ISyntaxAttributes)
ParseMethodDeclaration(ISyntaxNode, bool)
ParseModifiers(ref ISyntaxAttributes)
ParseMultiplicativeExpression(ref ISyntaxNode)
ParseNewExpression(ref ISyntaxNode)
ParseOnErrorStatement()
ParseOptionStatement()
ParseParameterDeclaration()
ParseParameterListDeclaration()
ParseParameterListDeclaration(int, int)
ParseParenthesizedExpression(ref ISyntaxNode)
ParsePrefixedUnaryExpression(ref ISyntaxNode)
ParsePrimaryExpression(ref ISyntaxNode)
ParsePropertyBody()
ParsePropertyDeclaration(ISyntaxNode)
ParsePropertyStatement()
ParseQualifiedIdentifier(out string)
ParseRandomizeStatement()
ParseRelationalExpression(ref ISyntaxNode)
ParseSelectStatement()
ParseSetStatement()
ParseSimpleExpression(ref ISyntaxNode, ref bool)
ParseStatement(bool)
ParseStatementExpression()
ParseStatementExpressionList()
ParseStatementList()
ParseStatementTerminator()
ParseStatementTerminator(int)
ParseStopStatement()
ParseTypeName(out string)
ParseUnit()
ParseUnitBody()
ParseVariableDeclaration(ISyntaxAttributes, Point, int)
ParseVariableIdentifier(out string)
ParseVariableInitializer(ref ISyntaxNode)
ParseWhileStatement()
ParseWithStatement()
PositionChanged(int, int, int, int)

Changes positions of any syntax nodes and its elements located next to the specified position.

ProcessAutoComplete(string, Point, out string)

Checks whether end-of-block code needs inserting.

ProcessGuideLines(IList<IRange>, ISyntaxNode)
ProcessGuideLinesInternal(IList<IRange>)
RegisterAssembly(Assembly)

Adds specified assembly for code completion to the repository's assembly list.

RegisterAssembly(string)

Adds specified assembly for code completion to the repository's assembly list.

ReparseBlock(ISyntaxNode, Point)
ReparseBlock(Point)

Reparses syntax block at specified position.

ReparseBlock(ref Point, string, out ISyntaxNode, CodeCompletionType)

Reparses syntax block at specified position.

ReparseText()

Reparses entire text.

ResetAutoIndentChars()

Resets AutoIndentChars to the default value.

ResetCodeCompletionChars()

Resets CodeCompletionChars to the default value.

ResetCodeCompletionStopChars()

Resets CodeCompletionStopChars to the default value.

ResetOptions()

Resets Options to the default value.

ResetSmartFormatChars()

Resets SmartFormatChars to the default value.

RestoreState(bool)

Restores Parser state and position stored by SaveState method.

SaveState()

Saves current Parser state and position.

ShouldSerializeAutoIndentChars()

Indicates whether the AutoIndentChars property should be persisted.

ShouldSerializeCodeCompletionChars()

Indicates whether the CodeCompletionChars property should be persisted.

ShouldSerializeCodeCompletionStopChars()

Indicates whether the CodeCompletionStopChars property should be persisted.

ShouldSerializeOptions()

Indicates whether the Options property should be persisted.

ShouldSerializeSmartFormatChars()

Indicates whether the SmartFormatChars property should be persisted.

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

Formats line according to the parser rules.

StartExpression()
SyntaxError()
SyntaxError(Point, Point, string, string)
SyntaxError(int)
SyntaxError(string)
TryParseArraySizeInitializationModifier(out string)
TryParseAssignmentExpression(ref ISyntaxNode, int)
TryParsePostPrimaryExpression(ref ISyntaxNode, int)
TryParseWhileOrUntil(out bool)
UnregisterAssembly(Assembly, bool)

Removes specified assembly from the repository's assembly list.

UnregisterAssembly(string, bool)

Removes specified assembly from the repository's assembly list.

UpdateLine()