Sha256: d8c6eacdca01c4073d57ed583303f27865d863d683609bb361c242001d4b85fc

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

/* An EBNF grammar for EBNF */
[1] ebnf        ::= (declaration | rule)*

[2] declaration ::= '@terminals' | '@pass'

[3] rule        ::= lhs '::=' expression

[4] lhs         ::= '[' SYMBOL ']' SYMBOL

[5] expression  ::= alt

[6] alt         ::= seq ('|' seq)*

[7] seq         ::= diff+

[8] diff        ::= postfix ('-' postfix)*

[9] postfix     ::= primary ( [?*+] )?

[10] primary    ::= HEX
                |   RANGE
                |   ENUM
                |   O_RANGE
                |   O_ENUM
                |   STRING1
                |   STRING2
                |   '(' expression ')'

@terminals

[11] SYMBOL     ::= ([a-z] | [A-Z] | [0-9] | "_")+

[12] HEX        ::= '#x' ([0-9] | [a-f] | [A-F])+

[13] RANGE      ::= '[' CHAR '-' CHAR ']'

[14] ENUM       ::= '[' CHAR+ ']'

[15] O_RANGE    ::= '[^' CHAR '-' CHAR ']'

[16] O_ENUM     ::= '[^' CHAR+ ']'

[17] STRING1    ::= '"' (CHAR - '"')* '"'

[18] STRING2    ::= "'" (CHAR - "'")* "'"

[19] CHAR       ::= HEX
                |   ('\\' [\\trn'"])
                |   [^\t\r\n'"]

@pass           ::= (
                      [#x20\t\r\n]
                    |  
                    )+

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ebnf-0.2.0 etc/ebnf.ebnf
ebnf-0.1.0 etc/ebnf.ebnf