Enum Class Directive

java.lang.Object
java.lang.Enum<Directive>
mars.assembler.Directive
All Implemented Interfaces:
Serializable, Comparable<Directive>, Constable

public enum Directive extends Enum<Directive>
Class representing MIPS assembler directives. The directive name is indicative of the directive it represents. For example, DATA represents the MIPS .data directive.
Author:
Pete Sanderson, August 2003
  • Enum Constant Details

    • DATA

      public static final Directive DATA
    • TEXT

      public static final Directive TEXT
    • KDATA

      public static final Directive KDATA
    • KTEXT

      public static final Directive KTEXT
    • BYTE

      public static final Directive BYTE
    • HALF

      public static final Directive HALF
    • WORD

      public static final Directive WORD
    • FLOAT

      public static final Directive FLOAT
    • DOUBLE

      public static final Directive DOUBLE
    • ASCII

      public static final Directive ASCII
    • ASCIIZ

      public static final Directive ASCIIZ
    • SPACE

      public static final Directive SPACE
    • ALIGN

      public static final Directive ALIGN
    • EXTERN

      public static final Directive EXTERN
    • GLOBL

      public static final Directive GLOBL
    • EQV

      public static final Directive EQV
      Added by DPS on 11 July 2012.
    • MACRO

      public static final Directive MACRO
      Added by Mohammad Sekhavat in Oct 2012.
    • END_MACRO

      public static final Directive END_MACRO
      Added by Mohammad Sekhavat in Oct 2012.
    • INCLUDE

      public static final Directive INCLUDE
      Added by DPS on 11 Jan 2013.
    • SET

      public static final Directive SET
  • Field Details

  • Method Details

    • values

      public static Directive[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Directive valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromName

      public static Directive fromName(String name)
      Find the directive which corresponds to the given name, if one exists.
      Parameters:
      name - The directive name to search for, e.g. .word. The leading period is included.
      Returns:
      The matching directive, or null if not found.
    • matchNamePrefix

      public static List<Directive> matchNamePrefix(String prefix)
      Find the directives, if any, which start with the given prefix. For example, the prefix .a would match .ascii, .asciiz, and .align.
      Parameters:
      prefix - The prefix to match.
      Returns:
      List of matching directives, which may be empty if none match.
    • getName

      public String getName()
      Get the literal name of this directive, including the leading period.
      Returns:
      The name of this directive in string form, e.g. .word.
    • getDescription

      public String getDescription()
      Get description of this directive (for help purposes).
      Returns:
      Description of this MIPS directive.
    • allowsContinuation

      public boolean allowsContinuation()
      Determine whether this directive accepts a list of values which can continue onto the next line(s). This is primarily used by the SyntaxParser to only check for more tokens on the next line if the directive allows it.
      Returns:
      true if the directive's content may continue onto the next line, or false otherwise.
    • process

      public void process(DirectiveSyntax syntax, Assembler assembler)
      Parse and execute this directive using the given directive syntax and assembler. Any errors that occur during this process are added to the assembler log.
      Parameters:
      syntax - The syntax applied to this directive in the source code.
      assembler - The assembler whose state should be updated by this directive if needed.
      See Also:
    • toString

      public String toString()
      Obtain the string representation of this directive. This method is equivalent to getName().
      Overrides:
      toString in class Enum<Directive>
      Returns:
      The name of this directive in string form, e.g. .word.