|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.makumba.analyser.engine.SyntaxPoint
public abstract class SyntaxPoint
Keeps track of important points in a file. Syntax points are typically stored in a sorted set, and used for syntax colouring. A syntax colourer would load the file, then go through the syntax points and change the coloring context at each syntax point. This is an abstract class, but can be easily instantiated with an anonymous inner class like this: SyntaxPoint comment=new SyntaxPoint(position) { public String getType(){ return "JSPcomment";}}; idea: the class can also find identifiers in the text and ask the owners of other enclosing syntax points (or the owner of the whole text info) if they can account for them. For example in the case of a makumba JSP, a LIST tag can account for a OQL label, an MDD field, a MDD name or a $attribute). If yes, syntax points are produced by the respective entity, and presented in different colours or as links idea: a syntax point walker that goes through a text and invokes methods of a syntax colourer like beginText(), beginJSPComment, endJspComment, beginTag... etc
Nested Class Summary | |
---|---|
static class |
SyntaxPoint.End
A simple implementation: ends of strings marked by other syntax points |
Field Summary | |
---|---|
(package private) boolean |
begin
Is this point a begin or an end of something (where applicable) |
(package private) int |
column
Redundant but useful data: column of the position in the text |
(package private) int |
line
Redundant but useful data: line of the position in the text |
(package private) int |
offset
The offset sufferred due to includes |
(package private) int |
position
The position in the file |
(package private) SourceSyntaxPoints |
sourceFile
The file in which this syntax point was detected |
Constructor Summary | |
---|---|
SyntaxPoint(int position)
Simpler constructor |
|
SyntaxPoint(int position,
boolean begin)
Default constructor |
Method Summary | |
---|---|
int |
compareTo(SyntaxPoint sp)
Compares two objects, for sorting in the syntaxPoints collection |
boolean |
equals(Object o)
Performs a simple comparison, for hashing reasons |
int |
getColumn()
Gets the column number in the file |
File |
getFile()
The file that contains this point |
int |
getIncludeOffset()
Gets the offset by which this SyntaxPoint has moved from the original position due to includes |
int |
getLine()
Gets the line number in the file |
int |
getOriginalColumn(int lineLength)
This is a temporary workaround for '@included' files not having their syntaxpoints & offsets detected correctly. |
int |
getOriginalPosition()
|
Object |
getOtherInfo()
Additional information which can be returned by subclasses |
int |
getPosition()
Gets the position in the file |
SourceSyntaxPoints |
getSourceSyntaxPoints()
|
abstract String |
getType()
The type of this point, will be defined by the subclass |
int |
hashCode()
Generates the hashcode of the SyntaxPoint |
boolean |
isBegin()
Checks whether this this point is the beginning of the end of something. |
static SyntaxPoint |
makeEnd(SyntaxPoint begin,
int position)
Makes an end for a given syntax point |
(package private) void |
moveByInclude(int delta)
Adjusts the offset and position at inclusion of a file |
String |
toString()
Prints the position and type of the SyntaxPoint, for debugging |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
int position
int offset
boolean begin
int line
int column
SourceSyntaxPoints sourceFile
Constructor Detail |
---|
public SyntaxPoint(int position, boolean begin)
position
- the position of this SyntaxPointbegin
- is this SyntaxPoint the beginningpublic SyntaxPoint(int position)
Method Detail |
---|
public int getPosition()
public int getIncludeOffset()
public int getOriginalPosition()
public int getLine()
public int getColumn()
public int getOriginalColumn(int lineLength)
lineLength
- the length of the line
public boolean isBegin()
true
if this is a beginning, false
otherwisepublic abstract String getType()
public Object getOtherInfo()
public File getFile()
public static SyntaxPoint makeEnd(SyntaxPoint begin, int position)
begin
- the begin SyntaxPointposition
- the position of the endvoid moveByInclude(int delta)
delta
- the length of the included filepublic int compareTo(SyntaxPoint sp)
compareTo
in interface Comparable<SyntaxPoint>
o
- object to be compared with
public boolean equals(Object o)
equals
in class Object
o
- the object to be compared with
true
if the two objects are equal, false
otherwisepublic int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public SourceSyntaxPoints getSourceSyntaxPoints()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |