py/repl: Check for an identifier char after the keyword.
- As described in the #1850. - Add cmdline tests.
This commit is contained in:
parent
dfc35afba1
commit
69d9e7d27d
@ -123,6 +123,7 @@ bool unichar_isalpha(unichar c);
|
||||
bool unichar_isprint(unichar c);
|
||||
bool unichar_isdigit(unichar c);
|
||||
bool unichar_isxdigit(unichar c);
|
||||
bool unichar_isident(unichar c);
|
||||
bool unichar_isupper(unichar c);
|
||||
bool unichar_islower(unichar c);
|
||||
unichar unichar_tolower(unichar c);
|
||||
|
@ -38,7 +38,7 @@ STATIC bool str_startswith_word(const char *str, const char *head) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return head[i] == '\0' && (str[i] == '\0' || !unichar_isalpha(str[i]));
|
||||
return head[i] == '\0' && (str[i] == '\0' || !unichar_isident(str[i]));
|
||||
}
|
||||
|
||||
bool mp_repl_continue_with_input(const char *input) {
|
||||
|
@ -145,11 +145,9 @@ bool unichar_isxdigit(unichar c) {
|
||||
return c < 128 && (attr[c] & FL_XDIGIT) != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
bool unichar_is_alpha_or_digit(unichar c) {
|
||||
return c < 128 && (attr[c] & (FL_ALPHA | FL_DIGIT)) != 0;
|
||||
bool unichar_isident(unichar c) {
|
||||
return c < 128 && ((attr[c] & (FL_ALPHA | FL_DIGIT)) != 0 || c == '_');
|
||||
}
|
||||
*/
|
||||
|
||||
bool unichar_isupper(unichar c) {
|
||||
return c < 128 && (attr[c] & FL_UPPER) != 0;
|
||||
|
@ -29,3 +29,6 @@ def f(x):
|
||||
print(x)
|
||||
|
||||
f(3)
|
||||
if1=1
|
||||
if1 = 2
|
||||
print(if1)
|
||||
|
@ -50,4 +50,8 @@ two
|
||||
... [K
|
||||
>>> f(3)
|
||||
3
|
||||
>>> if1=1
|
||||
>>> if1 = 2
|
||||
>>> print(if1)
|
||||
2
|
||||
>>>
|
||||
|
Loading…
Reference in New Issue
Block a user