Property Lexer
Lexer
Gets or sets an object that can perform lexical analysis of the text source content.
public virtual ILexer Lexer { get; set; }
Property Value
Examples
Here is how to use a Lexer in the C# code:
using System;
using System.Windows;
using Alternet.Editor.Wpf;
using Alternet.Syntax.Parsers.Roslyn;
public partial class MainWindow : Window
{
private TextSource textSource;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
CsParser parser = new CsParser();
var textEdit1 = new TextEditor();
textSource = new TextSource();
textSource.LoadFile("myfile.txt");
textSource.Lexer = parser;
textEdit1.Source = this.textSource;
}
}
Here is how to use a Lexer in the Visual Basic code:
Imports System
Imports System.Windows
Imports Alternet.Editor.Wpf
Imports Alternet.Syntax.Parsers.Roslyn
Partial Public Class MainWindow
Inherits Window
Private textSource As TextSource
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim parser As CsParser = New CsParser()
Dim textEdit1 = New TextEditor()
textSource = New TextSource()
textSource.LoadFile("myfile.txt")
textSource.Lexer = parser
textEdit1.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.