Package mars.assembler
Enum Class Directive
- All Implemented Interfaces:
Serializable
,Comparable<Directive>
,Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine whether this directive accepts a list of values which can continue onto the next line(s).static Directive
Find the directive which corresponds to the given name, if one exists.Get description of this directive (for help purposes).getName()
Get the literal name of this directive, including the leading period.matchNamePrefix
(String prefix) Find the directives, if any, which start with the given prefix.void
process
(DirectiveSyntax syntax, Assembler assembler) Parse and execute this directive using the given directive syntax and assembler.toString()
Obtain the string representation of this directive.static Directive
Returns the enum constant of this class with the specified name.static Directive[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DATA
-
TEXT
-
KDATA
-
KTEXT
-
BYTE
-
HALF
-
WORD
-
FLOAT
-
DOUBLE
-
ASCII
-
ASCIIZ
-
SPACE
-
ALIGN
-
EXTERN
-
GLOBL
-
EQV
Added by DPS on 11 July 2012. -
MACRO
Added by Mohammad Sekhavat in Oct 2012. -
END_MACRO
Added by Mohammad Sekhavat in Oct 2012. -
INCLUDE
Added by DPS on 11 Jan 2013. -
SET
-
-
Field Details
-
ALL_DIRECTIVES
-
ALL_DIRECTIVES_TRIE
-
-
Method Details
-
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
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 nameNullPointerException
- if the argument is null
-
fromName
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
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
Get the literal name of this directive, including the leading period.- Returns:
- The name of this directive in string form, e.g.
.word
.
-
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 theSyntaxParser
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, orfalse
otherwise.
-
process
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
Obtain the string representation of this directive. This method is equivalent togetName()
.
-