Ejemplo n.º 1
0
    //public static ParserComb.NamedNode LexxAndParse ( string arg ) { return  LexxAndParse( arg , TestMG1.TestStart ) ; }
    public static ParserComb.NamedNode LexxAndParse_incomplete_tolerant(string arg, ParserComb.Parser <Tok> .PI startProd)
    {
        arg.NLSend("lexx and parse incomplete tolerant: ");
        var parse_matches = MG.RUN_with_rest(startProd, LexxAndStripWS(arg));

        foreach (var z in parse_matches)
        {
            z.rest.NLSendRec("pmatch_rest");
        }
        return(parse_matches.First().N);
    }
Ejemplo n.º 2
0
    public static ParserComb.NamedNode LexxAndParse(string arg, ParserComb.Parser <Tok> .PI startProd)
    {
        var parse_matches = MG.RUN_with_rest(startProd, LexxAndStripWS(arg));

        var pmatch_want = parse_matches.First(); // throws, if zero productions - leave this for now

        if (pmatch_want.rest.Any())
        {
            throw new Exception(" first matching prod is an incomplete parse ");
        }


        return(pmatch_want.N);
    }