Class AssemblyStringTerminal

  • All Implemented Interfaces:
    java.lang.Comparable<AssemblySymbol>

    public class AssemblyStringTerminal
    extends AssemblyTerminal
    A terminal that accepts only a particular string
    • Field Summary

      Fields 
      ChangeModifier and Type Field Description
      NEWprotected java.lang.String str  
    • Constructor Summary

      Constructors 
      ChangeConstructor Description
      AssemblyStringTerminal​(java.lang.String str)
      Construct a terminal that accepts only the given string
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      ChangeModifier and Type Method Description
      java.util.Collection<java.lang.String> getSuggestions​(java.lang.String got, java.util.Map<java.lang.String,​java.lang.Long> labels)
      Provide a collection of strings that this terminal would have accepted
      java.util.Collection<AssemblyParseToken> match​(java.lang.String buffer, int pos, AssemblyGrammar grammar, java.util.Map<java.lang.String,​java.lang.Long> labels)
      Attempt to match a token from the input buffer starting at a given position
      boolean takesOperandIndex()
      Check if this symbol consumes an operand index of its constructor
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • str NEW

        protected final java.lang.String str

Constructor Detail

  • Method Detail

    • match

      public java.util.Collection<AssemblyParseToken> match​(java.lang.String buffer,
                                                            int pos,
                                                            AssemblyGrammar grammar,
                                                            java.util.Map<java.lang.String,​java.lang.Long> labels)
      Description copied from class: AssemblyTerminal
      Attempt to match a token from the input buffer starting at a given position
      Specified by:
      match in class AssemblyTerminal
      Parameters:
      buffer - the input buffer
      pos - the cursor position in the buffer
      grammar - the grammar containing this terminal
      labels - the program labels, if applicable
      Returns:
      the matched token, or null
    • getSuggestions

      public java.util.Collection<java.lang.String> getSuggestions​(java.lang.String got,
                                                                   java.util.Map<java.lang.String,​java.lang.Long> labels)
      Description copied from class: AssemblyTerminal
      Provide a collection of strings that this terminal would have accepted
      Specified by:
      getSuggestions in class AssemblyTerminal
      Parameters:
      got - the remaining contents of the input buffer
      labels - the program labels, if applicable
      Returns:
      a, possibly empty, collection of suggestions
    • takesOperandIndex

      public boolean takesOperandIndex()
      Description copied from class: AssemblySymbol
      Check if this symbol consumes an operand index of its constructor
      Overrides:
      takesOperandIndex in class AssemblySymbol
      Returns:
      true if the symbol represents an operand