aboutsummaryrefslogtreecommitdiff
path: root/module/c/lex2.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 18:40:27 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 21:31:32 +0200
commit1393ce3878e5d14214631fb83d58c819a7849b18 (patch)
treed1e34b2b459ea9c1702ac72f6e66f0b05ce45223 /module/c/lex2.scm
parentChange makefile to explicit list of files. (diff)
downloadcalp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.gz
calp-1393ce3878e5d14214631fb83d58c819a7849b18.tar.xz
work.
Diffstat (limited to 'module/c/lex2.scm')
-rw-r--r--module/c/lex2.scm13
1 files changed, 8 insertions, 5 deletions
diff --git a/module/c/lex2.scm b/module/c/lex2.scm
index 23fa9da4..6083190f 100644
--- a/module/c/lex2.scm
+++ b/module/c/lex2.scm
@@ -144,7 +144,7 @@
hexadecimal-floating-constant))
;; (6.4.4.2)
-(define-peg-pattern floating-constant all
+(define-peg-pattern decimal-floating-constant all
(or (and fractional-constant (? exponent-part) (? floating-suffix))
(and digit-sequence exponent-part (? floating-suffix))))
@@ -253,10 +253,12 @@
;; (6.4.6)
(define-peg-pattern punctuator all
- (or "[" "]" "(" ")" "{" "}" "." "->"
+ (or "[" "]" "(" ")" "{" "}"
+ "..." ; Moved to be before "."
+ "." "->"
"++" "--" "&" "*" "+" "-" "~" "!"
"/" "%" "<<" ">>" "<" ">" "<=" ">=" "==" "!=" "^" "|" "&&" "||"
- "?" ":" ";" "..."
+ "?" ":" ";"
"=" "*=" "/=" "%=" "+=" "-=" "<<=" ">>=" "&=" "^=" "|="
"," "#" "##"
"<:" ":>" "<%" "%>" "%:" "%:%:"))
@@ -313,11 +315,12 @@
(define-peg-pattern comment all
(or line-comment block-comment))
-(define-peg-pattern preprocessing-tokens body
+(define-peg-pattern preprocessing-tokens all
(* (or whitespace
comment
preprocessing-token)))
+;; returns a list of lexemes
(define (lex string)
- (peg:tree (match-pattern preprocessing-tokens string)))
+ (cdr (peg:tree (match-pattern preprocessing-tokens string))))