예제 #1
0
 /// <summary> Scans greedily for 1 or more whitespace characters.</summary>
 /// <param name="expected_name">the expected message when fails.
 /// </param>
 /// <returns> the Scanner object.
 /// </returns>
 public static Scanner IsWhitespaces(string expected_name)
 {
     return(IsPattern("isWhitespaces", Patterns.Many(1, CharPredicates.IsWhitespace()), expected_name));
 }
예제 #2
0
 /// <summary> scans a quoted string that is opened by c1 and closed by c2. </summary>
 /// <param name="c1">the opening character.
 /// </param>
 /// <param name="c2">the closing character.
 /// </param>
 /// <returns> the scanner.
 /// </returns>
 public static Scanner IsQuotedBy(char c1, char c2)
 {
     return(IsPattern("open quote and quoted",
                      Patterns.IsChar(c1).Seq(Patterns.Many(CharPredicates.NotChar(c2))), "" + c1)
            .Seq(IsChar(c2)).Rename("quoted"));
 }
예제 #3
0
 /// <summary> Scans greedily for 0 or more characters
 /// that satisfies the given CharPredicate.
 /// </summary>
 /// <param name="cp">the predicate object.
 /// </param>
 /// <returns> the Scanner object.
 /// </returns>
 public static Scanner Many(CharPredicate cp)
 {
     return(IsPattern("many chars", Patterns.Many(cp), "many"));
 }