class Peggy::ABNF::ABNFParser
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/abnc.rb, line 24 def initialize super build end
Private Instance Methods
build()
click to toggle source
# File lib/abnc.rb, line 31 def build self.ignore_productions = [:ws, :s] grammar{seq{many{prod}; eof}} prodname{lit /[A-Za-z][-A-Za-z0-9]*/} ws{lit /(?:[ \t\n]|;[^\n]*\n)+/} s{opt{ws}} prod{seq{prodname; s; lit '='; s; prodalt; s}} prodalt{seq{ prodterm many{seq{s; lit '/'; s; prodterm}} }} prodterm{seq{ prodatom many{ seq {s; prodatom} } }} prodatom{ alt { numlit casese seq{opt{lit "%i"}; casein} seq{prodname; neg{seq{s; lit '='}}} optgroup repgroup # XXX: specific repetition is missing group } } numlit{alt{ lit /%x[0-9A-Fa-f][0-9A-Fa-f]([-.][0-9A-Fa-f][0-9A-Fa-f])*/ lit /%d[0-9]+([-.][0-9]+)*/ }} casein{lit /"[^"]+"/} # " casese{lit /%s"[^"]+"/} # " optgroup{seq{lit "["; s; prodalt; s; lit "]"}} group{seq{lit "("; s; prodalt; s; lit ")"}} repgroup{seq{repspec; prodatom}} repspec{lit /[0-9]*\*[0-9]*/} end