From 5dea5f95ba55d46707cd299ce1d739fc6c1bf014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 20 Jul 2022 16:13:14 +0200 Subject: Fixups in lex2 --- module/c/lex2.scm | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/module/c/lex2.scm b/module/c/lex2.scm index 647eff55..c09f6423 100644 --- a/module/c/lex2.scm +++ b/module/c/lex2.scm @@ -37,9 +37,9 @@ ;; otherwise became q-strings (or string-literal header-name + character-constant identifier pp-number - character-constant punctuator ;; Each non-white-space character that cannot be one of the above )) @@ -84,8 +84,8 @@ ;; (6.4.3) (define-peg-pattern universal-character-name all - (or (and "\\u" hex-quad) - (and "\\U" hex-quad hex-quad))) + (or (and (ignore "\\u") hex-quad) + (and (ignore "\\U") hex-quad hex-quad))) ;; (6.4.3) (define-peg-pattern hex-quad body @@ -106,18 +106,17 @@ ;; (6.4.4.1) (define-peg-pattern integer-constant all (and (or decimal-constant - octal-constant - hexadecimal-constant) - integer-suffix)) + hexadecimal-constant + octal-constant) + (? integer-suffix))) ;; (6.4.4.1) (define-peg-pattern decimal-constant all - (and nonzero-digit - (+ digit))) + (and nonzero-digit (* digit))) ;; (6.4.4.1) (define-peg-pattern octal-constant all - (+ octal-digit)) + (and "0" (* octal-digit))) ;; (6.4.4.1) (define-peg-pattern hexadecimal-constant all @@ -197,7 +196,7 @@ ;; (6.4.4.2) (define-peg-pattern binary-exponent-part all - (and (or "p" "P") + (and (ignore (or "p" "P")) (? sign) digit-sequence)) @@ -263,7 +262,7 @@ ;; (6.4.5) (define-peg-pattern s-char body - (or (and (not-followed-by (or "\"" "\\" "\n")) peg-any) + (or (and (not-followed-by (or "\"" "\\" "\n")) peg-any) escape-sequence)) ;;; A.1.7 -- cgit v1.2.3