-static
-int replace_trigraph(lexer_t *this)
-{
-#define MATCH_TRIGRAPH(ch,replacement) \
- case ch: \
- this->c = replacement; \
- return 1;
-
- switch(this->c) {
- MATCH_TRIGRAPH('=', '#')
- MATCH_TRIGRAPH('(', '[')
- MATCH_TRIGRAPH('/', '\\')
- MATCH_TRIGRAPH(')', ']')
- MATCH_TRIGRAPH('\'', '^')
- MATCH_TRIGRAPH('<', '{')
- MATCH_TRIGRAPH('!', '|')
- MATCH_TRIGRAPH('>', '}')
- MATCH_TRIGRAPH('-', '~')
+static inline void next_char(void);
+
+#define MATCH_NEWLINE(code) \
+ case '\r': \
+ next_char(); \
+ if(c == '\n') { \
+ next_char(); \
+ } \
+ lexer_token.source_position.linenr++; \
+ code; \
+ case '\n': \
+ next_char(); \
+ lexer_token.source_position.linenr++; \
+ code;
+
+static inline void eat(char c_type)
+{
+ assert(c == c_type);
+ next_char();
+}
+
+static void maybe_concat_lines(void)
+{
+ eat('\\');
+
+ switch(c) {
+ MATCH_NEWLINE(return;)
+