1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00

module/language/lua/parser.scm: Rename #:dots to #:varargs

This commit is contained in:
Phil 2011-04-22 01:11:38 -05:00 committed by Ian Price
parent becaec9a4e
commit faa16f9989
6 changed files with 15 additions and 15 deletions

View file

@ -282,7 +282,7 @@ of an identifier"
(begin (begin
(read-char) (read-char)
(if (eqv? (peek-char) #\.) (if (eqv? (peek-char) #\.)
(begin (read-char) #:dots) (begin (read-char) #:varargs)
#:concat)) #:concat))
#\.))) #\.)))

View file

@ -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 Use prompt and abort instead of throw and catch
** TODO Standard library function: module ** TODO Standard library function: module
** TODO Standard library function: table.sort ** TODO Standard library function: table.sort
** TODO Get the official test suite running ** TODO Get the official Lua 5.1 test suite running
* Eh * 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 Better testing of standard library modules io, os
** TODO Function environments (getfenv and setfenv) ** TODO Function environments (getfenv and setfenv)
** TODO Parser should probably be rewritten
* Differences * Differences
Here are some difference in Guile Lua's behavior that should not cause Here are some difference in Guile Lua's behavior that should not cause

View file

@ -125,7 +125,7 @@
(define *special-tokens* (define *special-tokens*
'(#\. #\( #\) #\, #\- #\< #\; #\+ #\{ #\} #\[ #\] #\: #\# '(#\. #\( #\) #\, #\- #\< #\; #\+ #\{ #\} #\[ #\] #\: #\#
#:function #:end #:if #:return #:elseif #:then #:else #:true #:false #:function #:end #:if #:return #:elseif #:then #:else #:true #:false
#:nil #:== #:~= #:= #\> #:>= #:<= #:local #:dots #:break #:do #:in #:nil #:== #:~= #:= #\> #:>= #:<= #:local #:varargs #:break #:do #:in
#:and #:or)) #:and #:or))
(define (token/type t) (define (token/type t)
@ -466,7 +466,7 @@
(values (reverse! parameters) #f)))) (values (reverse! parameters) #f))))
((#\)) ((#\))
(values (reverse! parameters) #f)) (values (reverse! parameters) #f))
((#:dots) ((#:varargs)
(advance!) (advance!)
(values (reverse! parameters) #t)) (values (reverse! parameters) #t))
(else (else
@ -532,7 +532,7 @@
;; table-literal ;; table-literal
((#\{) (table-literal)) ((#\{) (table-literal))
;; ... ;; ...
((#:dots) ((#:varargs)
(unless *vararg-function* (unless *vararg-function*
(syntax-error src "cannot use '...' outside of a variable arguments function")) (syntax-error src "cannot use '...' outside of a variable arguments function"))
(advance! (make-ast-variable-arguments src))) (advance! (make-ast-variable-arguments src)))

View file

@ -6,12 +6,12 @@
;;;; modify it under the terms of the GNU Lesser General Public ;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either ;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version. ;;;; version 3 of the License, or (at your option) any later version.
;;;; ;;;;
;;;; This library is distributed in the hope that it will be useful, ;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details. ;;;; Lesser General Public License for more details.
;;;; ;;;;
;;;; You should have received a copy of the GNU Lesser General Public ;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software ;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -37,7 +37,7 @@
((test ((test
(syntax-rules () (syntax-rules ()
((_ string expect) ((_ 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) ((_ string)
(test string #t))))) (test string #t)))))

View file

@ -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. ;;;; Copyright (C) 2010 Free Software Foundation, Inc.
;;;; ;;;;
@ -45,5 +45,5 @@
;;; y will equal 2 in case of extra eval ;;; 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") (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 ;;; 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")
)) ))

View file

@ -6,12 +6,12 @@
;;;; modify it under the terms of the GNU Lesser General Public ;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either ;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version. ;;;; version 3 of the License, or (at your option) any later version.
;;;; ;;;;
;;;; This library is distributed in the hope that it will be useful, ;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details. ;;;; Lesser General Public License for more details.
;;;; ;;;;
;;;; You should have received a copy of the GNU Lesser General Public ;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software ;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@ -37,7 +37,7 @@
((test ((test
(syntax-rules () (syntax-rules ()
((_ string expect) ((_ 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) ((_ string)
(test string #t))))) (test string #t)))))