Exemplo n.º 1
0
 internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
 {
     if (ctxt.isEof())
     {
         return Scanners.setErrorExpecting(out err, expected_name, ctxt);
     }
     ctxt.next();
     return true;
 }
Exemplo n.º 2
0
 internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
 {
     if (ctxt.isEof())
     {
         return(Scanners.setErrorExpecting(out err, expected_name, ctxt));
     }
     ctxt.next();
     return(true);
 }
Exemplo n.º 3
0
 internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
 {
     int at = ctxt.getAt();
     string src = ctxt.getSource();
     int mlen = pp.Match(src, at, src.Length);
     if (mlen < 0)
     {
         return Scanners.setErrorExpecting(out err, expected_name, ctxt);
     }
     ctxt.next(mlen);
     return true;
 }
Exemplo n.º 4
0
            internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
            {
                int    at   = ctxt.getAt();
                string src  = ctxt.getSource();
                int    mlen = pp.Match(src, at, src.Length);

                if (mlen < 0)
                {
                    return(Scanners.setErrorExpecting(out err, expected_name, ctxt));
                }
                ctxt.next(mlen);
                return(true);
            }
Exemplo n.º 5
0
            internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
            {
                int from = ctxt.getAt();

                if (!outer_scanner.parse(ctxt, ref result, ref err))
                {
                    return(false);
                }
                ScannerState inner_ctxt = new ScannerState(ctxt.getSource(), from, module, ctxt.getPositionMap(),
                                                           ctxt.getAt() - from);

                return(ParserChores.cont(ctxt, inner_ctxt, nested, ref result, ref err));
            }
Exemplo n.º 6
0
 internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
 {
     if (!open.parse(ctxt, ref result, ref err))
     {
         return(false);
     }
     for (int level = 1; level > 0;)
     {
         int at = ctxt.getAt();
         if (close.parse(ctxt, ref result, ref err))
         {
             if (at == ctxt.getAt())
             {
                 throw new IllegalParserStateException("closing comment scanner not consuming input.");
             }
             level--;
             continue;
         }
         if (at != ctxt.getAt())
         {
             return(false);
         }
         if (open.parse(ctxt, ref result, ref err))
         {
             if (at == ctxt.getAt())
             {
                 throw new IllegalParserStateException("opening comment scanner not consuming input.");
             }
             level++;
             continue;
         }
         if (at != ctxt.getAt())
         {
             return(false);
         }
         if (commented.parse(ctxt, ref result, ref err))
         {
             if (at == ctxt.getAt())
             {
                 throw new IllegalParserStateException("commented scanner not consuming input.");
             }
             continue;
         }
         return(false);
     }
     return(true);
 }
Exemplo n.º 7
0
 internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
 {
     if (!open.parse(ctxt, ref result, ref err))
     {
         return false;
     }
     for (int level = 1; level > 0; )
     {
         int at = ctxt.getAt();
         if (close.parse(ctxt, ref result, ref err))
         {
             if (at == ctxt.getAt())
             {
                 throw new IllegalParserStateException("closing comment scanner not consuming input.");
             }
             level--;
             continue;
         }
         if (at != ctxt.getAt())
         {
             return false;
         }
         if (open.parse(ctxt, ref result, ref err))
         {
             if (at == ctxt.getAt())
                 throw new IllegalParserStateException("opening comment scanner not consuming input.");
             level++;
             continue;
         }
         if (at != ctxt.getAt())
         {
             return false;
         }
         if (commented.parse(ctxt, ref result, ref err))
         {
             if (at == ctxt.getAt())
                 throw new IllegalParserStateException("commented scanner not consuming input.");
             continue;
         }
         return false;
     }
     return true;
 }
Exemplo n.º 8
0
 internal override bool apply(ParseContext ctxt, ref D_ result, ref AbstractParsecError err)
 {
     int from = ctxt.getAt();
     if (!outer_scanner.parse(ctxt, ref result, ref err))
         return false;
     ScannerState inner_ctxt = new ScannerState(ctxt.getSource(), from, module, ctxt.getPositionMap(),
       ctxt.getAt() - from);
     return ParserChores.cont(ctxt, inner_ctxt, nested, ref result, ref err);
 }