Class RpclCondensedProbabilityDistributionParserTokenManager

java.lang.Object
org.tweetyproject.logics.rpcl.parser.rpclcondensedprobabilitydistributionparser.RpclCondensedProbabilityDistributionParserTokenManager
All Implemented Interfaces:
RpclCondensedProbabilityDistributionParserConstants

public class RpclCondensedProbabilityDistributionParserTokenManager extends Object implements RpclCondensedProbabilityDistributionParserConstants
Token Manager.
  • Field Details

    • debugStream

      public static PrintStream debugStream
      Debug output.
    • jjstrLiteralImages

      public static final String[] jjstrLiteralImages
      Token literal values.
    • lexStateNames

      public static final String[] lexStateNames
      Lexer state names.
  • Constructor Details

    • RpclCondensedProbabilityDistributionParserTokenManager

      public RpclCondensedProbabilityDistributionParserTokenManager(SimpleCharStream stream)
      Constructs a new RpclCondensedProbabilityDistributionParserTokenManager with the given input stream.
      Parameters:
      stream - The SimpleCharStream that provides the input for the token manager.
      Throws:
      TokenMgrError - If the constructor is called more than once (i.e., the input stream is not null).
    • RpclCondensedProbabilityDistributionParserTokenManager

      public RpclCondensedProbabilityDistributionParserTokenManager(SimpleCharStream stream, int lexState)
      Constructs a new RpclCondensedProbabilityDistributionParserTokenManager with the given input stream and lexical state.
      Parameters:
      stream - The SimpleCharStream that provides the input for the token manager.
      lexState - The initial lexical state to which the token manager will switch.
      Throws:
      TokenMgrError - If the primary constructor throws an error due to reinitialization.
  • Method Details

    • setDebugStream

      public static void setDebugStream(PrintStream ds)
      Sets the debug stream for the parser.

      This method allows the user to specify a PrintStream that will be used to output debug information during the parsing process. By default, this stream might be set to System.out or System.err, but this method allows redirecting it to any other stream, such as a file stream or a custom logging stream.

      Parameters:
      ds - The PrintStream to be used for debug output. This can be any valid PrintStream, such as System.out or System.err.
    • ReInit

      public static void ReInit(SimpleCharStream stream)
      Reinitializes the parser with a new input stream.

      This method resets the internal state of the parser and prepares it to parse a new input stream. It sets the initial values for matched positions, state counters, and the current lexical state. After reinitializing, it also resets the round counters used for parsing.

      Parameters:
      stream - The new SimpleCharStream to be parsed. This stream provides the characters for token generation.
    • ReInit

      public static void ReInit(SimpleCharStream stream, int lexState)
      Reinitializes the parser with a new input stream and switches to the specified lexical state.

      This method reinitializes the parser with a new input stream, as well as allowing for a specific lexical state to be set. It first calls the ReInit(SimpleCharStream) method to reset the parser's state with the provided stream, and then switches the parser to the given lexical state using SwitchTo(int).

      Parameters:
      stream - The new SimpleCharStream to be parsed. This stream provides the characters for token generation.
      lexState - The lexical state to switch to after reinitialization. The lexical state determines how the input is tokenized.
    • SwitchTo

      public static void SwitchTo(int lexState)
      Switches the parser to the specified lexical state.

      This method allows the parser to change its lexical state, which affects how the input stream is tokenized. The lexical state defines the set of tokens that the parser recognizes at any given time. The method ensures that the lexical state provided is valid, otherwise, it throws a TokenMgrError with an appropriate error message.

      The valid lexical state range is between 0 (inclusive) and 1 (exclusive). If an invalid lexical state is provided (i.e., a state outside this range), the method throws an error and leaves the current lexical state unchanged.

      Parameters:
      lexState - The lexical state to switch to. Must be between 0 (inclusive) and 1 (exclusive).
      Throws:
      TokenMgrError - if the specified lexical state is invalid (i.e., not within the range [0,1)).
    • getNextToken

      public static Token getNextToken()
      Get the next Token.
      Returns:
      the token