@faubulous/mentor-rdf-parsers
    Preparing search index...

    Interface ILexer

    A common interface for all lexers in the Mentor RDF Parsers library.

    interface ILexer {
        blankNodeIdGenerator?: BlankNodeIdGenerator;
        tokenize(text: string, initialMode?: string): ILexingResult;
    }

    Implemented by

    Index

    Properties

    blankNodeIdGenerator?: BlankNodeIdGenerator

    Optional blank node ID generator function. When set, the lexer will automatically assign blank node IDs to tokens that can generate blank nodes (LBRACKET, LPARENT, OPEN_ANNOTATION, TILDE). When undefined, blank node IDs will be automatically assigned using the default generator. Set to null to disable automatic blank node ID assignment.

    Methods

    • Tokenizes a string input according to the lexer's defined tokens and modes, returning an object containing the resulting tokens and any lexing errors. Note that this can be called repeatedly on different strings as this method does not modify the state of the Lexer.

      When blankNodeIdGenerator is set (or undefined for default), tokens that can generate blank nodes will have pre-assigned IDs stored in their payload.blankNodeId field.

      Parameters

      • text: string

        The string to lex

      • OptionalinitialMode: string

        The initial Lexer Mode to start with, by default this will be the first mode in the lexer's definition. If the lexer has no explicit modes it will be the implicit single 'default_mode' mode.

      Returns ILexingResult