diff --git a/module/nyacc/ChangeLog b/module/nyacc/ChangeLog index cc21b765..ce9cb65e 100644 --- a/module/nyacc/ChangeLog +++ b/module/nyacc/ChangeLog @@ -1,5 +1,7 @@ 2017-02-22 Matt Wette + * lang/c99/cpp.scm (rtokl->string): added handler for 'string + * lang/c99/body.scm: added 'skip state so that if skipping #if then no CPP if or elif arguments are evaluated diff --git a/module/nyacc/README.nyacc b/module/nyacc/README.nyacc index cfd97e05..19d6ebc7 100644 --- a/module/nyacc/README.nyacc +++ b/module/nyacc/README.nyacc @@ -1,4 +1,4 @@ -This is a version 0.76.1 of NYACC (Not Yet Another Compiler Compiler!). +This is a version 0.76.1+c99dev of NYACC (Not Yet Another Compiler Compiler!). Copyright (C) 2015-2017 Matthew R. Wette diff --git a/module/nyacc/lalr.scm b/module/nyacc/lalr.scm index f8909a48..34dcfe6d 100644 --- a/module/nyacc/lalr.scm +++ b/module/nyacc/lalr.scm @@ -50,7 +50,7 @@ #:use-module (nyacc util) ) -(define *nyacc-version* "0.76.1") +(define *nyacc-version* "0.76.1+c99dev") ;; @deffn proxy-? sym rhs diff --git a/module/nyacc/lang/c99/body.scm b/module/nyacc/lang/c99/body.scm index 160e3150..c0f210df 100644 --- a/module/nyacc/lang/c99/body.scm +++ b/module/nyacc/lang/c99/body.scm @@ -451,7 +451,8 @@ ;; Loop between reading tokens and skipping tokens via CPP logic. (let iter ((pair (read-token))) (case (car ppxs) - ((keep) pair) + ((keep) ;;(simple-format #t "lx=>~S\n" pair) + pair) ((skip-done skip-look skip) (iter (read-token))) (else (error "coding error")))) diff --git a/module/nyacc/lang/c99/cpp.scm b/module/nyacc/lang/c99/cpp.scm index bb38fb88..18c28920 100644 --- a/module/nyacc/lang/c99/cpp.scm +++ b/module/nyacc/lang/c99/cpp.scm @@ -277,12 +277,15 @@ ((('ident . rval) ('ident . lval) . rest) (iter stl chl (string-append " " rval) (cdr tkl))) - (((key . val) . rest) - (iter stl chl val rest)) - (('space . rest) (iter stl (cons #\space chl) nxt rest)) + ((('string . val) . rest) + (iter stl (cons #\" chl) val (cons #\" rest))) + + (((key . val) . rest) + (iter stl chl val rest)) + (otherwise (error "no match" tkl))))))) diff --git a/module/nyacc/lang/c99/mach.scm b/module/nyacc/lang/c99/mach.scm index a58e1c76..7da13037 100644 --- a/module/nyacc/lang/c99/mach.scm +++ b/module/nyacc/lang/c99/mach.scm @@ -692,14 +692,14 @@ (define* (dev-parse-c99 #:key (cpp-defs '()) ; CPP defines (inc-dirs '()) ; include directories - (td-dict '()) ; typedef dictionary + (inc-help '()) ; typedef dictionary (mode 'file) ; mode: 'file or 'code (xdef? #f) ; expand def function: proc name mode (debug #f)) ; debug (catch #t ;; 'c99-error 'cpp-error 'nyacc-error (lambda () - (let ((info (make-cpi debug cpp-defs (cons "." inc-dirs) td-dict))) + (let ((info (make-cpi debug cpp-defs (cons "." inc-dirs) inc-help))) (with-fluid* *info* info (lambda () diff --git a/module/nyacc/lang/c99/parser.scm b/module/nyacc/lang/c99/parser.scm index 1994466d..b3441ba7 100644 --- a/module/nyacc/lang/c99/parser.scm +++ b/module/nyacc/lang/c99/parser.scm @@ -66,8 +66,8 @@ ;; @example ;; (with-input-from-file "abc.c" ;; (parse-c #:cpp-defs '("ABC=123")) -;; #:inc-dirs (append '("." "./incs" "/usr/include") c99-std-dict) -;; #:inc-help '(("myinc.h" "foo_t" "bar_t")) +;; #:inc-dirs '(("." "./incs" "/usr/include")) +;; #:inc-help (append '("myinc.h" "foo_t" "bar_t") c99-std-help) ;; #:mode 'file)) ;; @end example (define* (parse-c99 #:key diff --git a/module/nyacc/lang/c99/pprint.scm b/module/nyacc/lang/c99/pprint.scm index 7edf464f..0afd9f9a 100644 --- a/module/nyacc/lang/c99/pprint.scm +++ b/module/nyacc/lang/c99/pprint.scm @@ -394,6 +394,7 @@ ;; |# ;; expression-statement + ((expr-stmt) (sf ";\n")) ((expr-stmt ,expr) (ppx expr) (sf ";\n")) ((expr-stmt ,expr ,comm) (ppx expr) (sf "; ") (ppx comm))