-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaliases.fs
More file actions
65 lines (52 loc) · 1.58 KB
/
aliases.fs
File metadata and controls
65 lines (52 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
\ aliases.fs
\ This file is part of Galope
\ http://programandala.net/en.program.galope.html
\ Author: Marcos Cruz (programandala.net), 2016, 2017.
\ ==============================================================
require ./colon-alias.fs
require ./package.fs
package galope-aliases
: parse-alias ( -- ca len )
begin parse-name dup 0=
while 2drop refill 0=
abort" Error: `end-aliases` is missing"
repeat ;
\ Parse and return the next alias of the list started by
\ `aliases`.
: another-alias? ( -- ca len f )
parse-alias 2dup s" end-aliases" compare ;
\ Parse and return the next alias _ca len_ of the list started by
\ `aliases`. If _f_ is false, _ca len_ is the word "end-aliases",
\ which marks the end of the list.
public
: aliases ( xt "name#0" .. "name#n" "end-aliases" -- )
begin dup another-alias? ( xt xt ca len f )
while :alias
repeat 2drop 2drop ;
\ doc{
\
\ aliases ( xt "name#0" .. "name#n" "end-aliases" -- )
\
\ Create any number of aliases of _xt_, until "end-aliases" is
\ parsed.
\
\ See: `immediate-aliases`, `:alias`.
\
\ }doc
end-package
\ ==============================================================
\ Change log
\ 2016-06-25: Extract from "Asalto y castigo"
\ (http://programandala.net/en.program.asalto_y_castigo.forth.html)
\ and rename.
\
\ 2016-07-11: Update source layout and file header.
\
\ 2017-08-17: Update stack notation.
\
\ 2017-08-18: Use `package` instead of `module:`.
\
\ 2017-10-24: Improve documentation.
\
\ 2017-12-04: Rename `aliases:` `aliases`; rename `;aliases`
\ `end-aliases`. Improve documentation.