|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.text.rules.RuleBasedScanner
A generic scanner which can be "programmed" with a sequence of rules.
The scanner is used to get the next token by evaluating its rule in sequence until
one is successful. If a rule returns a token which is undefined, the scanner will proceed to
the next rule. Otherwise the token provided by the rule will be returned by
the scanner. If no rule returned a defined token, this scanner returns a token
which returns true
when calling isOther
, unless the end
of the file is reached. In this case the token returns true
when calling
isEOF
.
IRule
Field Summary | |
protected int |
fColumn
|
protected IToken |
fDefaultReturnToken
|
protected char[][] |
fDelimiters
|
protected IDocument |
fDocument
|
protected int |
fOffset
|
protected int |
fRangeEnd
|
protected IRule[] |
fRules
|
protected int |
fTokenOffset
|
protected static int |
UNDEFINED
|
Fields inherited from interface org.eclipse.jface.text.rules.ICharacterScanner |
EOF |
Constructor Summary | |
RuleBasedScanner()
Creates a new rule based scanner which does not have any rule. |
Method Summary | |
int |
getColumn()
Returns the column of the character scanner. |
char[][] |
getLegalLineDelimiters()
Provides rules access to the legal line delimiters. |
int |
getTokenLength()
Returns the length of the last token read by this scanner. |
int |
getTokenOffset()
Returns the offset of the last token read by this scanner. |
IToken |
nextToken()
Returns the next token in the document. |
int |
read()
Returns the next character or EOF if end of file has been reached |
void |
setDefaultReturnToken(IToken defaultReturnToken)
Configures the scanner's default return token. |
void |
setRange(IDocument document,
int offset,
int length)
Configures the scanner by providing access to the document range that should be scanned. |
void |
setRules(IRule[] rules)
Configures the scanner with the given sequence of rules. |
void |
unread()
Rewinds the scanner before the last read character. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected IRule[] fRules
protected IToken fDefaultReturnToken
protected IDocument fDocument
protected char[][] fDelimiters
protected int fOffset
protected int fRangeEnd
protected int fTokenOffset
protected int fColumn
protected static final int UNDEFINED
Constructor Detail |
public RuleBasedScanner()
Method Detail |
public void setRules(IRule[] rules)
rules
- the sequence of rules controlling this scannerpublic void setDefaultReturnToken(IToken defaultReturnToken)
public void setRange(IDocument document, int offset, int length)
ITokenScanner
setRange
in interface ITokenScanner
document
- the document to scanoffset
- the offset of the document range to scanlength
- the length of the document range to scanpublic int getTokenOffset()
ITokenScanner
getTokenOffset
in interface ITokenScanner
public int getTokenLength()
ITokenScanner
getTokenLength
in interface ITokenScanner
public int getColumn()
ICharacterScanner
getColumn
in interface ICharacterScanner
public char[][] getLegalLineDelimiters()
ICharacterScanner
getLegalLineDelimiters
in interface ICharacterScanner
public IToken nextToken()
ITokenScanner
nextToken
in interface ITokenScanner
public int read()
ICharacterScanner
read
in interface ICharacterScanner
public void unread()
ICharacterScanner
unread
in interface ICharacterScanner
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |