diff options
| author | seyko <seyko2@gmail.com> | 2015-04-12 15:32:03 +0300 |
|---|---|---|
| committer | seyko <seyko2@gmail.com> | 2015-04-12 15:32:03 +0300 |
| commit | dcb36587b5950b000f536e374eeed3787937db27 (patch) | |
| tree | 76b2fa0585760edeaa4eef1495daaa9335b5efff /tccpp.c | |
| parent | e8ad336ac5c05dc1bb747b621dbf504fe3d26ca0 (diff) | |
| download | tinycc-dcb36587b5950b000f536e374eeed3787937db27.tar.gz tinycc-dcb36587b5950b000f536e374eeed3787937db27.tar.bz2 | |
-fdollar-in-identifiers switch which enables '$' in identifiers
library Cello: http://libcello.org/ which uses `$` and several
variations of as macros.
There is also RayLanguage which also uses it as a macro for a kind of
ObjC style message passing: https://github.com/kojiba/RayLanguage
This is a patch from Daniel Holden.
Diffstat (limited to 'tccpp.c')
| -rw-r--r-- | tccpp.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -2286,7 +2286,10 @@ maybe_newline: } } break; - + + /* treat $ as allowed char in indentifier */ + case '$': if (!tcc_state->dollars_in_identifiers) goto parse_simple; + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': @@ -2589,8 +2592,8 @@ maybe_newline: case ':': case '?': case '~': - case '$': /* only used in assembler */ - case '@': /* dito */ + case '@': /* only used in assembler */ + parse_simple: tok = c; p++; break; @@ -3174,7 +3177,8 @@ ST_FUNC void preprocess_new(void) /* init isid table */ for(i=CH_EOF;i<256;i++) - isidnum_table[i-CH_EOF] = isid(i) || isnum(i); + isidnum_table[i-CH_EOF] = (isid(i) || isnum(i) || + (tcc_state->dollars_in_identifiers ? i == '$' : 0)); /* add all tokens */ if (table_ident) { |
