Class ContextStack


  • public class ContextStack
    extends java.lang.Object
    ContextStack provides a mechanism to record parsing state.
    • Constructor Detail

    • Method Detail

      • anyErrors

        public boolean anyErrors()
        Return true if env.nerrors > 0.
      • setTrace

        public void setTrace​(boolean trace)
        Enable/disable tracing.
      • isTraceOn

        public boolean isTraceOn()
        Check trace flag.
      • setNewContextCode

        public void setNewContextCode​(int code)
        Set the new context.
      • getCurrentContextCode

        public int getCurrentContextCode()
        Get the current context code.
      • traceCallStack

        final void traceCallStack()
        If tracing on, write the current call stack (not the context stack) to System.out.
      • dumpCallStack

        public static final void dumpCallStack()
      • tracePrint

        private final void tracePrint​(java.lang.String text,
                                      boolean line)
        Print a line indented by stack depth.
      • trace

        final void trace​(java.lang.String text)
        If tracing on, print a line.
      • traceln

        final void traceln​(java.lang.String text)
        If tracing on, print a line followed by a '\n'.
      • traceExistingType

        final void traceExistingType​(Type type)
        If tracing on, print a pre-mapped ContextElement.
      • pop

        public TypeContext pop​(boolean wasValid)
        Pop an element from the stack.
        Returns:
        the new current element or null if top.
      • size

        public int size()
        Get the current size.
      • getContext

        public TypeContext getContext​(int index)
        Get a specific context.
      • getContext

        public TypeContext getContext()
        Get the current top context.
      • isParentAValue

        public boolean isParentAValue()
        Is parent context a value type?
      • getParentContext

        public TypeContext getParentContext()
        Get parent context. Null if none.
      • getContextCodeString

        public java.lang.String getContextCodeString()
        Get a string for the context name...
      • getContextCodeString

        public static java.lang.String getContextCodeString​(int contextCode)
        Get a string for the given context code...
      • toTrialString

        private java.lang.String toTrialString​(TypeContext it)
      • toResultString

        private java.lang.String toResultString​(TypeContext it,
                                                boolean result,
                                                boolean preExisting)
      • clear

        public void clear()