Checks if there is whitespace before token
768473
def space_before?
      position = begin_pos.zero? ? begin_pos : begin_pos - 1
      pos.source_buffer.source.match(/\G\s/, position)
    end
968484
public static function tokenPreviousCharacterIsWhiteSpace($token, &$originalTokens)
    {
        return (isset($originalTokens[$token['i'] - 1])
            && $originalTokens[$token['i'] - 1][Tokenizer::TOKEN_TYPE] !== Tokenizer::TOKEN_TYPE_WHITESPACE);
    }
917207
function getPropertyWhitespace(property) {
            const whitespace = /(\s*):(\s*)/u.exec(sourceCode.getText().slice(
                property.key.range[1], property.value.range[0]
            ));

            if (whitespace) {
                return {
                    beforeColon: whitespace[1],
                    afterColon: whitespace[2]
                };
            }
            return null;
        }
1086060
private static function isWhitespaceOfLength(TokenInterface $token, int $length): bool
    {
        return static::isWhitespace($token) && strlen(trim($token->getValue(), "\n")) == $length;
    }
494143
def com_google_fonts_check_whitespace_widths(ttFont):
  """"""
  from fontbakery.utils import get_glyph_name

  space_name = get_glyph_name(ttFont, 0x0020)
  nbsp_name = get_glyph_name(ttFont, 0x00A0)

  space_width = ttFont['hmtx'][space_name][0]
  nbsp_width = ttFont['hmtx'][nbsp_name][0]

  if space_width > 0 and space_width == nbsp_width:
    yield PASS, "Whitespace and non-breaking space have the same width."
  else:
    yield FAIL, ("Whitespace and non-breaking space have differing width:"
                 " Whitespace ({}) is {} font units wide, non-breaking space"
                 " ({}) is {} font units wide. Both should be positive and the"
                 " same.").format(space_name, space_width, nbsp_name,
                                  nbsp_width)
1112962
def whitespace_tokenize(text):
    """"""
    text = text.strip()
    if not text:
        return []
    tokens = text.split()
    return tokens
1315563
def determine_if_whitespace(self):
        
        value = self.current.value

        if value == '\n':
            self.is_space = True
        else:
            self.is_space = False
            if (value == '' or regexes['whitespace'].match(value)):
                self.is_space = True
419921
function checkSpacingBefore(token) {
            const prevToken = sourceCode.getTokenBefore(token);

            if (prevToken &&
                CLOSE_PAREN.test(token.value) &&
                astUtils.isTokenOnSameLine(prevToken, token) &&
                sourceCode.isSpaceBetweenTokens(prevToken, token) !== always
            ) {
                context.report({
                    loc: token.loc.start,
                    messageId: `${prefix}Before`,
                    fix(fixer) {
                        if (always) {
                            return fixer.insertTextBefore(token, " ");
                        }
                        return fixer.removeRange([
                            prevToken.range[1],
                            token.range[0]
                        ]);
                    }
                });
            }
        }
842537
private boolean isWhitespace(char ch)
    {
        if (linews) 
            return Character.isWhitespace(ch);
        else
            return ch != '\n' && ch != '\r' && Character.isWhitespace(ch);
    }
1030973
private static boolean isRemovableWhite(AnalyzedTokenReadings token) {
    return (token.isWhitespace() || StringTools.isNonBreakingWhitespace(token.getToken())) 
        && !token.isLinebreak() && !token.getToken().equals("\t") && !token.getToken().equals("\u200B"); 
  }
481427
function isValidRegExp(context: ParserContext): boolean {
  const previousNonWsToken = context.token(context.count() - 1);

  let previousToken;
  if (context.defaultData.text !== "") {
    previousToken = context.createToken("default", context.defaultData.text);
  } else {
    previousToken = previousNonWsToken;
    // Okay if there is no previous token.
    if (!previousToken) return true;
  }

  // Since JavaScript doesn't require statement terminators, if the previous
  // token was whitespace and contained a newline, then we're good.
  if (
    previousToken.name === "default" &&
    previousToken.value.indexOf("\n") >= 0
  )
    return true;

  // In these case the / stands for division.
  if (util.contains(["keyword", "ident", "number"], previousNonWsToken.name))
    return false;

  if (
    previousNonWsToken.name === "punctuation" &&
    !util.contains(["(", "{", "[", ",", ";"], previousNonWsToken.value)
  )
    return false;

  return true;
}
753208
function checkSpacingAfter(token) {
            const nextToken = sourceCode.getTokenAfter(token);

            if (nextToken &&
                OPEN_PAREN.test(token.value) &&
                astUtils.isTokenOnSameLine(token, nextToken) &&
                sourceCode.isSpaceBetweenTokens(token, nextToken) !== always
            ) {
                context.report({
                    loc: {
                        line: token.loc.end.line,
                        column: token.loc.end.column - 2
                    },
                    messageId: `${prefix}After`,
                    fix(fixer) {
                        if (always) {
                            return fixer.insertTextAfter(token, " ");
                        }
                        return fixer.removeRange([
                            token.range[1],
                            nextToken.range[0]
                        ]);
                    }
                });
            }
        }
264797
function skipWhitespace() {
    while (i < input.length) {
      if (isWhitespace(input[i])) {
        i++;
        parser.pos_++;
        continue;
      }
      break;
    }
  }
513412
function expectSpaceAfter(token, pattern) {
            const nextToken = sourceCode.getTokenAfter(token);

            if (nextToken &&
                (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) &&
                !isCloseParenOfTemplate(nextToken) &&
                astUtils.isTokenOnSameLine(token, nextToken) &&
                !sourceCode.isSpaceBetweenTokens(token, nextToken)
            ) {
                context.report({
                    loc: token.loc.start,
                    messageId: "expectedAfter",
                    data: token,
                    fix(fixer) {
                        return fixer.insertTextAfter(token, " ");
                    }
                });
            }
        }
202000
function checkForSpaces(node) {
            const tokens = node.type === "UpdateExpression" && !node.prefix
                ? sourceCode.getLastTokens(node, 2)
                : sourceCode.getFirstTokens(node, 2);
            const firstToken = tokens[0];
            const secondToken = tokens[1];

            if ((node.type === "NewExpression" || node.prefix) && firstToken.type === "Keyword") {
                checkUnaryWordOperatorForSpaces(node, firstToken, secondToken, firstToken.value);
                return;
            }

            const operator = node.prefix ? tokens[0].value : tokens[1].value;

            if (overrideExistsForOperator(operator)) {
                if (overrideEnforcesSpaces(operator)) {
                    verifyNonWordsHaveSpaces(node, firstToken, secondToken);
                } else {
                    verifyNonWordsDontHaveSpaces(node, firstToken, secondToken);
                }
            } else if (options.nonwords) {
                verifyNonWordsHaveSpaces(node, firstToken, secondToken);
            } else {
                verifyNonWordsDontHaveSpaces(node, firstToken, secondToken);
            }
        }
315218
def _check_whitespace(string):
    
    if string.count(' ') + string.count('\t') + string.count('\n') > 0:
        raise ValueError(INSTRUCTION_HAS_WHITESPACE)
695415
function strip_whitespace (s) {
      if (options.strip_whitespace) {
        return s.replace(/\s*\n/g,"\n").replace(/(\r?\n){2,}/g,"\n\n");
      }
      return s;
    }