From faa16f99898a329eba0eaff0ab520eb0f9adbecb Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 22 Apr 2011 01:11:38 -0500 Subject: [PATCH] module/language/lua/parser.scm: Rename #:dots to #:varargs --- module/language/lua/lexer.scm | 2 +- module/language/lua/notes.org | 6 +++--- module/language/lua/parser.scm | 6 +++--- test-suite/tests/lua-eval-2.test | 6 +++--- test-suite/tests/lua-eval-3.test | 4 ++-- test-suite/tests/lua-eval.test | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/module/language/lua/lexer.scm b/module/language/lua/lexer.scm index 098905f05..17610da84 100644 --- a/module/language/lua/lexer.scm +++ b/module/language/lua/lexer.scm @@ -282,7 +282,7 @@ of an identifier" (begin (read-char) (if (eqv? (peek-char) #\.) - (begin (read-char) #:dots) + (begin (read-char) #:varargs) #:concat)) #\.))) diff --git a/module/language/lua/notes.org b/module/language/lua/notes.org index 49f6b12fe..4e24cb95f 100644 --- a/module/language/lua/notes.org +++ b/module/language/lua/notes.org @@ -9,13 +9,13 @@ This is an org-mode todo list of stuff that needs to be done for Guile Lua. ** TODO Use prompt and abort instead of throw and catch ** TODO Standard library function: module ** TODO Standard library function: table.sort -** TODO Get the official test suite running +** TODO Get the official Lua 5.1 test suite running * Eh +** TODO Standard library function: math.frexp + Pending some additions to Guile's numeric tower. ** TODO Better testing of standard library modules io, os ** TODO Function environments (getfenv and setfenv) -** TODO Parser should probably be rewritten - * Differences Here are some difference in Guile Lua's behavior that should not cause diff --git a/module/language/lua/parser.scm b/module/language/lua/parser.scm index 52cf5a381..b602d20ab 100644 --- a/module/language/lua/parser.scm +++ b/module/language/lua/parser.scm @@ -125,7 +125,7 @@ (define *special-tokens* '(#\. #\( #\) #\, #\- #\< #\; #\+ #\{ #\} #\[ #\] #\: #\# #:function #:end #:if #:return #:elseif #:then #:else #:true #:false - #:nil #:== #:~= #:= #\> #:>= #:<= #:local #:dots #:break #:do #:in + #:nil #:== #:~= #:= #\> #:>= #:<= #:local #:varargs #:break #:do #:in #:and #:or)) (define (token/type t) @@ -466,7 +466,7 @@ (values (reverse! parameters) #f)))) ((#\)) (values (reverse! parameters) #f)) - ((#:dots) + ((#:varargs) (advance!) (values (reverse! parameters) #t)) (else @@ -532,7 +532,7 @@ ;; table-literal ((#\{) (table-literal)) ;; ... - ((#:dots) + ((#:varargs) (unless *vararg-function* (syntax-error src "cannot use '...' outside of a variable arguments function")) (advance! (make-ast-variable-arguments src))) diff --git a/test-suite/tests/lua-eval-2.test b/test-suite/tests/lua-eval-2.test index c94694f59..928cebe86 100644 --- a/test-suite/tests/lua-eval-2.test +++ b/test-suite/tests/lua-eval-2.test @@ -6,12 +6,12 @@ ;;;; 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 @@ -37,7 +37,7 @@ ((test (syntax-rules () ((_ string expect) - (pass-if (format "~S => ~S" string expect) (equal? (from-string string) expect))) + (pass-if (format #f "~S => ~S" string expect) (equal? (from-string string) expect))) ((_ string) (test string #t))))) diff --git a/test-suite/tests/lua-eval-3.test b/test-suite/tests/lua-eval-3.test index 881389c32..533d4a85b 100644 --- a/test-suite/tests/lua-eval-3.test +++ b/test-suite/tests/lua-eval-3.test @@ -1,4 +1,4 @@ -;;;; lua-eval-2.test --- basic tests for builtin lua constructs, act III -*- mode: scheme -*- +;;;; lua-eval-3.test --- basic tests for builtin lua constructs, act III -*- mode: scheme -*- ;;;; ;;;; Copyright (C) 2010 Free Software Foundation, Inc. ;;;; @@ -45,5 +45,5 @@ ;;; y will equal 2 in case of extra eval (test "y = 0 function tmp() y = y + 1 return true end assert(tmp() or tmp()) return y == 1") ;;; y will equal 4 in case of extra eval - (test "y = 0 function tmp() y = y + 2 return false end; function tmp2() y = y + 1 return true end; print(tmp() and tmp2()) print(y) return y == 2") + (test "y = 0 function void(x) end function tmp() y = y + 2 return false end; function tmp2() y = y + 1 return true end; void(tmp() and tmp2()) return y == 2") )) diff --git a/test-suite/tests/lua-eval.test b/test-suite/tests/lua-eval.test index 93e346e88..7008314aa 100644 --- a/test-suite/tests/lua-eval.test +++ b/test-suite/tests/lua-eval.test @@ -6,12 +6,12 @@ ;;;; 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 @@ -37,7 +37,7 @@ ((test (syntax-rules () ((_ string expect) - (pass-if (format "~S => ~S" string expect) (equal? (from-string string) expect))) + (pass-if (format #f "~S => ~S" string expect) (equal? (from-string string) expect))) ((_ string) (test string #t)))))