Ejemplo n.º 1
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"));
 }
Ejemplo n.º 2
0
 /// <summary> Matches a line comment that starts with a string
 /// and end with EOF or Line Feed character.
 /// </summary>
 /// <param name="open">the line comment starting string.
 /// </param>
 /// <returns> the Pattern object.
 /// </returns>
 public static Pattern IsLineComment(string open)
 {
     return(IsString(open).Seq(Many(CharPredicates.NotChar('\n'))));
 }
Ejemplo n.º 3
0
 /// <summary> succeed and consume the current character if it is equal to ch.</summary>
 /// <param name="ch">the expected character.
 /// </param>
 /// <param name="expected_name">the error message.
 /// </param>
 /// <returns> the scanner.
 /// </returns>
 public static Scanner NotChar(char ch, string expected_name)
 {
     return(IsChar(CharPredicates.NotChar(ch), expected_name).Rename("not char"));
 }