diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 04:39:14 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 04:39:14 +0200 |
commit | c1cf0693982d9c1f1b871966752140fee5d76d19 (patch) | |
tree | 65cf5c501f5b2029eb08bed7fa9844b9530385f3 /module/c/lex2.scm | |
parent | Resolve # ## # (diff) | |
download | calp-c1cf0693982d9c1f1b871966752140fee5d76d19.tar.gz calp-c1cf0693982d9c1f1b871966752140fee5d76d19.tar.xz |
work
Diffstat (limited to 'module/c/lex2.scm')
-rw-r--r-- | module/c/lex2.scm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/module/c/lex2.scm b/module/c/lex2.scm index 652aa6c1..fcddcdc4 100644 --- a/module/c/lex2.scm +++ b/module/c/lex2.scm @@ -368,4 +368,15 @@ (if (string-null? string) '() (map lex-output->lexeme-object - (cdr (peg:tree (match-pattern preprocessing-tokens string)))))) + (let ((result (match-pattern preprocessing-tokens string))) + (let ((trailing (substring (peg:string result) + (peg:end result)))) + (unless (string-null? trailing) + (scm-error 'cpp-lex-error "lex" + "Failed to lex string, remaining trailing characters: ~s" + (list trailing) #f))) + (unless (list? (peg:tree result)) + (scm-error 'cpp-lex-error "lex" + "Parsing just failed. Chars: ~s" + (list (peg:string result)) #f)) + (cdr (peg:tree result)))))) |