begin -> do
Shorter and doesn't imply existence of `end'
This commit is contained in:
@@ -128,7 +128,7 @@ return Sex code.
|
||||
#+begin_src scheme
|
||||
(pub defmacro (check-sdl-return call message ret-code)
|
||||
`(if (< 0 ,call)
|
||||
(begin
|
||||
(do
|
||||
(puts ,message)
|
||||
(return ,ret-code))))
|
||||
|
||||
@@ -141,7 +141,7 @@ return Sex code.
|
||||
#+begin_src scheme
|
||||
(pub fn init () int
|
||||
(if (< 0 (SDL_Init SDL_INIT_VIDEO))
|
||||
(begin (puts "Failed to initialize SDL") (return 1)))
|
||||
(do (puts "Failed to initialize SDL") (return 1)))
|
||||
...)
|
||||
#+end_src
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
(pub defmacro (list-for-each list-type list-var elt-type elt-var what-do)
|
||||
(let ((list-var-2 (cat list-var '-2)))
|
||||
`(begin
|
||||
`(do
|
||||
(var ,list-var-2 (* ,list-type) ,list-var)
|
||||
(var ,elt-var ,elt-type (-> ,list-var-2 value))
|
||||
(while (!= (-> ,list-var-2 next) NULL)
|
||||
|
||||
@@ -85,7 +85,7 @@ surrounding c-block supplies them)."
|
||||
(case atom
|
||||
((fn) '%fun)
|
||||
((prototype) '%prototype)
|
||||
((begin) '%block-begin)
|
||||
((do) '%block-begin)
|
||||
((define) '%define)
|
||||
((pointer) '%pointer)
|
||||
((array) '%array)
|
||||
@@ -141,7 +141,7 @@ surrounding c-block supplies them)."
|
||||
;; Statement positions. These are the only places a #line may go,
|
||||
;; and each is spliced or wrapped according to what the
|
||||
;; corresponding fmt-c procedure accepts.
|
||||
(('begin . stmts) (cons '%block-begin (walk-body stmts)))
|
||||
(('do . stmts) (cons '%block-begin (walk-body stmts)))
|
||||
(('if . clauses) (cons 'if (walk-if-clauses clauses)))
|
||||
(('while test . body)
|
||||
(cons* 'while (walk-expr test) (walk-body body)))
|
||||
|
||||
@@ -51,7 +51,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
|
||||
;; Keywords
|
||||
(list (concat "("
|
||||
(regexp-opt '(
|
||||
"begin"
|
||||
"do"
|
||||
"case"
|
||||
"default"
|
||||
"do"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
;; atom-to-fmt-c
|
||||
(test '%fun (atom-to-fmt-c 'fn))
|
||||
(test '%prototype (atom-to-fmt-c 'prototype))
|
||||
(test '%block-begin (atom-to-fmt-c 'begin))
|
||||
(test '%block-begin (atom-to-fmt-c 'do))
|
||||
(test '%define (atom-to-fmt-c 'define))
|
||||
(test '%pointer (atom-to-fmt-c 'pointer))
|
||||
(test '%array (atom-to-fmt-c 'array))
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
" (break))" ; 45
|
||||
" (default" ; 46
|
||||
" (putchar 120)))" ; 47
|
||||
" (begin" ; 48
|
||||
" (do" ; 48
|
||||
" (var bvar int 121)" ; 49
|
||||
" (putchar bvar))" ; 50
|
||||
" (goto done)" ; 51
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
(pub defmacro (list-for-each list-type list-var elt-type elt-var what-do)
|
||||
(let ((list-var-2 (cat list-var '-2)))
|
||||
`(begin
|
||||
`(do
|
||||
(var ,list-var-2 (* ,list-type) ,list-var)
|
||||
(var ,elt-var ,elt-type (-> ,list-var-2 value))
|
||||
(while (!= (-> ,list-var-2 next) NULL)
|
||||
|
||||
Reference in New Issue
Block a user