EBNF Rule: Strings

Next:EBNF Rule: Any

A string in a rule will match that sequence of characters from the input string. The string is delimited by matching single or double quotes. Factor's escape sequences are interpreted: Character escape codes. For double quotes delimiters, an escaped double quote doesn't terminate the string. The AST result from the match is the string itself.

USING: prettyprint peg.ebnf ; "helloworld" EBNF[[ rule="hello" "world" ]] .
V{ "hello" "world" }

USING: prettyprint peg.ebnf ; "AΣ𝄞" EBNF[[ rule='\x41' '\u{greek-capital-letter-sigma}' '\u01D11E' ]] .
V{ "A" "Σ" "𝄞" }

USING: io peg.ebnf ; "A double quote: \"" EBNF[[ rule='A double quote: "' ]] print
A double quote: "

USING: io peg.ebnf ; "' and \"" EBNF[[ rule="' and \"" ]] print
' and "