From 5bc1567c053b8ebdc108169041c1488f7f986b33 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 3 Jun 2014 18:04:51 -0700 Subject: [PATCH] syntax: adding \b \v and \f escape codes. --- core/strings/parser/parser.factor | 3 +++ core/syntax/syntax-docs.factor | 3 +++ core/syntax/syntax.factor | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/strings/parser/parser.factor b/core/strings/parser/parser.factor index 236fb8f1ad..cdf95244bf 100644 --- a/core/strings/parser/parser.factor +++ b/core/strings/parser/parser.factor @@ -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: \\ } diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index e3e221feb3..a91023f222 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -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 "\"" } } diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 66b2428d6d..7c6ca98764 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -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