diff --git a/mes/module/mes/peg/cache.scm b/mes/module/mes/peg/cache.scm index c6e52db2..27ce7564 100644 --- a/mes/module/mes/peg/cache.scm +++ b/mes/module/mes/peg/cache.scm @@ -1,23 +1,23 @@ -;;; -*-scheme-*- +;;; GNU Mes --- Maxwell Equations of Software +;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Mes. +;;; +;;; GNU Mes is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Mes is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mes. If not, see . -;;;; cache.scm --- cache the results of parsing -;;;; -;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. -;;;; -;;;; This library is free software; you can redistribute it and/or -;;;; modify it under the terms of the GNU Lesser General Public -;;;; License as published by the Free Software Foundation; either -;;;; version 3 of the License, or (at your option) any later version. -;;;; -;;;; This library is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;;; Lesser General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU Lesser General Public -;;;; License along with this library; if not, write to the Free Software -;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;;;; +;;; Taken from GNU Guile +;;; cache.scm --- cache the results of parsing (define-module (ice-9 peg cache) #:export (cg-cached-parser)) diff --git a/mes/module/mes/peg/codegen.scm b/mes/module/mes/peg/codegen.scm index 701c5a81..e1040def 100644 --- a/mes/module/mes/peg/codegen.scm +++ b/mes/module/mes/peg/codegen.scm @@ -1,21 +1,24 @@ -;;;; codegen.scm --- code generation for composable parsers -;;;; -;;;; Copyright (C) 2011 Free Software Foundation, Inc. -;;;; -;;;; This library is free software; you can redistribute it and/or -;;;; modify it under the terms of the GNU Lesser General Public -;;;; License as published by the Free Software Foundation; either -;;;; version 3 of the License, or (at your option) any later version. -;;;; -;;;; This library is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;;; Lesser General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU Lesser General Public -;;;; License along with this library; if not, write to the Free Software -;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;;;; +;;; GNU Mes --- Maxwell Equations of Software +;;; Copyright (C) 2011 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Mes. +;;; +;;; GNU Mes is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Mes is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mes. If not, see . + +;;; Taken from GNU Guile + +;;; codegen.scm --- code generation for composable parsers (define-module (ice-9 peg codegen) #:export (compile-peg-pattern wrap-parser-for-users add-peg-compiler!) @@ -174,7 +177,7 @@ (cggr accum 'cg-and #`(reverse #,body) at)) ((first rest ...) #`(let ((res (#,(compile-peg-pattern #'first accum) #,str #,strlen #,at))) - (and res + (and res ;; update AT and BODY then recurse (let ((newat (car res)) (newbody (cadr res))) diff --git a/mes/module/mes/peg/simplify-tree.scm b/mes/module/mes/peg/simplify-tree.scm index 82eb004d..6dc00a63 100644 --- a/mes/module/mes/peg/simplify-tree.scm +++ b/mes/module/mes/peg/simplify-tree.scm @@ -1,21 +1,24 @@ -;;;; simplify-tree.scm --- utility functions for the PEG parser -;;;; -;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. -;;;; -;;;; This library is free software; you can redistribute it and/or -;;;; modify it under the terms of the GNU Lesser General Public -;;;; License as published by the Free Software Foundation; either -;;;; version 3 of the License, or (at your option) any later version. -;;;; -;;;; This library is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;;; Lesser General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU Lesser General Public -;;;; License along with this library; if not, write to the Free Software -;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;;;; +;;; GNU Mes --- Maxwell Equations of Software +;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Mes. +;;; +;;; GNU Mes is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Mes is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mes. If not, see . + +;;; Taken from GNU Guile + +;;; simplify-tree.scm --- utility functions for the PEG parser (define-module (ice-9 peg simplify-tree) #:export (keyword-flatten context-flatten string-collapse) diff --git a/mes/module/mes/peg/string-peg.scm b/mes/module/mes/peg/string-peg.scm index 45ed14bb..3a11fed8 100644 --- a/mes/module/mes/peg/string-peg.scm +++ b/mes/module/mes/peg/string-peg.scm @@ -1,21 +1,24 @@ -;;;; string-peg.scm --- representing PEG grammars as strings -;;;; -;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. -;;;; -;;;; This library is free software; you can redistribute it and/or -;;;; modify it under the terms of the GNU Lesser General Public -;;;; License as published by the Free Software Foundation; either -;;;; version 3 of the License, or (at your option) any later version. -;;;; -;;;; This library is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;;; Lesser General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU Lesser General Public -;;;; License along with this library; if not, write to the Free Software -;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;;;; +;;; GNU Mes --- Maxwell Equations of Software +;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Mes. +;;; +;;; GNU Mes is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Mes is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mes. If not, see . + +;;; Taken from GNU Guile + +;;; string-peg.scm --- representing PEG grammars as strings (define-module (ice-9 peg string-peg) #:export (peg-as-peg @@ -270,4 +273,3 @@ RB < ']' (else (error "Bad embedded PEG string" args)))) (add-peg-compiler! 'peg peg-string-compile) - diff --git a/mes/module/mes/peg/using-parsers.scm b/mes/module/mes/peg/using-parsers.scm index d1a9382b..8a8f6af6 100644 --- a/mes/module/mes/peg/using-parsers.scm +++ b/mes/module/mes/peg/using-parsers.scm @@ -1,21 +1,24 @@ -;;;; using-parsers.scm --- utilities to make using parsers easier -;;;; -;;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. -;;;; -;;;; This library is free software; you can redistribute it and/or -;;;; modify it under the terms of the GNU Lesser General Public -;;;; License as published by the Free Software Foundation; either -;;;; version 3 of the License, or (at your option) any later version. -;;;; -;;;; This library is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;;; Lesser General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU Lesser General Public -;;;; License along with this library; if not, write to the Free Software -;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;;;; +;;; GNU Mes --- Maxwell Equations of Software +;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Mes. +;;; +;;; GNU Mes is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Mes is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mes. If not, see . + +;;; Taken from GNU Guile + +;;; using-parsers.scm --- utilities to make using parsers easier (define-module (ice-9 peg using-parsers) #:use-module (ice-9 peg simplify-tree) diff --git a/mes/module/mes/pmatch.scm b/mes/module/mes/pmatch.scm index 1dfd0ff6..30e5103a 100644 --- a/mes/module/mes/pmatch.scm +++ b/mes/module/mes/pmatch.scm @@ -1,23 +1,28 @@ ;;; pmatch, a simple matcher +;;; GNU Mes --- Maxwell Equations of Software ;;; Copyright (C) 2009, 2010, 2012 Free Software Foundation, Inc ;;; Copyright (C) 2005,2006,2007 Oleg Kiselyov ;;; Copyright (C) 2007 Daniel P. Friedman ;;; Copyright (C) 2018 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen ;;; -;;; This library is free software; you can redistribute it and/or -;;; modify it under the terms of the GNU Lesser General Public -;;; License as published by the Free Software Foundation; either -;;; version 3 of the License, or (at your option) any later version. +;;; This file is part of GNU Mes. ;;; -;;; This library is distributed in the hope that it will be useful, -;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; Lesser General Public License for more details. +;;; GNU Mes is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. ;;; -;;; You should have received a copy of the GNU Lesser General Public -;;; License along with this library; if not, write to the Free Software -;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;; GNU Mes is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mes. If not, see . + +;;; Taken from GNU Guile ;;; Originally written by Oleg Kiselyov for LeanTAP in Kanren, which is ;;; available under the MIT license. diff --git a/mes/module/sxml/xpath.scm b/mes/module/sxml/xpath.scm index 77ea53f1..d4838e34 100644 --- a/mes/module/sxml/xpath.scm +++ b/mes/module/sxml/xpath.scm @@ -1,23 +1,26 @@ -;;;; (sxml xpath) -- SXPath -;;;; -;;;; Copyright (C) 2009 Free Software Foundation, Inc. -;;;; Modified 2004 by Andy Wingo . -;;;; Written 2001 by Oleg Kiselyov SXPath.scm. -;;;; -;;;; This library is free software; you can redistribute it and/or -;;;; modify it under the terms of the GNU Lesser General Public -;;;; License as published by the Free Software Foundation; either -;;;; version 3 of the License, or (at your option) any later version. -;;;; -;;;; This library is distributed in the hope that it will be useful, -;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;;; Lesser General Public License for more details. -;;;; -;;;; You should have received a copy of the GNU Lesser General Public -;;;; License along with this library; if not, write to the Free Software -;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;;;; +;;; GNU Mes --- Maxwell Equations of Software +;;; Copyright (C) 2009 Free Software Foundation, Inc. +;;; Modified 2004 by Andy Wingo . +;;; Written 2001 by Oleg Kiselyov SXPath.scm. +;;; +;;; This file is part of GNU Mes. +;;; +;;; GNU Mes is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Mes is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Mes. If not, see . + +;;; Taken from GNU Guile + +;;; (sxml xpath) -- SXPath ;;; Commentary: ;; @@ -205,7 +208,7 @@ ; take-until is a variation of the xpath:filter above: take-until passes ; elements of an ordered input set till (but not including) the first ; element that satisfies the predicate. -; The nodeset returned by ((take-until (not pred)) nset) is a subset -- +; The nodeset returned by ((take-until (not pred)) nset) is a subset -- ; to be more precise, a prefix -- of the nodeset returned by ; ((xpath:filter pred) nset) @@ -258,7 +261,7 @@ ; Reverses the order of nodes in the nodeset ; This basic converter is needed to implement a reverse document order ; (see the XPath Recommendation). -(define node-reverse +(define node-reverse (lambda (node-or-nodeset) (if (not (nodeset? node-or-nodeset)) (list node-or-nodeset) (reverse node-or-nodeset)))) @@ -306,7 +309,7 @@ (define (select-kids test-pred?) (lambda (node) ; node or node-set - (cond + (cond ((null? node) node) ((not (pair? node)) '()) ; No children ((symbol? (car node)) @@ -330,7 +333,7 @@ (lambda (nodeset) ; Nodeset or node (let loop ((nodeset nodeset) (selectors selectors)) (if (null? selectors) nodeset - (loop + (loop (if (nodeset? nodeset) (map-union (car selectors) nodeset) ((car selectors) nodeset)) @@ -361,7 +364,7 @@ ; (define (node-or . converters) ; (lambda (node-or-nodeset) ; (if (null? converters) node-or-nodeset -; (append +; (append ; ((car converters) node-or-nodeset) ; ((apply node-or (cdr converters)) node-or-nodeset))))) ; More optimal implementation follows @@ -389,7 +392,7 @@ ; this point further iterations will no longer affect the result and ; can be stopped. -(define (node-closure test-pred?) +(define (node-closure test-pred?) (lambda (node) ; Nodeset or node (let loop ((parent node) (result '())) (if (null? parent) result @@ -436,7 +439,7 @@ ; (sxpath '()) -> (node-join) ; (sxpath '(path-component ...)) -> ; (node-join (sxpath1 path-component) (sxpath '(...))) -; (sxpath1 '//) -> (node-or +; (sxpath1 '//) -> (node-or ; (node-self (node-typeof? '*any*)) ; (node-closure (node-typeof? '*any*))) ; (sxpath1 '(equal? x)) -> (select-kids (node-equal? x)) @@ -473,7 +476,7 @@ (loop ((select-kids (apply node-eq? (cdar path))) nodeset) (cdr path))) ((pair? (car path)) - (let reducer ((nodeset + (let reducer ((nodeset (if (symbol? (caar path)) ((select-kids (node-typeof? (caar path))) nodeset) (loop nodeset (caar path))))