You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
418 B
Racket
16 lines
418 B
Racket
7 years ago
|
#lang brag
|
||
|
|
||
|
top : (/NEWLINE+ [line])* /NEWLINE*
|
||
|
line : [lookbehind] pat [lookahead]
|
||
|
pat : repeat+ | choice
|
||
|
lookbehind : /"(" /"?" /"<" /"=" pat /")"
|
||
|
lookahead : /"(" /"?" /"=" pat /")"
|
||
|
choice : pat (/"|" pat)+
|
||
|
repeat : repeatable [("*" | "+") ["?"] | "?"]
|
||
|
@repeatable : group | any | start | end | literals | chars
|
||
|
group : /"(" pat /")"
|
||
|
any : /"."
|
||
|
start : /"^"
|
||
|
end : /"$"
|
||
|
literals : LITERAL+
|
||
|
chars : /"[" LITERAL* /"]"
|