|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.plb4jedit.plb.SourceLine
Description: Represents a PLB-Source line, which is no comment.
Parses a line from a source and determines wether it is a label, a variable, an include or a command.
Gives access to these information and has some convenience methods to ask for the type of the line.
Also defines some Comparators to sort SourceLines according to there lineno or in alphabetic order of their
labels.
A source line is scanned via a regular expression, which uses the structure/format of the PLB instruction syntax,
which defines an instruction as something like
(LABEL) (KEYWORD) (REST)
where LABEL is of fix width (8 characters at RSI). Depending on the Type of the instruction LABEL can
be the name of an instruction label or lroutine or a variable name.
KEYWORD can be the type of a variable or a PLB command/keyword.
Depending on the Type of the line, the REST can be a comment, name of an include, parameters to an lroutine.
size of a variable, etc ... Be aware that for lines of Type INCLUDE only the first word of REST is taken where
for other Types REST may need further parsing, because it can also contain comments or anything else.
Notice that only a single Line is parsed, so e.g. for a routine which parameters a splitted over more than one
line, not all parameter may be recognized. TODO: normalize PLB-Sources so that all line splits (by :) are
resolved.
Field Summary | |
static String |
cvsId
|
static Comparator |
LABEL_ORDERED
|
static Comparator |
LINE_NUMBER_ORDERED
|
static Comparator |
REST_ORDERED
|
Constructor Summary | |
SourceLine(String line,
int lineNumber)
Constructs a SourceLine for a given line and it position of occurence in a file. |
|
SourceLine(String line,
int lineNumber,
List records)
Constructs a SourceLine for a given line and it position of occurence in a file being nested inside record definitions. |
Method Summary | |
int |
compareTo(Object obj)
|
String |
getKeyword()
gets keyword of the line. |
String |
getLabel()
gets the label of the line, see class documentation. |
String |
getLine()
|
int |
getLineNumber()
|
String |
getRest()
gets rest of the line. |
net.sf.plb4jedit.plb.Type |
getType()
gets the Type of the line, which indicates if the line is a comment, a variable definition, an execution label or a command. |
boolean |
isDimDef()
|
boolean |
isFormDef()
|
boolean |
isInclude()
|
boolean |
isLabel()
|
boolean |
isLroutine()
|
boolean |
isRecordDef()
NOTE: records defined via like and record arrays are currently not supported |
boolean |
isRecordEnd()
|
boolean |
isVarDef()
|
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String cvsId
public static final Comparator LINE_NUMBER_ORDERED
public static final Comparator LABEL_ORDERED
public static final Comparator REST_ORDERED
Constructor Detail |
public SourceLine(String line, int lineNumber, List records)
line
- one line of a Source filelineNumber
- where the line appears in the source file.records
- a list of records where this line is nested inpublic SourceLine(String line, int lineNumber)
line
- one line of a Source filelineNumber
- where the line appears in the source file.Method Detail |
public boolean isLabel()
public String getLabel()
public String getLine()
public int getLineNumber()
public String getKeyword()
public String getRest()
public net.sf.plb4jedit.plb.Type getType()
public boolean isDimDef()
public boolean isFormDef()
public boolean isRecordDef()
public boolean isRecordEnd()
public boolean isLroutine()
public boolean isInclude()
public boolean isVarDef()
public String toString()
public int compareTo(Object obj)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |