est - String with escaped characters

Module Description

The est module implements a string with escaped characters. The code is inspired by the proposal for escaped strings by Stephen Pelc and Peter Knaggs. The following conversion characters are translated:

\a  - bel = ascii 7
\b  - backspace = ascii 8
\e  - escape = ascii 27
\f  - formfeed = ascii 12
\l  - linefeed = ascii 10
\m  - cr/lf = ascii 13,10
\n  - new line
\q  - quote = ascii 34
\r  - cr = ascii 13
\t  - ht = ascii 9
\v  - vt = ascii 11
\z  - nul = ascii 0
\"  - quote = ascii 34
xhh - hex digit
\\  - backslash

Module Words

String words

parse-esc ( c-addr1 u1 c-addr2 -- c-addr3 u3 )
Parse the escaped character in string c-addr1 u1, store the result in string c-addr2 and return the remaining string c-addr3 u3

Examples

include ffl/est.fs


\ Example 1: String with escaped characters

s\" \"\x48\x65\x6Clo\"" type  cr            \ Shows: "Hello"


\ Example 2: String with escaped characters in dictionary

here                                        \ Remember the start of the string
,\" \qByy\be\q"                             \ Store the string

count type cr                               \ Shows: "Bye" (if backspace is doing its job ...)

generated 10-Apr-2008 by ofcfrth-0.5.0