Package sc.parser

Class SemanticContext

  • Direct Known Subclasses:
    TagStackSemanticContext

    public abstract class SemanticContext
    extends java.lang.Object
    The semantic context is a hook used for when the generated parse-tree requires additional contextual information to be work (e.g. HTML with it's stack of tag names). You can subclass this class and manage whatever state you want in the 'accept' methods of a grammar's parselets. You must record the range of where your information is relevant though and deal with the parser's need to go back and forward - which means undoing and redoing the semantic context's fields.
    • Constructor Summary

      Constructors 
      Constructor Description
      SemanticContext()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract java.lang.Object resetToIndex​(int ix)  
      abstract void restoreToIndex​(int ix, java.lang.Object resetReturnValue)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SemanticContext

        public SemanticContext()
    • Method Detail

      • resetToIndex

        public abstract java.lang.Object resetToIndex​(int ix)
      • restoreToIndex

        public abstract void restoreToIndex​(int ix,
                                            java.lang.Object resetReturnValue)