Skip to content

Commit 15219e6

Browse files
authored
Update README.md
1 parent 6d91087 commit 15219e6

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,20 @@ const parser = new SPEG();
1111
parser.parse_grammar('GRAMMAR test a->"A";);
1212
const ast = parser.parse_text('A');
1313
console.log(ast);
14-
```
14+
```
15+
16+
# Grammar example
17+
url.peg
18+
```
19+
GRAMMAR url
20+
21+
url -> scheme "://" host pathname search hash?;
22+
scheme -> "http" "s"?;
23+
host -> hostname port?;
24+
hostname -> segment ("." segment)*;
25+
segment -> [a-z0-9-]+;
26+
port -> ":" [0-9]+;
27+
pathname -> "/" [^ ?]*;
28+
search -> ("?" [^ #]*)?;
29+
hash -> "#" [^ ]*;
30+
```

0 commit comments

Comments
 (0)