metanorma / pubid-iso

Implementation of ISO pubid
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Fails to parse ""ISO/IEC DIR 2 ISO" #238

Closed andrew2net closed 11 months ago

andrew2net commented 1 year ago
$ Pubid::Iso::Identifier.parse "ISO/IEC DIR 2 ISO"
Failed to match sequence (stage:'Fpr'? 'WD/'? (type:GUIDE_PREFIX SPACE)? (stage:STAGE SPACE)? (stage:TYPED_STAGE SPACE)? (ORIGINATOR (SPACE / '/'))? (TC_DOCUMENT_BODY / STD_DOCUMENT_BODY / DIR_DOCUMENT_BODY (' + ' dir_joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?)) at line 1 char 9.
cause: Failed to match sequence (stage:'Fpr'? 'WD/'? (type:GUIDE_PREFIX SPACE)? (stage:STAGE SPACE)? (stage:TYPED_STAGE SPACE)? (ORIGINATOR (SPACE / '/'))? (TC_DOCUMENT_BODY / STD_DOCUMENT_BODY / DIR_DOCUMENT_BODY (' + ' dir_joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?)) at line 1 char 9.
`- Expected one of [TC_DOCUMENT_BODY, STD_DOCUMENT_BODY, DIR_DOCUMENT_BODY (' + ' dir_joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?] at line 1 char 9.
   |- Failed to match sequence ((tctype:TCTYPE '/'?){0, } SPACE tcnumber:DIGITS ('/' ((sctype:SCTYPE SPACE scnumber:DIGITS '/')? wgtype:WGTYPE SPACE wgnumber:DIGITS / sctype:SCTYPE (SPACE / '/' wgtype:WGTYPE SPACE) scnumber:DIGITS))? SPACE 'N' SPACE? number:DIGITS) at line 1 char 9.
   |  `- Expected " ", but got "D" at line 1 char 9.
   |- Failed to match sequence ((TYPE / stage:STAGE iteration:DIGITS?)? SPACE? ((stage:STAGE / stage:TYPED_STAGE / TYPE) SPACE)? number:DIGITS ('|' joint_document:(publisher:'IDF' SPACE number:DIGITS))? PART? ITERATION? (SPACE? (':' / DASH) YEAR)? SUPPLEMENT? EXTRACT? ADDENDUM? EDITION? LANGUAGE?) at line 1 char 14.
   |  `- Extra input after last repetition at line 1 char 14.
   |     `- Failed to match sequence ('(' language:(([a-z]{1, } ','? / ('E' / 'F' / 'A' / 'R') '/'?){0, }) ')') at line 1 char 14.
   |        `- Expected "(", but got " " at line 1 char 14.
   `- Failed to match sequence (DIR_DOCUMENT_BODY (' + ' dir_joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?) at line 1 char 14.
      `- Extra input after last repetition at line 1 char 14.
         `- Failed to match sequence (' + ' dir_joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY)) at line 1 char 14.
            `- Expected " + ", but got " IS" at line 1 char 14.

Blocks this https://github.com/relaton/relaton-iso/issues/153

ronaldtse commented 1 year ago

We need to fix this and also provide an error reporting message…

ronaldtse commented 1 year ago

@mico this one is urgent. Thanks!

mico commented 12 months ago

We need to fix this and also provide an error reporting message…

@ronaldtse Do you mean readable error message instead of "parsing error"?

ronaldtse commented 12 months ago

@mico yes, a more readable error message, that parsing failed without the rule details.

mico commented 11 months ago

Not only ISO/IEC DIR 2 ISO is missing, also we need to add to tests these identifiers:

Originally posted by @ronaldtse in https://github.com/relaton/relaton-iso/issues/153#issuecomment-1710079191