Colibrio Reader Framework API - Cloud license
    Preparing search index...

    A 100% spec. compliant EPUB CFI parser that also performs validation and error reporting. The parser is forgiving, trying to build a valid AST (Abstract Syntax Tree) from an EPUB CFI string, recovering from many types of errors.

    The string is first processed by EpubCfiLexer which delivers a stream of tokens which is then consumed by this parser.

    Usage: let epubCfiAst = EpubCfiParser.parse("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/1:3[xx,y])");

    Implements

    Constructors

    • Creates a new instance using the specified epubCfiStr as source string. Note: epubCfiStr must not contain a leading '#' character. For example:

      new EpubCfiParser("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/1:3[xx,y])")
      

      Parameters

      • epubCfiStr: string

      Returns EpubCfiParser

    Methods

    • The "entry point" for starting parsing an epubcfi from the lexer. Expects the lexer to start with an 'epucfi(' token followed by a non-empty main path. The main path can optionally be followed by a rangeStart and a rangeEnd path.

      Returns IEpubCfiRootNode

    • Checks if the specified string could be an EPUB CFI.

      Parameters

      • src: string

      Returns boolean

    • Parses an EPUB CFI string. Example:

      let epubCfiAst = EpubCfiParser.parse("epubcfi(/6/4[chap01ref]!/4[body01]/10[para05]/1:3[xx,y])");
      

      Parameters

      • epubCfi: string

      Returns IEpubCfiRootNode