A scanner for non-nested block comment that starts with {@code begin} and ends with
{@code end}.
549501
public static Parser<Void> blockComment(String begin, String end) {
    Pattern opening = Patterns.string(begin).next(Patterns.notString(end).many());
    return opening.toScanner(begin).next(string(end));
  }
401150
protected function isCommentEnd() {
        // EOF
        if ($this->scanner->current() === false) {
            // Hit the end.
            $this->parseError("Unexpected EOF in a comment.");
            return true;
        }

        // If it doesn't start with -, not the end.
        if ($this->scanner->current() != '-') {
            return false;
        }

        // Advance one, and test for '->'
        if ($this->scanner->next() == '-' && $this->scanner->peek() == '>') {
            $this->scanner->next(); // Consume the last '>'
            return true;
        }
        // Unread '-';
        $this->scanner->unconsume(1);
        return false;
    }
926629
def read_comment(self, start: int, line: int, col: int, prev: Token) -> Token:
        """"""
        body = self.source.body
        body_length = len(body)

        position = start
        while True:
            position += 1
            if position > body_length:
                break
            char = body[position]
            if char < " " and char != "\t":
                break
        return Token(
            TokenKind.COMMENT,
            start,
            position,
            line,
            col,
            prev,
            body[start + 1 : position],
        )
151065
private void scanTwoDigitSpecial() {

        if (mInput == '=' && (mType == TokenType.COMP || mType == TokenType.EQ || mType == TokenType.N_EQ)) {
            mOutput.append(mInput);
            mPos++;
        } else if (mInput == '/' && (mType == TokenType.SLASH)) {
            mOutput.append(mInput);
            mType = TokenType.DESC_STEP;
            mPos++;
        } else if (mInput == '.' && (mType == TokenType.POINT)) {
            mOutput.append(mInput);
            mType = TokenType.PARENT;
            mPos++;
        } else if (mInput == '<' && mOutput.toString().equals("<")) {
            mOutput.append(mInput);
            mType = TokenType.L_SHIFT;
            mPos++;
        } else if (mInput == '>' && mOutput.toString().equals(">")) {
            mOutput.append(mInput);
            mType = TokenType.R_SHIFT;
            mPos++;
        } else if (mInput == ':' && mType == TokenType.OPEN_BR) {
            // could be start of a comment
            mOutput = new StringBuilder();
            mType = TokenType.COMMENT;
            mCommentCount++;
            mState = State.COMMENT;
            mPos++;
        } else {
            mFinnished = true;
        }
    }
867934
boolean isComment(String line, boolean trim) {
    final String trimmedLine = trim ? line.trim() : line;
    for (String comment: getDialect().getSqlLineOneLineComments()) {
      if (trimmedLine.startsWith(comment)) {
        return true;
      }
    }
    return false;
  }
928489
public Query range(String start, String end) {
    return range(wrapKey(start), wrapKey(end));
  }
717033
boolean scanSingleLineComment() {
		while (true) {
			switch (state) {
			case 100:
				if (peek() == '#' && next() == '#' && next() == '#') {
					state = 101;
					continue ;
				}
				return fail();
			case 101:
				for (char c=next(); true; c=next()) {
					if (c == '\n') {
						if (deletePreviousTextTokenBlankTails()) {
							return prepareNextScan(1);
						} else {
							return prepareNextScan(0);
						}
					}
					if (c == EOF) {
						deletePreviousTextTokenBlankTails();
						return prepareNextScan(0);
					}
				}
			default :
				return fail();
			}
		}
	}
645237
private int getQuoteToken( String content, int startOffset, int endOffset )
  {
    String quoteDelimiter = content.substring( startOffset, startOffset + 1 );
    int index;
    int endOfQuote = startOffset;
    int endOfToken = startOffset + 1;
    while( endOfToken <= endOffset )
    {
      if( isDelimiter( content.substring( endOfToken, endOfToken + 1 ) ) )
      {
        break;
      }
      endOfToken++;
    }
    index = content.indexOf( quoteDelimiter, endOfQuote + 1 );
    if( (index < 0) || (index > endOffset) )
    {
      endOfQuote = endOffset;
    }
    else
    {
      endOfQuote = index;
    }

    if( isError( startOffset, endOfQuote - startOffset + 1 ) )
    {
      setCharacterAttributes( startOffset, endOfQuote - startOffset + 1, _error, true );
      return endOfQuote + 1;
    }
    if( isWarning( startOffset, endOfQuote - startOffset + 1 ) )
    {
      setCharacterAttributes( startOffset, endOfQuote - startOffset + 1, _warning, true );
      return endOfQuote + 1;
    }

    setCharacterAttributes( startOffset, endOfQuote - startOffset + 1, _stringLiteral, false );
    return endOfQuote + 1;
  }
381225
private int findEndOfNowiki (int startBlock) {
        // NOTE: this method could step back one char from startBlock position
        int endBlock=startBlock-3;
        do {
            endBlock=wikiText.indexOf("}}}", endBlock+3);
            if (endBlock<0) return wikiLength; // no matching '}}}' found
            while (endBlock+3<wikiLength && wikiChars[endBlock+3]=='}')
                endBlock++; // shift to end of sequence of more than 3x'}' (eg. '}}}}}')
        } while (wikiChars[endBlock-1]=='~');
        return endBlock;
    }
1245566
def comment_text
      begin
        text = @scanner.scan(/.*/) # everything until newline
        text.rstrip! # benchmarked faster too rstrip the string in place
        raise PoSyntaxError, "Comment text should advance to next line or stop at eos" unless end_of_line
        text
      rescue PoSyntaxError => pe
        raise PoSyntaxError, "Syntax error in commtent_text\n" + pe.message, pe.backtrace
      end
    end
