aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-20 16:13:14 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-20 16:13:14 +0200
commit5dea5f95ba55d46707cd299ce1d739fc6c1bf014 (patch)
tree4f7dbcc92157f6a6107b28f2832a7af647a70757
parentCleanup in preprocessor2. (diff)
downloadcalp-5dea5f95ba55d46707cd299ce1d739fc6c1bf014.tar.gz
calp-5dea5f95ba55d46707cd299ce1d739fc6c1bf014.tar.xz
Fixups in lex2
-rw-r--r--module/c/lex2.scm21
1 files 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