Re-root site.
This commit is contained in:
26
common/conditionals.fs
Normal file
26
common/conditionals.fs
Normal file
@ -0,0 +1,26 @@
|
||||
\ Copyright 2021 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
( Interpret time conditionals )
|
||||
|
||||
: DEFINED? ( "name" -- xt|0 )
|
||||
bl parse find state @ if aliteral then ; immediate
|
||||
defer [SKIP]
|
||||
: [THEN] ; : [ELSE] [SKIP] ; : [IF] 0= if [SKIP] then ;
|
||||
: [SKIP]' 0 begin postpone defined? dup if
|
||||
dup ['] [IF] = if swap 1+ swap then
|
||||
dup ['] [ELSE] = if swap dup 0 <= if 2drop exit then swap then
|
||||
dup ['] [THEN] = if swap 1- dup 0< if 2drop exit then swap then
|
||||
then drop again ;
|
||||
' [SKIP]' is [SKIP]
|
||||
Reference in New Issue
Block a user