Coverage Report

Created: 2026-10-31 06:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/cpython/Parser/lexer/lexer_internal.h
Line
Count
Source
1
#ifndef _PY_LEXER_INTERNAL_H_
2
#define _PY_LEXER_INTERNAL_H_
3
4
#include "errcode.h"
5
#include "state.h"
6
7
1.99M
#define is_potential_identifier_start(c) (\
8
1.99M
              (c >= 'a' && c <= 'z')\
9
1.99M
               || (c >= 'A' && c <= 'Z')\
10
1.99M
               || c == '_'\
11
1.99M
               || (c >= 128))
12
13
2.85M
#define is_potential_identifier_char(c) (\
14
2.85M
              (c >= 'a' && c <= 'z')\
15
2.85M
               || (c >= 'A' && c <= 'Z')\
16
2.85M
               || (c >= '0' && c <= '9')\
17
2.85M
               || c == '_'\
18
2.85M
               || (c >= 128))
19
20
#define FTSTRING_MIDDLE(state) \
21
0
    (_PyLexer_IsTString((state)->kind) ? TSTRING_MIDDLE : FSTRING_MIDDLE)
22
#define FTSTRING_END(state) \
23
14.4k
    (_PyLexer_IsTString((state)->kind) ? TSTRING_END : FSTRING_END)
24
4.25M
#define tok_backup _PyLexer_backup
25
26
static inline int
27
tok_failed(const struct tok_state *tok)
28
2.02M
{
29
2.02M
    return tok->done != E_OK && tok->done != E_EOF &&
30
2.65k
           tok->done != E_INTERACT_STOP;
31
2.02M
}
lexer.c:tok_failed
Line
Count
Source
28
2.02M
{
29
2.02M
    return tok->done != E_OK && tok->done != E_EOF &&
30
2.65k
           tok->done != E_INTERACT_STOP;
31
2.02M
}
Unexecuted instantiation: layout.c:tok_failed
Unexecuted instantiation: number.c:tok_failed
string.c:tok_failed
Line
Count
Source
28
734
{
29
734
    return tok->done != E_OK && tok->done != E_EOF &&
30
0
           tok->done != E_INTERACT_STOP;
31
734
}
32
33
int _PyLexer_refill(struct tok_state *);
34
35
static inline int
36
tok_nextc(struct tok_state *tok)
37
10.8M
{
38
11.0M
    while (tok->cur == tok->inp) {
39
484k
        if (!_PyLexer_refill(tok)) {
40
212k
            return EOF;
41
212k
        }
42
484k
    }
43
10.5M
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
10.5M
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
10.5M
}
lexer.c:tok_nextc
Line
Count
Source
37
8.88M
{
38
8.88M
    while (tok->cur == tok->inp) {
39
141k
        if (!_PyLexer_refill(tok)) {
40
141k
            return EOF;
41
141k
        }
42
141k
    }
43
8.74M
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
8.74M
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
8.74M
}
layout.c:tok_nextc
Line
Count
Source
37
586k
{
38
846k
    while (tok->cur == tok->inp) {
39
330k
        if (!_PyLexer_refill(tok)) {
40
70.5k
            return EOF;
41
70.5k
        }
42
330k
    }
43
515k
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
515k
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
515k
}
number.c:tok_nextc
Line
Count
Source
37
552k
{
38
552k
    while (tok->cur == tok->inp) {
39
0
        if (!_PyLexer_refill(tok)) {
40
0
            return EOF;
41
0
        }
42
0
    }
43
552k
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
552k
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
552k
}
string.c:tok_nextc
Line
Count
Source
37
780k
{
38
793k
    while (tok->cur == tok->inp) {
39
12.6k
        if (!_PyLexer_refill(tok)) {
40
78
            return EOF;
41
78
        }
42
12.6k
    }
43
780k
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
780k
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
780k
}
49
50
/* Return -1 on error, otherwise whether the line is blank. */
51
int _PyLexer_BeginLine(struct tok_state *);
52
int _PyLexer_ContinueLine(struct tok_state *);
53
int _PyLexer_IndentationToken(struct tok_state *, struct token *);
54
/* Return zero when the newline is suppressed, otherwise its token type. */
55
int _PyLexer_Newline(struct tok_state *, struct token *, int);
56
void _PyLexer_backup(struct tok_state *, int);
57
int _PyLexer_record_ftstring_comment(
58
    struct tok_state *, ftstring_state *, _PyTok_Off, _PyTok_Off);
59
int _PyLexer_ftstring_punctuation(
60
    struct tok_state *, ftstring_state *, struct token *, int);
61
int _PyLexer_close_ftstring_expr(
62
    struct tok_state *, ftstring_state *, int);
63
void _PyLexer_mark_ftstring_debug(struct tok_state *, ftstring_state *);
64
int _PyLexer_check_string_prefixes(struct tok_state *, int, int, int, int, int);
65
int _PyLexer_scan_number(struct tok_state *, struct token *, int, int);
66
int _PyLexer_scan_fstring_start(
67
    struct tok_state *, struct token *, int, ftstring_kind);
68
int _PyLexer_scan_string(struct tok_state *, struct token *, int);
69
int _PyLexer_get_normal(struct tok_state *, ftstring_state *, struct token *);
70
int _PyLexer_get_ftstring(struct tok_state *, ftstring_state *, struct token *);
71
72
#endif