-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrammar.txt
29 lines (15 loc) · 1.08 KB
/
grammar.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FtanML Grammar
document ::= (value | implicit-array)?
implicit-array ::= value (array | element | string | (whitespace (number | "true" | "false" | "null")))+
value ::= array | element | string | number | "true" | "false" | "null"
array ::= "[" ((value | implicit-array) ("," (value | implicit-array))*)? "]"
element ::= "<" name? pair* (value | implicit-array)? ">"
string ::= (""" (string-content | "'" | "|")* """) | ("'" (string-content | """ | "|")* "'") | ("|" (string-content | """ | "'")* "|"?)
whitespace ::= [\p{Space}]+
number ::= "-"? (0 | ([1-9] [0-9]*)) ("." [0-9]+)? (("e" | "E") ("+" | "-")? [0-9]+)?
name ::= name-part (":" name-part)*
pair ::= name "=" value
string-content ::= ([^<>"'\|] | escaped-char | CDATA | element)
name-part ::= string | [\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nd}\p{Nl}\p{No}_$]+
escaped-char ::= "\" ("n" | "r" | "b" | "f" | "t" | "\" | "/" | "<" | ">" | """ | "'" | ("u" [0-9A-Fa-f]+ ";"))
CDATA ::= "\[" *some_character* [^*some_character*]* *some_character* "]" (where *some_character* is one character specific to this CDATA)