Package org.codehaus.jparsec.pattern

Examples of org.codehaus.jparsec.pattern.Pattern


   * @param end ends a block comment
   * @param commented the commented pattern.
   * @return the Scanner for the block comment.
   */
  public static Parser<Void> blockComment(String begin, String end, Pattern commented) {
    Pattern opening = Patterns.string(begin)
        .next(Patterns.string(end).not().next(commented).many());
    return pattern(opening, begin).next(string(end));
  }
View Full Code Here


  /**
   * A scanner for a quoted string that starts with character {@code begin} and ends with character
   * {@code end}.
   */
  public static Parser<String> quoted(char begin, char end) {
    Pattern beforeClosingQuote =
        Patterns.isChar(begin).next(Patterns.many(CharPredicates.notChar(end)));
    return pattern(beforeClosingQuote, Character.toString(begin)).next(isChar(end)).source();
  }
View Full Code Here

   * characters with the first 2 characters not being {@code c1} and {@code c2}.
   *
   * @return the Pattern object.
   */
  private static Pattern notChar2(final char c1, final char c2) {
    return new Pattern() {
      @Override public int match(CharSequence src, int begin, int end) {
        if (begin == end - 1) return 1;
        if (begin >= end) return MISMATCH;
        if (src.charAt(begin) == c1 && src.charAt(begin + 1) == c2) return Pattern.MISMATCH;
        return 1;
View Full Code Here

TOP

Related Classes of org.codehaus.jparsec.pattern.Pattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.