True if a line consists only of a single punctuation character.
437431
def is_delimiter(line):
    
    return bool(line) and line[0] in punctuation and line[0]*len(line) == line
1234636
protected boolean isQuoteDelimiter( String character ) {
        String quoteDelimiters = "\"'";
        if (quoteDelimiters.indexOf(character) < 0)
            return false;
        else
            return true;
    }
497929
protected boolean isLevelLine(String line) {
        final Matcher matcher = LEVEL_PATTERN.matcher(line.trim().toUpperCase(Locale.ENGLISH));
        return matcher.find();
    }
1135349
boolean checkSuffix(char[] chars, int[] cursor) {
    if (suffix == null)
      return true;
    if (cursor[1] - cursor[0] < suffix.minlen)
      // a conservative test, but if we can't pass it, we'll certainly fail later
      return false;
    int last = suffix.items.length - 1;
    for (int i = last; i >= 0; i--) {
      Object item = suffix.items[i];
      if (item == Pattern.matchOne)
        if (!topicSkipBackward(chars, cursor))
          return false;
        else
          ; // topic skip succeeded so continue
      else if (!matchBackward(chars, (char[]) item, cursor))
        return false;
      // else this phase succeeded so continue
    }
    // The suffix matches exactly.  But, the preceding character MUST be a separator.  We
    // don't allow start-of-string because we would not have checked the suffix
    // at all if it were allowed to extend to the beginning (it would then be identical
    // to the prefix).
    return cursor[0] < cursor[1] && 
      chars[cursor[1]-1] == MatchSpace.SUBTOPIC_SEPARATOR_CHAR;
  }
1220977
private boolean isPlainText(String state) {

        String val = A_CmsWorkplaceApp.getParamFromState(state, PLAIN_TEXT_PREFIX);
        return Boolean.parseBoolean(val);
    }
475132
public static boolean isPunc(String str) {
    	if (str == null) return false;
    	str = str.trim();
    	
    	for (int i = 0; i < str.length(); ++i){
    		char c = str.charAt(i);
    		if (Character.isDigit(c) || Character.isLetter(c)){
    			return false;
    		}
    	}
		return true;
    }
570654
def is_quoted(position, text):
    """"""
    def matching(quotemark1, quotemark2):
        straight = '\"\''
        curly = '“”'
        if quotemark1 in straight and quotemark2 in straight:
            return True
        if quotemark1 in curly and quotemark2 in curly:
            return True
        else:
            return False

    def find_ranges(text):
        s = 0
        q = pc = ''
        start = None
        ranges = []
        seps = " .,:;-\r\n"
        quotes = ['\"', '“', '”', "'"]
        for i, c in enumerate(text + "\n"):
            if s == 0 and c in quotes and pc in seps:
                start = i
                s = 1
                q = c
            elif s == 1 and matching(c, q):
                s = 2
            elif s == 2:
                if c in seps:
                    ranges.append((start+1, i-1))
                    start = None
                    s = 0
                else:
                    s = 1
            pc = c
        return ranges

    def position_in_ranges(ranges, position):
        for start, end in ranges:
            if start <= position < end:
                return True
        return False

    return position_in_ranges(find_ranges(text), position)
1009900
function punctuation(text){

  // Dashes
  text = text.replace(/--/g, '\u2014');
  text = text.replace(/\s*\u2014\s*/g,'\u2009\u2014\u2009'); //this has thin spaces

  // Elipses
  text = text.replace(/\.\.\./g,'…');

  // Nbsp for punc with spaces
  var NBSP = '\u00a0';
  var NBSP_PUNCTUATION_START = /([«¿¡]) /g;
  var NBSP_PUNCTUATION_END = / ([!?:;.,‽»])/g;

  text = text.replace(NBSP_PUNCTUATION_START, '$1' + NBSP);
  text = text.replace(NBSP_PUNCTUATION_END, NBSP + '$1');

  return text;
}
1028686
private function isComment($line)
    {
        // if it's an empty line you might as well skip it
        if (empty($line)) return true;

        $is_comment = false;

        foreach ($this->_comment_character_list as $comment_char) {
            $line = trim($line);
            if (strpos($line, $comment_char) !== false && strpos($line, $comment_char) <= 3) {
                $is_comment = true;
                break;
            }
        }

        return $is_comment;
    }
59846
private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) {
    return inQuotes // we are in quotes, therefore there can be escaped
        // quotes in here.
        && nextLine.length() > (i + 1) // there is indeed another
        // character to check.
        && format.isDelimiter(nextLine.charAt(i + 1));
  }
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();
			}
		}
	}
287375
def _iscomment(line):
    
    if line.isspace():
        return True
    elif len(line.split()) >= 3:
        try:  # python 3 str
            if line.split()[0].isdecimal() and line.split()[1].isdecimal():
                return False
        except:  # python 2 str
            if (line.decode().split()[0].isdecimal() and
                    line.split()[1].decode().isdecimal()):
                return False
        return True
    else:
        return True
305669
def has_mixed_eol_chars(text):
    """"""
    eol_chars = get_eol_chars(text)
    if eol_chars is None:
        return False
    correct_text = eol_chars.join((text+eol_chars).splitlines())
    return repr(correct_text) != repr(text)
96331
private boolean isGoodAnchor(String text, int index) {
        // Check if there is space and punctuation mark after block
        String punct = " .,:!?\t\n";
        if (index >= 0 && index < text.length()) {
            if (punct.indexOf(text.charAt(index)) == -1) {
                return false;
            }
        }

        return true;
    }
