Beispiel #1
0
 /// <summary>
 /// Parses the first matching item.
 /// </summary>
 public static TParser ParseFirst <TParser>(this Parser <LexicalToken, TParser> parser, string text, bool alwaysProduceEOF = false)
 {
     return(ParseFirst(parser, TokenParser.ParseTokens(text, alwaysProduceEOF)));
 }
Beispiel #2
0
        /// <summary>
        /// Scans the first matching item.
        /// </summary>
        public static int ScanFirst(this Parser <LexicalToken> parser, string text, bool alwaysProduceEOF = false)
        {
            var source = new ArraySource <LexicalToken>(TokenParser.ParseTokens(text, alwaysProduceEOF));

            return(parser.Scan(source, 0));
        }
Beispiel #3
0
 /// <summary>
 /// Repeatedly parses all matching items.
 /// </summary>
 public static IEnumerable <TParser> ParseAll <TParser>(this Parser <LexicalToken, TParser> parser, string text, bool alwaysProduceEndToken = false)
 {
     return(ParseAll(parser, TokenParser.ParseTokens(text, alwaysProduceEndToken)));
 }