Table of Contents

Class IronPythonParser

Namespace
Alternet.Syntax.Parsers.Python
Assembly
Alternet.Syntax.Parsers.Advanced.Python.v9.dll
[ToolboxBitmap(typeof(ToolboxImageHelper), "Images.PythonNETParser.Icon.bmp")]
public class IronPythonParser : PythonNETParser, IComponent, IDisposable, ISyntaxParser, IParser, ILexer, INotify, IUpdate, IImport
Inheritance
IronPythonParser
Implements

Examples

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

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

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

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

Remarks

IronPythonParser is a non-visual component designed to perform syntax highlighting and provide advanced code editing capabilities for the Iron Python language. This parser supports full syntax and semantic analysis of the Python code. When linked to the SyntaxEdit or TextEditor controls, this parser drives additional features such as code completion, code outlining, code formatting, highlighting types in different colors, and underlying syntax and semantic errors and warnings.

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

  • Syntax Highlighting
  • IntelliSense (Code completion)
  • Signature Help (displaying parameter information for methods)
  • Code Outlining
  • Structure guidelines
  • Formatting a selected block of text or the whole document
  • Finding declarations and references

Constructors

IronPythonParser()

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

Methods

CreateSemanticModel()