extending ILLParseData interface

SyntaxEditor for WPF Forum

Posted 7 years ago by David Freibrun
Version: 12.2.0570
Avatar

I would like to populate a treeview control while parsing thru the data of a document. It looks like this can be done by extending the ILLParseData interface.  I do find a mention of this in the documentation under

LL(*) Parser Framework / Parser Infrastructure / ILLParseData Interface

"It is possible that you will want to retain additional information from the parsing process than what is provisioned with this type. For instance, an XML language may wish to store a boolean flag indicating whether the document is well-formed. If this is the case, you can create a new parse data class that inherits from LLParseData. You can then add any additional properties you wish to be available."

 

Where do I create a new parse data class that inherits from LLParseData?  What areas of the code would need to be revised? Can you provide a short example? maybe using the Simple language that is used in the product samples?

Comments (3)

Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi David,

Our Web Languages Add-on and its XML language implements this class:

public class XmlParseData : LLParseData, IXmlParseData {
	public bool IsWellFormed { get; set; }
}

Then our XmlParserBase class (which inherits LLParserBase) does something along the lines of this:

protected override IParseData CreateParseData(IParseRequest request, IParserState state) {
	XmlParseData parseData = new XmlParseData();

	// Initialize
	this.InitializeParseData(parseData, state);

	// Pass on parser context data
	XmlParserContext context = state.CustomData as XmlParserContext;
	if (context != null)
		parseData.IsWellFormed = context.IsWellFormed;

	return parseData;
}

Hope that helps!


Actipro Software Support

Posted 7 years ago by David Freibrun
Avatar

I attempted to create a class like was done above for XmlParseData.. Its telling me it does not implement the interface members. See errors below. I don't know how to implement these interface members 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using ActiproSoftware.Text.Parsing.LLParser;

namespace MyNameSpace
{
interface ITreeParseData
{
TreeView treeView { get; set; }
}

public class treeParseData : ILLParseData, ITreeParseData
{
public TreeView treeView { get; set; }

}
}

I get an error on class treeParseData that says "

Error 1 'MyNameSpace.treeParseData' does not implement interface member 'ActiproSoftware.Text.Parsing.IParseErrorProvider.Snapshot'
Error 2 'MyNameSpace.treeParseData' does not implement interface member 'ActiproSoftware.Text.Parsing.IParseErrorProvider.Errors'
Error 3 'MyNameSpace.treeParseData' does not implement interface member 'ActiproSoftware.Text.Parsing.LLParser.ILLParseData.Ast'

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi David,

If you look up those interfaces (ILLParseData inherits them), you can see their definitions.  But the easier way would be to have your treeParseData class inherit LLParseData since that already implements them.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.