Class: Pubid::Easc::Parser

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

Overview

Parslet grammar for EASC identifiers.

Accepts the Cyrillic surface forms observed in mgscatalog.by:

ПМГ 03-2025
ПМГ В 31-2001           (defense variant)
РМГ 151-2025
РМГ 29-2013

Also accepts Latin transliterations (PMG, RMG, V) for round-tripping with English-language tooling. The renderer emits Cyrillic as the canonical form.

Class Method Summary collapse

Methods included from Parser::CommonParseRules

included

Class Method Details

.parse(string) ⇒ Object

Raises:

  • (ArgumentError)


73
74
75
76
77
# File 'lib/pubid/easc/parser.rb', line 73

def self.parse(string)
  raise ArgumentError, ::Pubid::INPUT_TOO_LONG_MESSAGE if string.length > ::Pubid::MAX_INPUT_LENGTH

  new.parse(string.strip)
end