syntax: adding \b \v and \f escape codes.

db4
John Benediktsson 2014-06-03 18:04:51 -07:00
parent 256b135aa9
commit 5bc1567c05
3 changed files with 7 additions and 1 deletions

View File

@ -10,11 +10,14 @@ ERROR: bad-escape char ;
: escape ( escape -- ch )
H{
{ CHAR: a CHAR: \a }
{ CHAR: b CHAR: \b }
{ CHAR: e CHAR: \e }
{ CHAR: f CHAR: \f }
{ CHAR: n CHAR: \n }
{ CHAR: r CHAR: \r }
{ CHAR: t CHAR: \t }
{ CHAR: s CHAR: \s }
{ CHAR: v CHAR: \v }
{ CHAR: \s CHAR: \s }
{ CHAR: 0 CHAR: \0 }
{ CHAR: \\ CHAR: \\ }

View File

@ -158,6 +158,9 @@ ARTICLE: "escape" "Character escape codes"
{ { $snippet "\\t" } "a tab" }
{ { $snippet "\\n" } "a newline" }
{ { $snippet "\\r" } "a carriage return" }
{ { $snippet "\\b" } "a backspace (ASCII 8)" }
{ { $snippet "\\v" } "a vertical tab (ASCII 11)" }
{ { $snippet "\\f" } "a form feed (ASCII 12)" }
{ { $snippet "\\0" } "a null byte (ASCII 0)" }
{ { $snippet "\\e" } "escape (ASCII 27)" }
{ { $snippet "\\\"" } { $snippet "\"" } }

View File

@ -138,7 +138,7 @@ IN: bootstrap.syntax
scan-token current-vocab create
[ fake-definition ] [ set-last-word ] [ undefined-def define ] tri
] define-core-syntax
"ALIAS:" [
scan-new-word scan-word define-alias
] define-core-syntax