Package snap.parse

Class ParseHandler<T>

java.lang.Object
snap.parse.ParseHandler<T>
Direct Known Subclasses:
JSParser.ArrayHandler, JSParser.ObjectHandler, JSParser.PairHandler, JSParser.ValueHandler, KeyChainParser.ArgListHandler, KeyChainParser.BinaryExprHandler, KeyChainParser.ExpressionHandler, KeyChainParser.KeyChainHandler, KeyChainParser.ObjectHandler, KeyChainParser.StatementHandler, KeyChainParser.UnaryExprHandler, ParseRuleParser.AndExprHandler, ParseRuleParser.CountExprHandler, ParseRuleParser.ExpressionHandler, ParseRuleParser.OrExprHandler, ParseRuleParser.ParseRuleFileHandler, ParseRuleParser.ParseRuleHandler, XMLParser.AttributeHandler, XMLParser.DocumentHandler, XMLParser.ElementHandler, XMLParser.PrologHandler

public class ParseHandler<T> extends Object
A class called when child rules are parsed.
  • Field Details

    • _part

      protected T _part
    • _backupHandler

      protected ParseHandler<T> _backupHandler
  • Constructor Details

    • ParseHandler

      public ParseHandler()
  • Method Details

    • parsedOne

      protected void parsedOne(ParseNode aNode)
      Called when a child rule has been successfully parsed into given node.
    • parsedOne

      protected void parsedOne(ParseNode aNode, String anId)
      Called when a child rule has been successfully parsed into given node.
    • parsedAll

      public T parsedAll()
      Called when all child rules have been successfully parsed.
    • getPart

      public T getPart()
      Returns the part.
    • createPart

      protected T createPart()
      Creates the part.
    • getPartClass

      protected Class<T> getPartClass()
      Returns the part class.
    • getStartToken

      public ParseToken getStartToken()
      Returns the token where the current part started.
    • isFail

      public boolean isFail()
      Whether parsing should fail on current rule.
    • fail

      public void fail()
      Indicates that parsing should fail on current rule.
    • getAvailableHandler

      public ParseHandler<T> getAvailableHandler()
      Returns a handler that is not in use. This method should be synchronized, but that makes TeaVM unhappy.
    • getBackupHandler

      protected ParseHandler<T> getBackupHandler()
      Returns a backup handler.
    • createBackupHandler

      protected ParseHandler<T> createBackupHandler()
      Returns a backup handler.
    • reset

      public void reset()
      Resets the handler.