145 if (
string[0] !=
'@') {
175#define TXTFMT_PY_NUMERAL_STRING_COUNT_IMPL(txtfmt_py_numeral_char_is_fn) \
178 for (; txtfmt_py_numeral_char_is_fn(*string); string += 1) { \
188 return ELEM(c,
'0',
'1') || (c ==
'_');
198 return (c >=
'0' && c <=
'7') || (c ==
'_');
208 return (c >=
'0' && c <=
'9') || (c ==
'_');
218 return (c >=
'0' && c <=
'9') || (c >=
'a' && c <=
'f') || (c >=
'A' && c <=
'F') || (c ==
'_');
228 return ELEM(c,
'0',
'_');
235#undef TXTFMT_PY_NUMERAL_STRING_COUNT_IMPL
239 if (
string ==
nullptr || *
string ==
'\0') {
243 const char first = *string, second = *(
string + 1);
253 else if (first ==
'0') {
255 if (
ELEM(second,
'x',
'X')) {
259 if (
ELEM(second,
'o',
'O')) {
263 if (
ELEM(second,
'b',
'B')) {
267 if (
ELEM(second,
'0',
'_')) {
272 else if (first >
'0' && first <=
'9') {
276 return (first ==
'0') ? 1 : 0;
281 if (
string ==
nullptr || *
string ==
'\0') {
285 const char first = *string, second = *(
string + 1);
341 char cont_orig, cont, find, prev =
' ';
345 if (line->prev && line->prev->format !=
nullptr) {
346 fmt = line->prev->format;
347 cont = fmt[strlen(fmt) + 1];
359 if (line->format !=
nullptr) {
361 cont_orig = fmt[strlen(fmt) + 1];
395 if (*
str == find && *(
str + 1) == find && *(
str + 2) == find) {
423 else if (
ELEM(*
str,
'"',
'\'')) {
427 if (*(
str + 1) == find && *(
str + 2) == find) {
438 else if (
ELEM(*
str,
'f',
'F',
'r',
'R',
'u',
'U') &&
ELEM(*(
str + 1),
'"',
'\'')) {
446 if (*(
str + 1) == find && *(
str + 2) == find) {
471 if (*(
str + 1) == find && *(
str + 2) == find) {
483 else if (*
str ==
' ') {
549 if (cont != cont_orig && do_next && line->next) {
565 static const char *ext[] = {
"py",
nullptr};
bool text_check_digit(char ch)
bool text_check_identifier(char ch)
bool text_check_delim(char ch)
bool text_check_whitespace(char ch)
int BLI_str_utf8_size_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
const char * comment_line
char(* format_identifier)(const char *string)
void(* format_line)(SpaceText *st, TextLine *line, bool do_next)
int flatten_string(const SpaceText *st, FlattenString *fs, const char *in)
void text_format_fill(const char **str_p, char **fmt_p, const char type, const int len)
void flatten_string_free(FlattenString *fs)
const bool text_format_string_literals_check_sorted_array(const Span< const char * > string_literals)
int text_format_string_literal_find(const Span< const char * > string_literals, const char *text)
void text_format_fill_ascii(const char **str_p, char **fmt_p, const char type, const int len)
void ED_text_format_register(TextFormatType *tft)
int text_check_format_len(TextLine *line, uint len)
static bool txtfmt_py_numeral_char_is_hexadecimal(const char c)
static int txtfmt_py_find_numeral_inner(const char *string)
static uint txtfmt_py_numeral_string_count_hexadecimal(const char *string)
static uint txtfmt_py_numeral_string_count_octal(const char *string)
static bool txtfmt_py_numeral_char_is_decimal(const char c)
#define TXTFMT_PY_NUMERAL_STRING_COUNT_IMPL(txtfmt_py_numeral_char_is_fn)
static char txtfmt_py_format_identifier(const char *str)
static int txtfmt_py_find_specialvar(const char *string)
static int txtfmt_py_find_bool(const char *string)
static int txtfmt_py_find_decorator(const char *string)
static bool txtfmt_py_numeral_char_is_binary(const char c)
static const Span< const char * > text_format_py_literals_builtinfunc(text_format_py_literals_builtinfunc_data, ARRAY_SIZE(text_format_py_literals_builtinfunc_data))
static const Span< const char * > text_format_py_literals_specialvar(text_format_py_literals_specialvar_data, ARRAY_SIZE(text_format_py_literals_specialvar_data))
static int txtfmt_py_literal_numeral(const char *string, char prev_fmt)
static bool txtfmt_py_numeral_char_is_zero(const char c)
static uint txtfmt_py_numeral_string_count_zeros(const char *string)
static uint txtfmt_py_numeral_string_count_binary(const char *string)
static int txtfmt_py_find_builtinfunc(const char *string)
static const char * text_format_py_literals_specialvar_data[]
static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_next)
static uint txtfmt_py_numeral_string_count_decimal(const char *string)
static const Span< const char * > text_format_py_literals_bool(text_format_py_literals_bool_data, ARRAY_SIZE(text_format_py_literals_bool_data))
static bool txtfmt_py_numeral_char_is_octal(const char c)
static const char * text_format_py_literals_bool_data[]
void ED_text_format_register_py()
static const char * text_format_py_literals_builtinfunc_data[]