Exemple #1
0
        /// <summary> scanner for non-nested block comment.</summary>
        /// <param name="start">the start string of a block comment.
        /// </param>
        /// <param name="end">the end string of a block comment.
        /// </param>
        /// <returns> the scanner.
        /// </returns>
        public static Scanner IsBlockComment(string start, string end)
        {
            CharPattern opening = Patterns.IsString(start).Seq(Patterns.NotString(end).Many());

            return(IsPattern("block comment before the end", opening, start).Seq(IsString(end))
                   .Rename("block comment"));
        }
Exemple #2
0
        /// <summary> Scans a non-nestable block comment.</summary>
        /// <param name="open">the opening string.
        /// </param>
        /// <param name="close">the closing string.
        /// </param>
        /// <param name="commented">the commented pattern.
        /// </param>
        /// <returns> the Scanner for the block comment.
        /// </returns>
        public static Scanner IsBlockComment(string open, string close, CharPattern commented)
        {
            CharPattern opening = Patterns.IsString(open)
                                  .Seq(Patterns.IsString(close).Not().Seq(commented).Many());

            return(IsPattern("block comment before the end", opening, open).Seq(IsString(close)));
        }
Exemple #3
0
 /// <summary> matches the input against the specified string.</summary>
 /// <param name="str">the string to match
 /// </param>
 /// <param name="expected_name">the name of the expected pattern.
 /// </param>
 /// <returns> the scanner.
 /// </returns>
 public static Scanner IsString(string str, string expected_name)
 {
     return(IsPattern("isString", Patterns.IsString(str), expected_name));
 }