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.
Unified · Split
| @@ -1482,6 +1482,7 @@ static const FlagDef flag_defs[] = { · 1481 unmodified lines | ||
| 1482 | 1482 | { offsetof(TCCState, leading_underscore), 0, "leading-underscore" }, |
| 1483 | 1483 | { offsetof(TCCState, ms_extensions), 0, "ms-extensions" }, |
| 1484 | 1484 | { offsetof(TCCState, old_struct_init_code), 0, "old-struct-init-code" }, |
| 1485 | + { offsetof(TCCState, dollars_in_identifiers), 0, "dollars-in-identifiers" }, | |
| 1485 | 1486 | }; |
| 1486 | 1487 | |
| 1487 | 1488 | /* set/reset a flag */ |
| @@ -241,6 +241,9 @@ Allow a MS C compiler extensions to the language. Curretly this · 240 unmodified lines | ||
| 241 | 241 | assume a nested named structure declaration without identifier behave |
| 242 | 242 | like an unnamed one. |
| 243 | 243 | |
| 244 | +@item -fdollars-in-identifiers | |
| 245 | +Allow a dollars in identifiers | |
| 246 | + | |
| 244 | 247 | @end table |
| 245 | 248 | |
| 246 | 249 | Warning options: |
| @@ -605,6 +605,7 @@ struct TCCState { · 604 unmodified lines | ||
| 605 | 605 | int ms_extensions; /* allow nested named struct w/o identifier behave like unnamed */ |
| 606 | 606 | int old_struct_init_code; /* use old algorithm to init array in struct when there is no '{' used. |
| 607 | 607 | Liuux 2.4.26 can't find initrd when compiled with a new algorithm */ |
| 608 | + int dollars_in_identifiers; /* allows '$' char in indentifiers */ | |
| 608 | 609 | |
| 609 | 610 | /* warning switches */ |
| 610 | 611 | int warn_write_strings; |
| @@ -2286,7 +2286,10 @@ maybe_newline: · 2285 unmodified lines | ||
| 2286 | 2286 | } |
| 2287 | 2287 | } |
| 2288 | 2288 | break; |
| 2289 | − | |
| 2289 | + | |
| 2290 | + /* treat $ as allowed char in indentifier */ | |
| 2291 | + case '$': if (!tcc_state->dollars_in_identifiers) goto parse_simple; | |
| 2292 | + | |
| 2290 | 2293 | case 'a': case 'b': case 'c': case 'd': |
| 2291 | 2294 | case 'e': case 'f': case 'g': case 'h': |
| 2292 | 2295 | case 'i': case 'j': case 'k': case 'l': |
| @@ -2589,8 +2592,8 @@ maybe_newline: · 296 unmodified lines | ||
| 2589 | 2592 | case ':': |
| 2590 | 2593 | case '?': |
| 2591 | 2594 | case '~': |
| 2592 | − case '$': /* only used in assembler */ | |
| 2593 | − case '@': /* dito */ | |
| 2595 | + case '@': /* only used in assembler */ | |
| 2596 | + parse_simple: | |
| 2594 | 2597 | tok = c; |
| 2595 | 2598 | p++; |
| 2596 | 2599 | break; |
| @@ -3174,7 +3177,8 @@ ST_FUNC void preprocess_new(void) · 577 unmodified lines | ||
| 3174 | 3177 | |
| 3175 | 3178 | /* init isid table */ |
| 3176 | 3179 | for(i=CH_EOF;i<256;i++) |
| 3177 | − isidnum_table[i-CH_EOF] = isid(i) || isnum(i); | |
| 3180 | + isidnum_table[i-CH_EOF] = (isid(i) || isnum(i) || | |
| 3181 | + (tcc_state->dollars_in_identifiers ? i == '$' : 0)); | |
| 3178 | 3182 | |
| 3179 | 3183 | /* add all tokens */ |
| 3180 | 3184 | if (table_ident) { |