Interface NexusBlockParser

All Known Implementing Classes:
CharactersBlockParser, DataBlockParser, DistancesBlockParser, NexusBlockParser.Abstract, TaxaBlockParser, TreesBlockParser

public interface NexusBlockParser
Parses Nexus blocks. Each instance should parse tokens into events that can be fired at some kind of NexusBlockListener. An Abstract parser is provided from which all implementations should derive.
Since:
1.6
Author:
Richard Holland, Tobias Thierer, Jim Balhoff
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    All block parsers should derive from this abstract parser.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The name for an unknown block parser.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Opening a comment tag.
    void
    Receiving free text inside a comment tag.
    void
    Notifies the parser that a block is ending.
    void
    Closing a comment tag.
    void
    Closing a line (semi-colon encountered).
    Obtain the listener for this parser.
    void
    Notifies the parser of the next token.
    void
    startBlock(String blockName)
    Notifies the parser that a new block is starting.
    boolean
    Does the listener want to know about brackets and braces as separate tokens?
  • Field Details

  • Method Details

    • startBlock

      void startBlock(String blockName)
      Notifies the parser that a new block is starting.
      Parameters:
      blockName - the name of the block.
    • endBlock

      void endBlock()
      Notifies the parser that a block is ending.
    • parseToken

      void parseToken(String token) throws ParseException
      Notifies the parser of the next token. Comment tokens will already have been parsed out and sent separately to the text() method of the listener. Quoted strings will have been parsed and underscores converted. What this token contains is the full string, after removal of quotes if necessary. The token will never be only whitespace.
      Parameters:
      token - the token to parse.
      Throws:
      ParseException - if the token is unparseable.
    • beginComment

      void beginComment()
      Opening a comment tag.
    • endComment

      void endComment()
      Closing a comment tag.
    • endTokenGroup

      Closing a line (semi-colon encountered). This indicates that anything received after it is on the next logical line of the block.
    • commentText

      void commentText(String comment) throws ParseException
      Receiving free text inside a comment tag.
      Parameters:
      comment - the text of the comment.
      Throws:
      ParseException
    • getBlockListener

      Obtain the listener for this parser.
      Returns:
      the listener.
    • wantsBracketsAndBraces

      Does the listener want to know about brackets and braces as separate tokens?
      Returns:
      true if it does.