Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Some cleanups
  • Loading branch information
pablogsal committed May 19, 2023
commit fd8b60aeb2a04bfbdc8a9e1bc63dd4563704b748
7 changes: 2 additions & 5 deletions Parser/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1815,13 +1815,10 @@ tok_get_normal_mode(struct tok_state *tok, tokenizer_mode* current_tok, struct t
return MAKE_TOKEN(syntaxerror(tok, "f-string expression part cannot include '#'"));
}

const char *prefix, *p, *type_start;
const char* p = NULL;
const char *prefix, *type_start;
int current_starting_col_offset;

// if (tok->tok_extra_tokens) {
// p = tok->start;
// }

while (c != EOF && c != '\n') {
c = tok_nextc(tok);
}
Expand Down
10 changes: 5 additions & 5 deletions Python/Python-tokenize.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,18 @@ tokenizeriter_next(tokenizeriterobject *it)
return NULL;
}
const char *line_start = ISSTRINGLIT(type) ? it->tok->multi_line_start : it->tok->line_start;
int lineno = ISSTRINGLIT(type) ? it->tok->first_lineno : it->tok->lineno;
int end_lineno = it->tok->lineno;
int col_offset = -1;
int end_col_offset = -1;
Py_ssize_t lineno = ISSTRINGLIT(type) ? it->tok->first_lineno : it->tok->lineno;
Py_ssize_t end_lineno = it->tok->lineno;
Py_ssize_t col_offset = -1;
Py_ssize_t end_col_offset = -1;
if (token.start != NULL && token.start >= line_start) {
col_offset = _PyPegen_byte_offset_to_character_offset(line, token.start - line_start);
}
if (token.end != NULL && token.end >= it->tok->line_start) {
end_col_offset = _PyPegen_byte_offset_to_character_offset(line, token.end - it->tok->line_start);
}

return Py_BuildValue("(NiiiiiN)", str, type, lineno, end_lineno, col_offset, end_col_offset, line);
return Py_BuildValue("(NinnnnN)", str, type, lineno, end_lineno, col_offset, end_col_offset, line);
}

static void
Expand Down