def lexer(raw: str) -> _LEX_STREAM:
    """Lex a cfg() expression.

    :param raw: The raw cfg() expression
    :return: An iterable of tokens
    """
    start: int = 0
    is_string: bool = False
    for i, s in enumerate(raw):
        if s.isspace() or s in {')', '(', ',', '=', '"'}:
            val = raw[start:i]
            start = i + 1
            if s == '"' and is_string:
                yield (TokenType.STRING, val)
                is_string = False
                continue
            elif val == 'any':
                yield (TokenType.ANY, None)
            elif val == 'all':
                yield (TokenType.ALL, None)
            elif val == 'not':
                yield (TokenType.NOT, None)
            elif val == 'cfg':
                yield (TokenType.CFG, None)
            elif val:
                yield (TokenType.IDENTIFIER, val)

            if s == '(':
                yield (TokenType.LPAREN, None)
            elif s == ')':
                yield (TokenType.RPAREN, None)
            elif s == ',':
                yield (TokenType.COMMA, None)
            elif s == '=':
                yield (TokenType.EQUAL, None)
            elif s == '"':
                is_string = True
    val = raw[start:]
    if val:
        # This should always be an identifier
        yield (TokenType.IDENTIFIER, val)
Lex a cfg() expression.

    :param raw: The raw cfg() expression
    :return: An iterable of tokens
    
mesonbuild/cargo/cfg.py