Interface ParserFactory.Locator<D,T>

Type Parameters:
D - the type of source document identifiers
T - the type of token types; typically an enum type
Enclosing class:
ParserFactory

public static interface ParserFactory.Locator<D,T>
Interface for location tracking service.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves recorded location information after tracked parsing.
    List<Fragment<?,?,?>>
    getScope(Fragment<?,?,?>... args)
    Returns a list of fragments for scoping that includes location tracking for this locator.
    track(Parser<D,T> parser)
    Adds start and end location tracking to a given parser.
  • Method Details

    • track

      Parser<D,T> track(Parser<D,T> parser)
      Adds start and end location tracking to a given parser.
      Parameters:
      parser - the parser to extend
      Returns:
      a parser that behaves equivalently to body, but additionally records the start and end locations of its consumed input for later retrieval
      Throws:
      NullPointerException - if parser is null
      See Also:
    • getLocation

      Location<D> getLocation(State state)
      Retrieves recorded location information after tracked parsing.

      Behavior is unspecified if the given semantic state does not result from a tracking parser.

      Parameters:
      state - a semantic state after parsing
      Returns:
      an interval location spanning the consumed input
      Throws:
      NullPointerException - if state is null
      See Also:
    • getScope

      List<Fragment<?,?,?>> getScope(Fragment<?,?,?>... args)
      Returns a list of fragments for scoping that includes location tracking for this locator.
      Parameters:
      args - the fragments to scope in addition to location tracking
      Returns:
      a list of fragments that includes args and location tracking for this locator
      Throws:
      NullPointerException - if args is or contains null