Table of Contents

Property Lexer

Namespace
Alternet.Editor.TextSource
Assembly
Alternet.Editor.v9.dll

Lexer

Gets or sets an object that can perform lexical analysis of the text source content.

public virtual ILexer Lexer { get; set; }

Property Value

ILexer

Examples

Here is how to use a Lexer in the C# code:

using Alternet.Editor;
using Alternet.Editor.TextSource;
using Alternet.Syntax.Parsers.Roslyn;

public partial class Form1 : Form
{
    private TextSource textSource;
    private void Form1_Load(object sender, EventArgs e)
    {
        CsParser parser = new CsParser();
        var syntaxEdit = new SyntaxEdit(this.components);
        textSource = new TextSource(this.components);
        textSource.LoadFile("myfile.txt");

        textSource.Lexer = parser;
        syntaxEdit.Source = this.textSource;
    }
}

Here is how to use a Lexer in the Visual Basic code:

Imports Alternet.Editor
Imports Alternet.Editor.TextSource
Imports Alternet.Syntax.Parsers.Roslyn

Partial Public Class Form1
    Inherits Form

    Private textSource As TextSource

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Dim parser As CsParser = New CsParser()
        Dim syntaxEdit = New SyntaxEdit(Me.components)
        textSource = New TextSource(Me.components)
        textSource.LoadFile("myfile.txt")
        textSource.Lexer = parser
        syntaxEdit.Source = Me.textSource
    End Sub
End Class

Remarks

Use Lexer property to get or set an object that performs lexical analysis of the text stored by this TextSource object.