Skip to content

Commit

Permalink
(back-)tick recognizer added; ... output adopted
Browse files Browse the repository at this point in the history
  • Loading branch information
GeraldWodni committed Aug 25, 2018
1 parent 5c5d6cf commit 04c612b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions rec-tick.fs
@@ -0,0 +1,31 @@
\ (back-)tick recognizer
\ `foo puts the xt of foo on the stack like ' foo does

\ Copyright (C) 2018 Free Software Foundation, Inc.

\ This file is part of Gforth.

\ Gforth is free software; you can redistribute it and/or
\ modify it under the terms of the GNU General Public License
\ as published by the Free Software Foundation, either version 3
\ of the License, or (at your option) any later version.

\ This program 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 General Public License for more details.

\ You should have received a copy of the GNU General Public License
\ along with this program. If not, see http://www.gnu.org/licenses/.

' noop ' lit, ' lit, rectype: rectype-tick

: rec-tick ( addr u -- xt rectype-tick | rectype-null )
\G words prefixed with @code{'`'} return their xt.
\G Example: @code{`dup} gives the xt of dup
over c@ '`' <> if 2drop rectype-null exit then
1 /string find-name
dup 0= if drop rectype-null exit then
rectype-tick ;

' rec-tick forth-recognizer >back
2 changes: 1 addition & 1 deletion smartdots.fs
Expand Up @@ -32,7 +32,7 @@
: .string. ( addr u -- )
'"' emit type '"' emit space ;
: .addr. ( addr -- )
dup >name dup IF ." '" .name drop ELSE drop hex. THEN ;
dup >name dup IF ." `" .name drop ELSE drop hex. THEN ;
: .var. ( addr -- )
dup body> >name dup IF .name drop ELSE drop hex. THEN ;

Expand Down
1 change: 1 addition & 0 deletions startup.fs
Expand Up @@ -53,6 +53,7 @@ require history.fs
require quotes.fs
require rec-string.fs
require rec-to.fs
require rec-tick.fs
require substitute.fs
require code.fs
require see.fs
Expand Down

0 comments on commit 04c612b

Please sign in to comment.