diff options
Diffstat (limited to '')
-rw-r--r-- | module/c/lex2.scm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/module/c/lex2.scm b/module/c/lex2.scm index c00a029c..50cf56e3 100644 --- a/module/c/lex2.scm +++ b/module/c/lex2.scm @@ -285,12 +285,12 @@ ;; (6.4.7) (define-peg-pattern h-char body - (or (and (not-followed-by (or ">" "\n")) peg-any) + (or (and (not-followed-by (or ">" "\n")) peg-any) escape-sequence)) ;; (6.4.7) (define-peg-pattern q-char body - (or (and (not-followed-by (or "\"" "\n")) peg-any) + (or (and (not-followed-by (or "\"" "\n")) peg-any) escape-sequence)) ;;; A.1.9 Preprocessing numbers @@ -347,9 +347,18 @@ (`(comment ,body) (lexeme body: body type: 'comment )) (`(preprocessing-token ,body) - (lexeme body: body type: 'preprocessing-token)))) + (case body + ;; "unflatten" + ((string-literal) + (lexeme body: '(string-literal "") type: 'preprocessing-token)) + (else + (lexeme body: body type: 'preprocessing-token)))) + ;; "unflatten" + ('comment (lexeme body: "" type: 'comment)))) ;; returns a list of lexemes (define (lex string) - (map lex-output->lexeme-object - (cdr (peg:tree (match-pattern preprocessing-tokens string))))) + (if (string-null? string) + '() + (map lex-output->lexeme-object + (cdr (peg:tree (match-pattern preprocessing-tokens string)))))) |