mirror of
https://github.com/lua/lua
synced 2024-12-26 20:29:43 +03:00
Easy way to allow Unicode characters in identifiers
For those that want to try it...
This commit is contained in:
parent
e0cbaa50fa
commit
e0ab13c62f
41
lctype.c
41
lctype.c
@ -16,6 +16,15 @@
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (LUA_UCID) /* accept UniCode IDentifiers? */
|
||||||
|
/* consider all non-ascii codepoints to be alphabetic */
|
||||||
|
#define NONA 0x01
|
||||||
|
#else
|
||||||
|
#define NONA 0x00 /* default */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = {
|
LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = {
|
||||||
0x00, /* EOZ */
|
0x00, /* EOZ */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */
|
||||||
@ -34,22 +43,22 @@ LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = {
|
|||||||
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
|
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
|
||||||
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */
|
0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */
|
||||||
0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00,
|
0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 8. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* 9. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* a. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* b. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */
|
0x00, 0x00, NONA, NONA, NONA, NONA, NONA, NONA, /* c. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* d. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA, /* e. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
NONA, NONA, NONA, NONA, NONA, NONA, NONA, NONA,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */
|
NONA, NONA, NONA, NONA, NONA, 0x00, 0x00, 0x00, /* f. */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* } */
|
#endif /* } */
|
||||||
|
Loading…
Reference in New Issue
Block a user