525900
static MatchedComment match(Commented<ExpressionTree> actual, String formal) {
    Optional<Comment> lastBlockComment =
        Streams.findLast(
            actual.beforeComments().stream().filter(c -> c.getStyle() == CommentStyle.BLOCK));

    if (lastBlockComment.isPresent()) {
      Matcher m =
          PARAMETER_COMMENT_PATTERN.matcher(Comments.getTextFromComment(lastBlockComment.get()));
      if (m.matches()) {
        return MatchedComment.create(
            lastBlockComment.get(),
            m.group(1).equals(formal) ? MatchType.EXACT_MATCH : MatchType.BAD_MATCH);
      }
    }

    Optional<Comment> approximateMatchComment =
        Stream.concat(actual.beforeComments().stream(), actual.afterComments().stream())
            .filter(comment -> isApproximateMatchingComment(comment, formal))
            .findFirst();

    if (approximateMatchComment.isPresent()) {
      // Report EXACT_MATCH for comments that don't use the recommended style (e.g. `/*foo*/`
      // instead of `/* foo= */`), but which match the formal parameter name exactly, since it's
      // a style nit rather than a possible correctness issue.
      // TODO(cushon): revisit this if we standardize on the recommended comment style.
      String text =
          CharMatcher.anyOf("=:")
              .trimTrailingFrom(Comments.getTextFromComment(approximateMatchComment.get()).trim());
      return MatchedComment.create(
          approximateMatchComment.get(),
          text.equals(formal) ? MatchType.EXACT_MATCH : MatchType.APPROXIMATE_MATCH);
    }

    return MatchedComment.notAnnotated();
  }
423246
private void readEndTag() throws IOException, KriptonRuntimeException {
		read('<');
		read('/');
		name = readName(); // TODO: pass the expected name in as a hint?
		skip();
		read('>');

		int sp = (depth - 1) * 4;

		if (depth == 0) {
			checkRelaxed("read end tag " + name + " with no tags open");
			type = COMMENT;
			return;
		}

		if (name.equals(elementStack[sp + 3])) {
			namespace = elementStack[sp];
			prefix = elementStack[sp + 1];
			name = elementStack[sp + 2];
		} else if (!relaxed) {
			throw new KriptonRuntimeException("expected: /" + elementStack[sp + 3] + " read: " + name, true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
		}
	}
614340
protected List<Map<String, ?>> generateComments() {
		final List<Map<String, ?>> list = new ArrayList<>();
		// Block comment
		list.add(pattern(it -> {
			it.delimiters("(/\\*+)", "(\\*/)"); //$NON-NLS-1$ //$NON-NLS-2$
			it.style(BLOCK_COMMENT_STYLE);
			it.beginStyle(BLOCK_COMMENT_DELIMITER_STYLE);
			it.endStyle(BLOCK_COMMENT_DELIMITER_STYLE);
			it.pattern(it2 -> {
				it2.matches("^\\s*(\\*)(?!/)"); //$NON-NLS-1$
				it2.style(BLOCK_COMMENT_DELIMITER_STYLE);
			});
			it.comment("Multiline comments"); //$NON-NLS-1$
		}));
		// Line comment
		list.add(pattern(it -> {
			it.matches("\\s*(//)(.*)$"); //$NON-NLS-1$
			it.substyle(1, LINE_COMMENT_DELIMITER_STYLE);
			it.substyle(2, LINE_COMMENT_STYLE);
			it.comment("Single-line comment"); //$NON-NLS-1$
		}));
		return list;
	}
1273832
function(line, isInComment) {
  while (true || line.length > 0) {
    var startIndex = line.indexOf('{-');
    var endIndex = line.indexOf('-}');
    var singleLineComment = line.indexOf('--');

    // when we have a single line comment
    if (singleLineComment > -1 && !isInComment) {
      line = line.substr(0, singleLineComment);
      continue;
    }

    // when there's no comment chars
    if (startIndex === -1 && endIndex === -1) {
      return {
        line: isInComment ? '' : line,
        isInComment: isInComment,
      };
    }

    // when there's a start and end
    if (startIndex > -1 && endIndex > -1) {
      line = line.substr(0, startIndex) + line.substr(endIndex + 2);
      continue;
    }

    // when there's a start, but no end
    if (startIndex > -1)
      return { line: line.substr(0, startIndex), isInComment: true };

    // when there's an end, but no start
    if (endIndex > -1 && isInComment)
      return { line: line.substr(endIndex + 2), isInComment: false };
  }

  return { line: '', isInComment: isInComment };
}
1182181
private String readComment(boolean returnText) throws IOException, KriptonRuntimeException {
		read(START_COMMENT);

		if (relaxed) {
			return readUntil(END_COMMENT, returnText);
		}

		String commentText = readUntil(COMMENT_DOUBLE_DASH, returnText);
		if (peekCharacter() != '>') {
			throw new KriptonRuntimeException("Comments may not contain --", true, this.getLineNumber(), this.getColumnNumber(), getPositionDescription(), null);
		}
		position++;
		return commentText;
	}
789813
private int endCheckBlock()
    {
        Node n;
        int rv = END_DROPS_OFF;

        // check each statment and if the statement can continue onto the next
        // one, then check the next statement
        for (n=first; ((rv & END_DROPS_OFF) != 0) && n != null; n = n.next)
        {
            rv &= ~END_DROPS_OFF;
            rv |= n.endCheck();
        }
        return rv;
    }
1221706
private boolean skipComment(final String s) throws KNXMLException
	{
		if (s.startsWith("!--")) {
			String comment = s;
			while (canRead() && !comment.endsWith("--"))
				comment = read('>');
			return true;
		}
		return false;
	}