Class: Pubid::W3c::Parser

Inherits:
Parslet::Parser
  • Object
show all
Defined in:
lib/pubid/w3c/parser.rb

Overview

Parslet grammar for printed W3C identifiers, e.g. "W3C WD-charmod-19991129" (type + code + date) "W3C NOTE-xml-names" (type + code) "W3C 2dcontext" (bare code)

The grammar only splits off the leading maturity token; the code/date boundary is resolved in the Builder, because a PEG code rule would greedily consume the trailing date and make a .maybe date rule unreliable. This is safe: no real W3C code ends in a same-width (4/6/8) digit run, so the Builder's fixed-width trailing-date test never collides.

Class Method Summary collapse

Class Method Details

.parse(input) ⇒ Object



38
39
40
# File 'lib/pubid/w3c/parser.rb', line 38

def self.parse(input)
  new.parse(input)
end