1
Vote

WinRT compatibility && I can't build it

description

I want to use GPLEX with a WinRT (portable class library) application, however, it's not at all compatible.

Serialization, Reflection, Encoding, Files, Console and other things differ.

There are issues in both the boiler plate code and the generated code.

Do you have in mind to Make it Portable Class Library compatible?

I'd be prepared (in principle) to tackle this myself, but the donwloaded zip file appears to be missing parser.cs, Scanner.cs and GplexBuffers.cs ) so I can't build it.

Iain

comments

IainDowns wrote Nov 30, 2014 at 11:06 AM

For what it's worth, I've discovered that you have to run the batch file GenerateAll to make the cs files.

To get this create RT compatible code I've done the following:-

**In the target project, created a SerialiazableAttribute class which does nothing (the Exceptions contain a Serializable attribute)
**In the Gplex SpecFiles removed the BufferException constructor with serialization int GplexBuffers. WinRT doesn't support this - DataContracts are the new way, apparently.

**In the target project Created a class to mimic Console
public class Console
{
    private static Console _console ;

    public static Console Out
    {
        get { if (_console == null) { _console = new Console();}
            return _console;
        }
    }

    public void Write(string format, params object[] p)
    {
        System.Diagnostics.Debug.WriteLine(format, p);
    }

    public static void WriteLine(string format, params object[] p)
    {
        System.Diagnostics.Debug.WriteLine(format, p);
    }
}
** in the lex file use the nofiles option AND unicode. In the target project define NOFILES to stop the file reading stuff being compiled. THis leaves me with a scanner that requires a string input, but bypasses the swathes of changes to support lack of code pages and the changes to the file reading bits (async and so on)

** Rework the way GetMaxParseToken is defined (in gplexx.frame) to avoid reflection
    private static int GetMaxParseToken() {

-->translate $Tokens t;

-->translate if ($Tokens.TryParse("maxParseToken", false, out t))

        {
            return (int) t;
        }
        else
        {
            return int.MaxValue;
        }
    }

I think that's it. GPLex won't run under WinRT and the generated code has some restrictions, but it's got me going. I will leave any more sophisticated fixes to someone who understands how it works.

Sadly, the scanner generated still doesn't correctly tokenise CSS2.1 which was my intent, but that's hardly the fault of GPLex!