Class AssemblyStringMapTerminal

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.Integer> map  
    • Constructor Summary

      Constructors 
      Constructor Description
      AssemblyStringMapTerminal​(java.lang.String name, org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.Integer> map)
      Construct a terminal with the given name, accepting only the keys of a given map
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<java.lang.String> getSuggestions​(java.lang.String string, java.util.Map<java.lang.String,​java.lang.Long> labels)
      Provide a collection of strings that this terminal would have accepted
      java.util.Collection<AssemblyParseNumericToken> 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
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • map

        protected final org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.Integer> map
    • Constructor Detail

      • AssemblyStringMapTerminal

        public AssemblyStringMapTerminal​(java.lang.String name,
                                         org.apache.commons.collections4.MultiValuedMap<java.lang.String,​java.lang.Integer> map)
        Construct a terminal with the given name, accepting only the keys of a given map
        Parameters:
        name - the name
        map - the map from display text to token value
    • Method Detail

      • match

        public java.util.Collection<AssemblyParseNumericToken> 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 string,
                                                                     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:
        string - the remaining contents of the input buffer
        labels - the program labels, if applicable
        Returns:
        a, possibly empty, collection of suggestions