Jan Nieuwenhuizen writes:

Hi Matt,

> Wow, great; that's real simple!  I fixed two typos (see attached patch
> 1) and created a Guix[SD] package description in guix.scm (patch 2) that
> I intend to submit for inclusion into Guix, so that I can unbundle
> Nyacc from the Mes package.

I just tested Mes with a very simple main and tonight I found that when
I use #include, mes fails.  The attached patch which also prefixes
raw-parser, fixes that.

Greetings,
janneke

>From 65f3856766a64b6e13b329a46278444db1512441 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <jann...@gnu.org>
Date: Tue, 9 May 2017 20:32:23 +0200
Subject: [PATCH] Prefix `raw-parser' to make them unique for Mes.

* module/nyacc/lang/c99/cpp.scm (cpp-raw-parser): Rename from
  raw-parser.  Update callers.
* module/nyacc/lang/c99/parser.scm (c99-raw-parser): Likewise.
---
 module/nyacc/lang/c99/cpp.scm    | 4 ++--
 module/nyacc/lang/c99/parser.scm | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/module/nyacc/lang/c99/cpp.scm b/module/nyacc/lang/c99/cpp.scm
index 2c97585..7ea57f7 100644
--- a/module/nyacc/lang/c99/cpp.scm
+++ b/module/nyacc/lang/c99/cpp.scm
@@ -151,7 +151,7 @@
 (include-from-path "nyacc/lang/c99/mach.d/cpptab.scm")
 (include-from-path "nyacc/lang/c99/mach.d/cppact.scm")
 
-(define raw-parser
+(define cpp-raw-parser
   (make-lalr-parser
    (list (cons 'len-v cpp-len-v) (cons 'pat-v cpp-pat-v) (cons 'rto-v cpp-rto-v)
 	 (cons 'mtab cpp-mtab) (cons 'act-v cpp-act-v))))
@@ -183,7 +183,7 @@
    'nyacc-error
    (lambda ()
      (with-input-from-string text
-       (lambda () (raw-parser (gen-cpp-lexer)))))
+       (lambda () (cpp-raw-parser (gen-cpp-lexer)))))
    (lambda (key fmt . args)
      (apply throw 'cpp-error fmt args))))
 
diff --git a/module/nyacc/lang/c99/parser.scm b/module/nyacc/lang/c99/parser.scm
index 9e1ba4c..203b5a5 100644
--- a/module/nyacc/lang/c99/parser.scm
+++ b/module/nyacc/lang/c99/parser.scm
@@ -31,7 +31,7 @@
 
 ;; Parse given a token generator.  Uses fluid @code{*info*}.
 ;; A little ugly wrt re-throw but
-(define raw-parser
+(define c99-raw-parser
   (let ((parser (make-lalr-parser
 		     (list (cons 'len-v c99-len-v) (cons 'pat-v c99-pat-v)
 			   (cons 'rto-v c99-rto-v) (cons 'mtab c99-mtab)
@@ -48,7 +48,7 @@
 ;; This is used to parse included files at top level.
 (define (run-parse)
   (let ((info (fluid-ref *info*)))
-    (raw-parser (gen-c-lexer #:mode 'decl) #:debug (cpi-debug info))))
+    (c99-raw-parser (gen-c-lexer #:mode 'decl) #:debug (cpi-debug info))))
 
 ;; @deffn {Procedure} parse-c99 [#:cpp-defs def-a-list] [#:inc-dirs dir-list] \
 ;;               [#:mode ('code|'file|'decl)] [#:debug bool]
@@ -82,8 +82,8 @@
        (with-fluid*
 	   *info* info
 	   (lambda ()
-	     (raw-parser (gen-c-lexer #:mode mode #:xdef? xdef?)
-			 #:debug debug)))))
+	     (c99-raw-parser (gen-c-lexer #:mode mode #:xdef? xdef?)
+                             #:debug debug)))))
    (lambda (key fmt . rest)
      (report-error fmt rest)
      #f)))
-- 
2.12.2

-- 
Jan Nieuwenhuizen <jann...@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar®  http://AvatarAcademy.nl  

Reply via email to