[Exspiminator-commits] CVS: exspiminator/base AssemblerException.java,1.2,1.3 AssemblyLine.java,1.2,
Status: Alpha
Brought to you by:
nphillips
|
From: Nigel P. <nph...@us...> - 2001-11-22 17:39:19
|
Update of /cvsroot/exspiminator/exspiminator/base
In directory usw-pr-cvs1:/tmp/cvs-serv22474/base
Modified Files:
AssemblerException.java AssemblyLine.java Line.java
Parser.java
Log Message:
General tidy-up: access modifiers, javadocs etc.
Index: AssemblerException.java
===================================================================
RCS file: /cvsroot/exspiminator/exspiminator/base/AssemblerException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** AssemblerException.java 2001/11/19 16:17:49 1.2
--- AssemblerException.java 2001/11/22 17:39:16 1.3
***************
*** 1,5 ****
package exspiminator.base;
! /** Make this a superclass of OperandFormatException.*/
public class AssemblerException extends Exception
{
--- 1,5 ----
package exspiminator.base;
! /** The general type of exceptions that can be thrown by the assembler.*/
public class AssemblerException extends Exception
{
Index: AssemblyLine.java
===================================================================
RCS file: /cvsroot/exspiminator/exspiminator/base/AssemblyLine.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** AssemblyLine.java 2001/11/19 16:17:49 1.2
--- AssemblyLine.java 2001/11/22 17:39:16 1.3
***************
*** 2,11 ****
/** An encapsulation of a line of Assembly source and an address into which the assembled opcode is to be
! placed. Used for deferred assembly of forward references (and can be used for assembling single lines
! in the GUI?).*/
public class AssemblyLine
{
public Line line;
public int lineNum;
public int address;
--- 2,14 ----
/** An encapsulation of a line of Assembly source and an address into which the assembled opcode is to be
! placed. Used for deferred assembly of forward references. Could also used for assembling single lines
! in the GUI?.*/
public class AssemblyLine
{
+ /** The source to be assembled.*/
public Line line;
+ /** The number of line in the source text. Used so that we can report errors with the appropriate line number.*/
public int lineNum;
+ /** The address at which to assemble the Line.*/
public int address;
Index: Line.java
===================================================================
RCS file: /cvsroot/exspiminator/exspiminator/base/Line.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Line.java 2001/11/19 16:17:49 1.2
--- Line.java 2001/11/22 17:39:16 1.3
***************
*** 3,7 ****
import java.util.*;
! /** Note the various data elements will be null (and not empty) for Lines that don't contain them.*/
public class Line
{
--- 3,8 ----
import java.util.*;
! /** A line of assembly language source text, split into its various components.
! Note the various data elements will be null (and not empty) for Lines that don't contain them.*/
public class Line
{
***************
*** 19,22 ****
--- 20,24 ----
}
+ /** This returns the first non label component, such as a mnemonic or assembler directive.*/
public String getMnemonic()
{
Index: Parser.java
===================================================================
RCS file: /cvsroot/exspiminator/exspiminator/base/Parser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Parser.java 2001/11/21 11:39:50 1.4
--- Parser.java 2001/11/22 17:39:16 1.5
***************
*** 3,18 ****
import java.io.*;
! /** Note: handles 4(r3) etc as one operand, this will need recoding in InstructionSet? (also instructionEncoder).*/
! class Parser
{
! //String data;
! /** The index of the next character in the data string to be handled.*/
! //int index;
! String whitespace, commentMarkers, operandSeparators;
! StringBuffer lineBuffer;
! StringBuffer tokenBuffer;
! BufferedReader reader;
!
! Parser(String text, String whites, String comments, String separators)
{
reader=new BufferedReader(new StringReader(text));
--- 3,23 ----
import java.io.*;
! /** The function of this class is to produces a series of <code>Line</code>s from a source text.
! BUG: currently, whitespace is taken as delimiting operands, but comma is the real operand serarator!
! This will have to be fixed before we can have assemble-time arithmetic.
! BUG: Quotes strings are not recognized. We need to handle quotes properly, for the .string directive,
! including the case where the it contains commas, and white space etc.
!
! @see Line*/
! public class Parser
{
! protected String whitespace, commentMarkers, operandSeparators;
! protected StringBuffer lineBuffer;
! protected StringBuffer tokenBuffer;
! protected BufferedReader reader;
!
! /** Creates a parser ready to parse the given text with the given options.
! @param text The source text which is to be parsed.*/
! public Parser(String text, String whites, String comments, String separators)
{
reader=new BufferedReader(new StringReader(text));
***************
*** 24,37 ****
tokenBuffer=new StringBuffer();
}
-
! /** BUG: how to handle commas, spaces (and other whitespace) within operands (as delimited by commas) etc etc
! Currently operands are whitespace delimited, the aim was to have them comma deliminted at some point.*/
! Parser(String text)
{
this(text, " \t\r\f)", ";#", " \t\r\f),(");
}
! boolean isLabel(String s)
{
//System.err.println(s + " is a label? :" + s.endsWith(":"));
--- 29,39 ----
tokenBuffer=new StringBuffer();
}
! public Parser(String text)
{
this(text, " \t\r\f)", ";#", " \t\r\f),(");
}
! protected boolean isLabel(String s)
{
//System.err.println(s + " is a label? :" + s.endsWith(":"));
***************
*** 39,43 ****
}
! String stripLabelMarker(String token)
{
return token.substring(0, token.length()-1);
--- 41,45 ----
}
! protected String stripLabelMarker(String token)
{
return token.substring(0, token.length()-1);
***************
*** 85,89 ****
@return False iff the string has already been read completely (and thus <code>to</code> contains
garbage).*/
! boolean readLine(StringBuffer to) throws IOException
{
boolean done=false;
--- 87,91 ----
@return False iff the string has already been read completely (and thus <code>to</code> contains
garbage).*/
! protected boolean readLine(StringBuffer to) throws IOException
{
boolean done=false;
***************
*** 107,111 ****
@param delimeters A String any character of which would mark the end of a token.
@return The token, or null if none in the buffer.*/
! String getNextToken(StringBuffer buffy, String delimeters)
{
tokenBuffer.setLength(0);
--- 109,113 ----
@param delimeters A String any character of which would mark the end of a token.
@return The token, or null if none in the buffer.*/
! protected String getNextToken(StringBuffer buffy, String delimeters)
{
tokenBuffer.setLength(0);
***************
*** 137,145 ****
}
! /** Removes any comment from the line contained in the given StringBuffer.
Note the relationship between this and getNextToken - it handles everything <em>before</em> a
delimeter, this handles everthing <em>after</em> one.
@return The comment, or null if none.*/
! static String getComment(StringBuffer buffy, String delimeters)
{
String result=null;
--- 139,148 ----
}
! /** Removes any comment from the line contained in the given StringBuffer, and returns it (minus the comment
! marker) in the given StringBuffer.
Note the relationship between this and getNextToken - it handles everything <em>before</em> a
delimeter, this handles everthing <em>after</em> one.
@return The comment, or null if none.*/
! protected static String getComment(StringBuffer buffy, String delimeters)
{
String result=null;
|