From 23d2ccc3e1b05a1ca0ff72317cc6da0773a0a9d1 Mon Sep 17 00:00:00 2001 From: bd Date: Fri, 11 Apr 2025 00:22:57 -0400 Subject: Simplify newline rules --- src/parse.lisp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/parse.lisp') diff --git a/src/parse.lisp b/src/parse.lisp index 8eca782..a3c9cbd 100644 --- a/src/parse.lisp +++ b/src/parse.lisp @@ -15,12 +15,6 @@ (esrap:defrule nl (+ eol) (:constant nil)) -(esrap:defrule nl-inc (+ eol) - (:lambda (n) - (declare (ignore n)) - (incf line-number) - nil)) - (esrap:defrule sign (or #\+ #\-)) (esrap:defrule alpha (+ (alphanumericp character)) @@ -142,8 +136,9 @@ DESTRUCTURE-PATTERN is the list of non-terminals on the right side of the gramma ;;; defines rules to parse the .text segment -(esrap:defrule instr-clean (and (esrap:? space) instr nl-inc) - (:function cadr)) +(esrap:defrule instr-clean (and (esrap:? space) instr nl) + (:function cadr) + (:lambda (i) (incf line-number) i)) (esrap:defrule label-clean (and label-decl nl) (:function car)) -- cgit v1.2.3