graphql/language/lexer.py
def read_number(source: Source, start, char, line, col, prev) -> Token:
    """Reads a number token from the source file.

    Either a float or an int depending on whether a decimal point appears.
    """
    body = source.body
    position = start
    is_float = False
    if char == "-":
        position += 1
        char = char_at(body, position)
    if char == "0":
        position += 1
        char = char_at(body, position)
        if char is not None and "0" <= char <= "9":
            raise GraphQLSyntaxError(
                source,
                position,
                f"Invalid number, unexpected digit after 0: {print_char(char)}.",
            )
    else:
        position = read_digits(source, position, char)
        char = char_at(body, position)
    if char == ".":
        is_float = True
        position += 1
        char = char_at(body, position)
        position = read_digits(source, position, char)
        char = char_at(body, position)
    if char is not None and char in "Ee":
        is_float = True
        position += 1
        char = char_at(body, position)
        if char is not None and char in "+-":
            position += 1
            char = char_at(body, position)
        position = read_digits(source, position, char)
    return Token(
        TokenKind.FLOAT if is_float else TokenKind.INT,
        start,
        position,
        line,
        col,
        prev,
        body[start:position],
    )
Reads a number token from the source file.

    Either a float or an int depending on whether a decimal point appears.
    
Reads a number token from the source file.
Either a float or an int depending on whether a decimal point appears.
Reads a number token from the source file . Either a float or an int depending on whether a decimal point appears .
def read_number(source: Source, start, char, line, col, prev) -> Token:
    body = source.body
    position = start
    is_float = False
    if char == "-":
        position += 1
        char = char_at(body, position)
    if char == "0":
        position += 1
        char = char_at(body, position)
        if char is not None and "0" <= char <= "9":
            raise GraphQLSyntaxError(
                source,
                position,
                f"Invalid number, unexpected digit after 0: {print_char(char)}.",
            )
    else:
        position = read_digits(source, position, char)
        char = char_at(body, position)
    if char == ".":
        is_float = True
        position += 1
        char = char_at(body, position)
        position = read_digits(source, position, char)
        char = char_at(body, position)
    if char is not None and char in "Ee":
        is_float = True
        position += 1
        char = char_at(body, position)
        if char is not None and char in "+-":
            position += 1
            char = char_at(body, position)
        position = read_digits(source, position, char)
    return Token(
        TokenKind.FLOAT if is_float else TokenKind.INT,
        start,
        position,
        line,
        col,
        prev,
        body[start:position],
    )
def read_number ( source : Source , start , char , line , col , prev ) -> Token : body = source . body position = start is_float = False if char == "-" : position += 1 char = char_at ( body , position ) if char == "0" : position += 1 char = char_at ( body , position ) if char is not None and "0" <= char <= "9" : raise GraphQLSyntaxError ( source , position , f"Invalid number, unexpected digit after 0: {print_char(char)}." , ) else : position = read_digits ( source , position , char ) char = char_at ( body , position ) if char == "." : is_float = True position += 1 char = char_at ( body , position ) position = read_digits ( source , position , char ) char = char_at ( body , position ) if char is not None and char in "Ee" : is_float = True position += 1 char = char_at ( body , position ) if char is not None and char in "+-" : position += 1 char = char_at ( body , position ) position = read_digits ( source , position , char ) return Token ( TokenKind . FLOAT if is_float else TokenKind . INT , start , position , line , col , prev , body [ start : position ] , )
Reads a number token from the source file.
Reads a number token from the source file .
"""Reads a number token from the source file.

    Either a float or an int depending on whether a decimal point appears.
    """
source
Source
start
char
line
col
prev