Class: Pubid::Iala::Parser

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

Overview

Parslet grammar for IALA identifiers.

Accepts every shape that appears on the IALA website or cover page:

S1070
S1070 Ed 2.0
IALA S1070 Ed 2.0
S1070 Ed 2.0 (F)
R1016:ed2.0(F)
C0103-1
C0103-1 Ed 3.0

Class Method Summary collapse

Methods included from Parser::CommonParseRules

included

Class Method Details

.parse(string) ⇒ Hash

Parse a string and return the raw parslet tree.

Parameters:

  • string (String)

Returns:

  • (Hash)

Raises:

  • (ArgumentError)


92
93
94
95
96
# File 'lib/pubid/iala/parser.rb', line 92

def self.parse(string)
  raise ArgumentError, "IALA identifier string exceeds maximum length" if string.length > ::Pubid::MAX_INPUT_LENGTH

  new.parse(string.strip)
end