7341
function (str) {
    /**
     * Make our own "punctuation" character class, because the POSIX-style
     * [:PUNCT:] is only available in Perl 5.6 or later:
     *
     * JavaScript don't have punctuation class neither.
     */
    var punct_class = '[!"#\$\%\'()*+,-./:;<=>?\@\[\\\]\^_`{|}~]';
    /**
     * Special case if the very first character is a quote
     * followed by punctuation at a non-word-break. Close the quotes by brute force:
     */
    str = str.replace(new RegExp("^'(?=" + punct_class + "B)"), '&#8217;');
    str = str.replace(new RegExp("^\"(?=" + punct_class + "B)"), '&#8221;');
    /**
     * Special case for double sets of quotes, e.g.:
     *   <p>He said, "'Quoted' words in a larger quote."</p>
     */
    str = str.replace(/"'(?=\w)/, '&#8220;&#8216;');
    str = str.replace(/'"(?=\w)/, '&#8216;&#8220;');
    /**
     * Special case for decade abbreviations (the '80s):
     */
    str = str.replace(/'(?=\d\d)/, '&#8217;');
    var close_class = '[^\ \t\r\n\[\{\(\-]';
    var dec_dashes = '&#8211;|&#8212;';
    /**
     * Get most opening single quotes:
     * s {
     *     (
     *         \s          |   # a whitespace char, or
     *         &nbsp;      |   # a non-breaking space entity, or
     *         --          |   # dashes, or
     *         &[mn]dash;  |   # named dash entities
     *         $dec_dashes |   # or decimal entities
     *         &\#x201[34];    # or hex
     *     )
     *     '                   # the quote
     *     (?=\w)              # followed by a word character
     * } {$1&#8216;}xg;
     */
    str = str.replace(new RegExp("(s|&nbsp;|--|&[mn]dash;|" + dec_dashes + "|&#x201[34])'(?=w)", 'g'), '\$1&#8216;');
    /**
     * Single closing quotes:
     * s {
     *     ($close_class)?
     *     '
     *     (?(1)|          # If $1 captured, then do nothing;
     *       (?=\s | s\b)  # otherwise, positive lookahead for a whitespace
     *     )               # char or an 's' at a word ending position. This
     *                     # is a special case to handle something like:
     *                     # "<i>Custer</i>'s Last Stand."
     * } {$1&#8217;}xgi;
     */
    str = str.replace(new RegExp("(" + close_class + ")'", 'g'), '\$1&#8217;');
    str = str.replace(new RegExp("'(?=s|s\b)", 'g'), '\$1&#8217;');
    /**
     * Any remaining single quotes should be opening ones:
     */
    str = str.replace(/'/g, '&#8216;');
    /**
     * Get most opening double quotes:
     * s {
     *     (
     *         \s          |   # a whitespace char, or
     *         &nbsp;      |   # a non-breaking space entity, or
     *         --          |   # dashes, or
     *         &[mn]dash;  |   # named dash entities
     *         $dec_dashes |   # or decimal entities
     *         &\#x201[34];    # or hex
     *     )
     *     "                   # the quote
     *     (?=\w)              # followed by a word character
     * } {$1&#8220;}xg;
     */
    str = str.replace(new RegExp("(s|&nbsp;|--|&[mn]dash;|" + dec_dashes + "|&#x201[34])\"(?=w)", 'g'), '\$1&#8220;');
    /**
     * Double closing quotes:
     * s {
     *     ($close_class)?
     *     "
     *     (?(1)|(?=\s))   # If $1 captured, then do nothing;
     *                        # if not, then make sure the next char is whitespace.
     * } {$1&#8221;}xg;
     */
    str = str.replace(new RegExp("(" + close_class + ")\"", 'g'), '\$1&#8221;');
    str = str.replace(new RegExp("'(?=s)", 'g'), '\$1&#8221;');
    /**
     * Any remaining quotes should be opening ones.
     */
    str = str.replace(/"/g, '&#8220;');
    return str;
  }
930692
function (line) {
		line = line || "";
		line = line.trim();

		if (line.length === 0) {
			return true;
		}

		return false;
	}
626038
private boolean isMagicComment() {
        assert reader.ch == '@';
        int parens = 0;
        boolean stringLit = false;
        int lbp = reader.bp;
        char lch = reader.buf[++lbp];

        if (!Character.isJavaIdentifierStart(lch)) {
            // The first thing after the @ has to be the annotation identifier
            return false;
        }

        while (lbp < reader.buflen) {
            lch = reader.buf[++lbp];
            // We are outside any annotation values
            if (Character.isWhitespace(lch) &&
                    !spacesincomments &&
                    parens == 0) {
                return false;
            } else if (lch == '@' &&
                    parens == 0) {
                // At most one annotation per magic comment
                return false;
            } else if (lch == '(' && !stringLit) {
                ++parens;
            } else if (lch == ')' && !stringLit) {
                --parens;
            } else if (lch == '"') {
                // TODO: handle more complicated string literals,
                // char literals, escape sequences, unicode, etc.
                stringLit = !stringLit;
            } else if (lch == '*' &&
                    !stringLit &&
                    lbp + 1 < reader.buflen &&
                    reader.buf[lbp+1] == '/') {
                // We reached the end of the comment, make sure no
                // parens are open
                return parens == 0;
            } else if (!Character.isJavaIdentifierPart(lch) &&
                    !Character.isWhitespace(lch) &&
                    lch != '.' && // separator in fully-qualified annotation name
                    // TODO: this also allows /*@A...*/ which should not be recognized.
                    !spacesincomments &&
                    parens == 0 &&
                    !stringLit) {
                return false;
            }
            // Do we need anything else for annotation values, e.g. String literals?
        }
        // came to end of file before '*/'
        return false;
    }