From 1393ce3878e5d14214631fb83d58c819a7849b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 7 Jul 2022 18:40:27 +0200 Subject: work. --- module/c/lex2.scm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'module/c/lex2.scm') 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)))) -- cgit v1.2.3