Commit Graph

78 Commits

Author SHA1 Message Date
Rui Ueyama b3772845bd Add thread-local variable 2020-12-07 12:00:06 +09:00
Rui Ueyama a2535163e2 Add basic "asm" statement 2020-12-07 12:00:06 +09:00
Rui Ueyama 7d80a5136d Add typeof 2020-12-07 12:00:06 +09:00
Rui Ueyama c61c0d0025 Add #line 2020-12-07 12:00:06 +09:00
Rui Ueyama 37998be0c1 Improve error message for multibyte characters 2020-12-07 12:00:06 +09:00
Rui Ueyama 2b2fa25507 Skip UTF-8 BOM markers 2020-12-07 12:00:06 +09:00
Rui Ueyama 238277714d Allow to concatenate regular string literals with L/u/U string literals 2020-12-07 12:00:06 +09:00
Rui Ueyama 0e5d250ebf Allow multibyte UTF-8 character in identifier 2020-12-07 12:00:06 +09:00
Rui Ueyama 36230e0827 Add UTF-16 string literal initializer 2020-12-07 12:00:06 +09:00
Rui Ueyama cae061af2b Add wide string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama c467ee665d Add UTF-32 string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama 9cabe1f204 Add UTF-16 string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama 57b21fe902 Add UTF-8 string literal 2020-12-07 12:00:06 +09:00
Rui Ueyama 2dac3afece Add UTF-32 character literal 2020-12-07 12:00:06 +09:00
Rui Ueyama 454618cd15 Add UTF-16 character literal 2020-12-07 12:00:06 +09:00
Rui Ueyama a57c661d46 Accept multibyte character as wide character literal
On most Unix-like systems, wide character literal is 32-bit long
and encodes a Unicode code point. On Windows, that is 16-bit
long and encodes a UTF-16 code unit. Clearly, there's a portability
issue here. Personally I've never used wide characters in my code
as I didn't find it useful.

Being said that, some header files contain wide character literal,
so we need to support that so that chibicc can include such files.

We assume that source files are always encoded in UTF-8.
2020-12-07 12:00:06 +09:00
Rui Ueyama c31886aa7a Add \u and \U escape sequences 2020-12-07 12:00:06 +09:00
Rui Ueyama 74bcec5b22 Canonicalize newline character 2020-12-07 12:00:06 +09:00
Rui Ueyama 3f2c2d5bca Tokenize numeric tokens as pp-numbers 2020-12-07 12:00:06 +09:00
Rui Ueyama 7746e4ee0b Recognize wide character literal
For now, L'' is equivalent to ''.
2020-12-07 12:00:06 +09:00
Rui Ueyama b33fe0ea82 Support line continuation 2020-12-07 12:00:06 +09:00
Rui Ueyama 8f561aed9b Add macro token-pasting operator (##) 2020-12-07 12:00:06 +09:00
Rui Ueyama 8f6f7925a0 Add macro stringizing operator (#) 2020-12-07 12:00:06 +09:00
Rui Ueyama dec3b3fa02 Add zero-arity funclike #define 2020-12-07 12:00:06 +09:00
Rui Ueyama bf6ff928ad Add #if and #endif 2020-12-07 12:00:06 +09:00
Rui Ueyama ec149f64d2 Skip extra tokens after `#include "..."` 2020-12-07 12:00:06 +09:00
Rui Ueyama d367510fcc Add #include "..." 2020-12-07 12:00:06 +09:00
Rui Ueyama 146c7b3dd4 Add the null directive 2020-12-07 12:00:06 +09:00
Rui Ueyama 1e1ea39dad Add a do-nothing preprocessor 2020-12-07 12:00:06 +09:00
Rui Ueyama 29de46aed4 Add "float" and "double" local variables and casts 2020-12-07 12:00:06 +09:00
Rui Ueyama 1e57f72d8a Add floating-point constant 2020-12-07 12:00:06 +09:00
Rui Ueyama b773554275 Ignore const, volatile, auto, register, restrict or _Noreturn. 2020-12-07 12:00:06 +09:00
Rui Ueyama aaf10459d9 Add U, L and LL suffixes 2020-12-07 12:00:06 +09:00
Rui Ueyama 34ab83bdf4 Add unsigned integral types 2020-12-07 12:00:06 +09:00
Rui Ueyama 3f59ce7955 Add `signed` keyword 2020-12-07 12:00:06 +09:00
Rui Ueyama 58fc86137c Allow to call a variadic function 2020-12-07 12:00:06 +09:00
Rui Ueyama ee252e6ce7 Add do ... while 2020-12-07 12:00:06 +09:00
Rui Ueyama 9df51789e7 Add _Alignof and _Alignas 2020-12-07 12:00:06 +09:00
Rui Ueyama 006a45ccd4 Add extern 2020-12-07 12:00:06 +09:00
Rui Ueyama d0c0cb74b2 Add <<, >>, <<= and >>= 2020-12-07 12:00:06 +09:00
Rui Ueyama 044d9ae07b Add switch-case 2020-12-07 12:00:06 +09:00
Rui Ueyama 3c83dfd8af Add continue statement 2020-12-07 12:00:06 +09:00
Rui Ueyama b3047f2317 Add break statement 2020-12-07 12:00:06 +09:00
Rui Ueyama 6116cae4c4 Add goto and labeled statement 2020-12-07 12:00:06 +09:00
Rui Ueyama f30f78175c Add && and || 2020-12-07 12:00:06 +09:00
Rui Ueyama 86440068b4 Add &, |, ^, &=, |= and ^= 2020-12-07 12:00:06 +09:00
Rui Ueyama daa739817c Add % and %= 2020-12-07 12:00:06 +09:00
Rui Ueyama 7df934d2b6 Add hexadecimal, octal and binary number literals 2020-12-07 12:00:06 +09:00
Rui Ueyama 47f19371f7 Add pre ++ and -- 2020-12-07 12:00:06 +09:00
Rui Ueyama 01a94c04aa Add +=, -=, *= and /= 2020-12-07 12:00:06 +09:00