aboutsummaryrefslogtreecommitdiff
path: root/module/c/lex.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/c/lex.scm')
-rw-r--r--module/c/lex.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/module/c/lex.scm b/module/c/lex.scm
index 30fcd3c1..2b024f1c 100644
--- a/module/c/lex.scm
+++ b/module/c/lex.scm
@@ -108,14 +108,18 @@
base-10-digit))))
(define-peg-pattern prefix-operator all
- (or "!" "~" "*" "&" "++" "--" "+" "-"))
+ ;; It's important that ++ and -- are BEFORE + and -
+ ;; otherwise the first + is found, leaving the second +, which fails
+ ;; to lex since it's an invalid token
+ (or "*" "&" "++" "--"
+ "!" "~" "+" "-"))
+
;;; Note that stacked pre or postfix operators without parenthesis
;;; dosen't work. So `*&C' is invalid, while `*(&C)' is valid.
(define-peg-pattern prefix all
- (and prefix-operator sp (or variable group funcall #; postfix
- )))
+ (and prefix-operator sp (or variable group funcall literal)))
(define-peg-pattern postfix-operator all
(or "++" "--" "*"))