Class: Pubid::Iso::Parser

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

Constant Summary collapse

DASH_CHARS =
["-", "", ""].freeze
SUPPLEMENT_TYPE_KEYS =

Supplement identifier type keys (kept as a hard-coded list to match the previous identifier split; only the base identifier registry is auto-discovered from the Identifiers namespace).

%i[amd cor suppl ext add].freeze
TYPED_STAGES =

We need to sort by length to match longest first because that’s how Parslet works

Pubid::Iso.identifier_types
.reject { |k| SUPPLEMENT_TYPE_KEYS.include?(k.type[:key]) }
.flat_map { |k| k.const_defined?(:TYPED_STAGES) ? k.const_get(:TYPED_STAGES) : [] }
.map(&:abbr).flatten.sort_by(&:length).reverse
TYPED_STAGES_SUPPLEMENTS =
Pubid::Iso.identifier_types
.select { |k| SUPPLEMENT_TYPE_KEYS.include?(k.type[:key]) }
.flat_map { |k| k.const_defined?(:TYPED_STAGES) ? k.const_get(:TYPED_STAGES) : [] }
.map(&:abbr).flatten.sort_by(&:length).reverse
ORGANIZATIONS =
%w[
  ISO IEC IEEE CIW SAE CIE ASME ASTM OECD ISO HL7 CEI UNDP
].freeze
EDITION_STRINGS =
%w[Edition Ed. ED Ed].freeze
DIRECTIVES_TYPED_STAGES =
Identifiers::Directives::TYPED_STAGES.map(&:abbr).flatten.sort_by(&:length).reverse
DIRECTIVES_SUPPLEMENTS_TYPED_STAGES =
Identifiers::DirectivesSupplement::TYPED_STAGES.map(&:abbr).flatten.sort_by(&:length).reverse

Method Summary

Methods included from Parser::CommonParseMethods

#array_to_str

Methods included from Parser::CommonParseRules

included