CHAR:
Factor documentation > Factor handbook > The language > Syntax > Literals > Character and string syntax
Next:"


Vocabulary
syntax

Syntax
CHAR: token


Inputs and outputs
tokena literal character, escape code, or Unicode code point name


Word description
Adds a Unicode code point to the parse tree.

Examples
CHAR: x CHAR: \u000032 CHAR: \u{exclamation-mark} CHAR: exclamation-mark CHAR: ugaritic-letter-samka


Definition
USING: combinators kernel lexer namespaces sequences splitting
strings strings.parser ;

IN: syntax

SYNTAX: CHAR:
scan-token {
{ [ dup length 1 = ] [ first ] }
{ [ "\\" ?head ] [ next-escape >string "" assert= ] }
[ name>char-hook get ( name -- char ) call-effect ]
} cond suffix! ;