aboutsummaryrefslogtreecommitdiff
path: root/module/c/lex2.scm
diff options
context:
space:
mode:
Diffstat (limited to '')
-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))))