Skip to content

Commit edc35d5

Browse files
committed
Recognizer consolidation with proposal
1 parent d0b3b6c commit edc35d5

File tree

8 files changed

+21
-8
lines changed

8 files changed

+21
-8
lines changed

float.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ si-prefixes count 2/ + Constant zero-exp
187187

188188
[ifdef] r:fail
189189
: flit, postpone Fliteral ;
190-
' noop ' flit, ' flit, recognizer: r:float
190+
' noop ' flit, ' flit, recognizer r:float
191191

192192
: rec:float ( addr u -- r r:float | r:fail )
193193
\G recognize floating point numbers

kernel/comp.fs

+3-1
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,14 @@ defer 0-adjust-locals-size ( -- )
669669
\ concat two xts into one
670670
>r >r :noname r> compile, r> compile, postpone ; ;
671671

672-
: recognizer: ( int-xt comp-xt post-xt "name" -- )
672+
: recognizer ( int-xt comp-xt post-xt "name" -- )
673673
\G create a new recognizer table
674674
>r ['] drop swap concat >r
675675
>r :noname r> compile, postpone ;
676676
r> set-compiler r> set-lit, Constant ;
677677

678+
' recognizer alias recognizer: \ old name, deprecated
679+
678680
\ does>
679681

680682
: doesxt, ( xt -- )

notfound.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ Defer postpone-notfound1 ( addr u -- )
2828
' no.extensions is postpone-notfound1
2929

3030
' interpret-notfound1 ' compiler-notfound1 ' postpone-notfound1
31-
recognizer: r:notfound
31+
recognizer r:notfound
3232

3333
r:notfound get-recognizers 1+ set-recognizers

parsedto.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
\ You should have received a copy of the GNU General Public License
1818
\ along with this program. If not, see http://www.gnu.org/licenses/.
1919

20-
' (int-to) ' (comp-to) ' lit, recognizer: r:to
20+
' (int-to) ' (comp-to) ' lit, recognizer r:to
2121

2222
: rec:to ( addr u -- xt r:to | r:fail )
2323
2dup s" ->" string-prefix? 0= IF 2drop r:fail EXIT THEN

quotedstring.fs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
: slit, postpone sliteral ;
2525

26-
' noop ' slit, dup recognizer: r:string
26+
' noop ' slit, dup recognizer r:string
2727

2828
: rec:string ( addr u -- addr u' r:string | r:fail )
2929
2dup s\" \"" string-prefix?
@@ -34,7 +34,7 @@
3434

3535
0 [IF] \ dot-quoted strings, we don't need them
3636
: .slit slit, postpone type ;
37-
' type ' .slit ' slit, recognizer: r:."
37+
' type ' .slit ' slit, recognizer r:."
3838

3939
: rec:." ( addr u -- addr u' r:." | addr u r:fail )
4040
2dup ".\"" string-prefix?

rec-env.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
: env$, ( addr u -- ) slit, postpone getenv ;
2121

22-
' getenv ' env$, ' slit, recognizer: r:env
22+
' getenv ' env$, ' slit, recognizer r:env
2323

2424
: rec:env ( addr u -- addr u r:env | r:fail )
2525
over c@ '$' <> IF 2drop r:fail EXIT THEN

script.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
: >system ( addr u -- ) cr system ;
2121
: system, slit, postpone >system ;
22-
' >system ' system, ' slit, recognizer: r:eval
22+
' >system ' system, ' slit, recognizer r:eval
2323

2424
: rec:shell ( addr u -- addr u' r:string )
2525
\G evaluate string + rest of command line

stuff.fs

+11
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,17 @@ s" help.txt" open-fpath-file throw 2drop slurp-fid save-mem-dict
586586
2>r : help ( -- ) [ 2r> ] 2literal type ; \ gforth
587587
\G Print some help for the first steps
588588

589+
\ r:word and r:name
590+
591+
:noname drop execute ;
592+
:noname 0> IF execute ELSE compile, THEN ;
593+
:noname postpone 2literal ;
594+
recognizer r:word ( takes xt +/-1, i.e. result of find and search-wordlist )
595+
596+
:noname r>int execute ;
597+
:noname r>comp execute ;
598+
' lit,
599+
recognizer r:name ( takes nt, i.e. result of find-name and find-name-in )
589600

590601
\ growing buffers that need not be full
591602

0 commit comments

Comments
 (0)