add support for newline & tab literals in grammars
parent
273753f1d5
commit
ae07f3da64
@ -0,0 +1,6 @@
|
|||||||
|
#lang brag
|
||||||
|
start: (tab | space | newline | letter)*
|
||||||
|
tab: '\t'
|
||||||
|
space: " "
|
||||||
|
newline: "\n"
|
||||||
|
letter: "x" | "y" | "z"
|
@ -0,0 +1,12 @@
|
|||||||
|
#lang racket/base
|
||||||
|
(require brag/examples/whitespace
|
||||||
|
brag/support
|
||||||
|
rackunit)
|
||||||
|
|
||||||
|
(check-equal?
|
||||||
|
(parse-tree "\ty\n x\tz")
|
||||||
|
'(start (tab "\t") (letter "y") (newline "\n") (space " ") (letter "x") (tab "\t") (letter "z")))
|
||||||
|
|
||||||
|
(check-equal?
|
||||||
|
(parse-tree "\t\n \t")
|
||||||
|
'(start (tab "\t") (newline "\n") (space " ") (tab "\t")))
|
Loading…
Reference in New Issue