59c30619e0
FossilOrigin-Name: 7e123ff0f8fcf768e47f06160944245ab121f63621981f148c278a753e4d7ccc
30 lines
850 B
Forth
30 lines
850 B
Forth
## Fix Annoyances
|
|
|
|
Underscores in names (especially variables and constants) are a
|
|
problem as the string processor (`prefix:'`) replaces them with
|
|
a space. The other prefixes do not do this, which leads to bugs.
|
|
|
|
Consider:
|
|
|
|
'test_data var
|
|
#10 !test_data
|
|
|
|
`test_data` is not found as the real name is `test data`, so it
|
|
silently maps the address to 0.
|
|
|
|
As a solution, this replaces `d:add-header` with an new version
|
|
that implementation that remaps any spaces back to underscores
|
|
prior to creating the header.
|
|
|
|
~~~
|
|
{{
|
|
:fields @Dictionary , (link) , (xt) , (class) ;
|
|
:invalid-name? dup ASCII:SPACE s:contains-char? ;
|
|
:rewrite [ ASCII:SPACE [ $_ ] case ] s:map ;
|
|
:entry here &call dip !Dictionary ;
|
|
[ [ fields invalid-name? &rewrite if s, (name) ] entry ]
|
|
}}
|
|
|
|
#1793 &d:add-header store
|
|
&d:add-header n:inc store
|
|
~~~
|