Coverage Report

Created: 2026-12-01 06:09

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.94M
#define is_potential_identifier_start(c) (\
8
1.94M
              (c >= 'a' && c <= 'z')\
9
1.94M
               || (c >= 'A' && c <= 'Z')\
10
1.94M
               || c == '_'\
11
1.94M
               || (c >= 128))
12
13
2.73M
#define is_potential_identifier_char(c) (\
14
2.73M
              (c >= 'a' && c <= 'z')\
15
2.73M
               || (c >= 'A' && c <= 'Z')\
16
2.73M
               || (c >= '0' && c <= '9')\
17
2.73M
               || c == '_'\
18
2.73M
               || (c >= 128))
19
20
#define FTSTRING_MIDDLE(state) \
21
0
    (_PyLexer_IsTString((state)->kind) ? TSTRING_MIDDLE : FSTRING_MIDDLE)
22
#define FTSTRING_END(state) \
23
15.9k
    (_PyLexer_IsTString((state)->kind) ? TSTRING_END : FSTRING_END)
24
4.13M
#define tok_backup _PyLexer_backup
25
26
static inline int
27
tok_failed(const struct tok_state *tok)
28
1.96M
{
29
1.96M
    return tok->done != E_OK && tok->done != E_EOF &&
30
2.65k
           tok->done != E_INTERACT_STOP;
31
1.96M
}
lexer.c:tok_failed
Line
Count
Source
28
1.96M
{
29
1.96M
    return tok->done != E_OK && tok->done != E_EOF &&
30
2.65k
           tok->done != E_INTERACT_STOP;
31
1.96M
}
Unexecuted instantiation: layout.c:tok_failed
Unexecuted instantiation: number.c:tok_failed
string.c:tok_failed
Line
Count
Source
28
736
{
29
736
    return tok->done != E_OK && tok->done != E_EOF &&
30
0
           tok->done != E_INTERACT_STOP;
31
736
}
32
33
int _PyLexer_refill(struct tok_state *);
34
35
static inline int
36
tok_nextc(struct tok_state *tok)
37
10.4M
{
38
10.7M
    while (tok->cur == tok->inp) {
39
452k
        if (!_PyLexer_refill(tok)) {
40
186k
            return EOF;
41
186k
        }
42
452k
    }
43
10.2M
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
10.2M
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
10.2M
}
lexer.c:tok_nextc
Line
Count
Source
37
8.64M
{
38
8.64M
    while (tok->cur == tok->inp) {
39
124k
        if (!_PyLexer_refill(tok)) {
40
124k
            return EOF;
41
124k
        }
42
124k
    }
43
8.51M
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
8.51M
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
8.51M
}
layout.c:tok_nextc
Line
Count
Source
37
551k
{
38
806k
    while (tok->cur == tok->inp) {
39
317k
        if (!_PyLexer_refill(tok)) {
40
61.9k
            return EOF;
41
61.9k
        }
42
317k
    }
43
489k
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
489k
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
489k
}
number.c:tok_nextc
Line
Count
Source
37
538k
{
38
538k
    while (tok->cur == tok->inp) {
39
0
        if (!_PyLexer_refill(tok)) {
40
0
            return EOF;
41
0
        }
42
0
    }
43
538k
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
538k
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
538k
}
string.c:tok_nextc
Line
Count
Source
37
747k
{
38
758k
    while (tok->cur == tok->inp) {
39
11.2k
        if (!_PyLexer_refill(tok)) {
40
76
            return EOF;
41
76
        }
42
11.2k
    }
43
747k
    if (tok->cur - tok->line_start >= INT_MAX) {
44
0
        tok->done = E_COLUMNOVERFLOW;
45
0
        return EOF;
46
0
    }
47
747k
    return _PyTok_SourceByte(&tok->source, tok->cur++);
48
747k
}
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