|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.aptana.ide.lexer.AbstractLexer
public abstract class AbstractLexer
| Field Summary | |
|---|---|
protected int |
currentOffset
Current offset within the source code where the next match will begin |
protected int |
lastMatchedTokenIndex
The token index of the last match. |
| Constructor Summary | |
|---|---|
AbstractLexer()
Create a new instance of Lexer |
|
| Method Summary | |
|---|---|
void |
addLanguage(ITokenList tokens)
Add the given language tokens to this lexer |
protected Lexeme |
createLexeme(IToken token,
java.lang.String text,
int offset)
Create a new lexeme. |
abstract Range |
find(java.lang.String groupName)
Use the currently active language and group to locate the first position that matches that group. |
protected Lexeme |
getCachedLexeme()
getCachedLexeme |
abstract char |
getCharacterAt(int offset)
Return the character at the given offset |
int |
getCurrentOffset()
Return the current offset within the source text where the next token will be matched |
ITokenList |
getCurrentTokenList()
Get the token list that is currently active in this lexer |
int |
getEOFOffset()
Returns the offset that is considered as the EOF |
java.lang.String |
getGroup()
Returns the name of the group that is current active |
java.lang.String |
getLanguage()
Get the language type this lexer is targeting |
java.lang.String[] |
getLanguages()
Get all languages that are contained in this Lexer |
Lexeme |
getNextLexeme()
Get the next token from the source text |
abstract java.lang.String |
getSource()
Get the text being processed by this lexer |
protected abstract char[] |
getSourceCharacters()
Get the character array for the current source |
abstract int |
getSourceLength()
Return the number of characters in this lexer's source code |
ITokenList |
getTokenList(java.lang.String language)
Get the token list for the specified language |
boolean |
isEOS()
Determine if we've processed all the source text |
protected abstract int |
match()
match |
void |
seal()
Build all of the token regexes and build the lexer group state machines |
void |
setCurrentOffset(int offset)
Set the current offset within the source text where the next token will be matched |
void |
setEOFOffset(int offset)
Set the offset that is considered the end of the input stream. |
void |
setGroup(java.lang.String groupName)
Set the currently active lexer group |
void |
setIgnoreSet(java.lang.String language,
int[] set)
Set the list of Token types to skip when scanning the source text |
void |
setLanguage(java.lang.String language)
Set the language name this lexer targets |
void |
setLanguageAndGroup(java.lang.String language,
java.lang.String group)
Set the current language and the group within that language |
void |
setLexemeCache(LexemeList lexemeCache)
Set the lexeme cache |
void |
setLexerState(java.lang.String group,
char[] source,
int offset,
LexemeList cache)
Set properties of the lexer to prepare for rescanning of modified source |
void |
setLexerState(java.lang.String group,
int offset)
Set properties of the lexer to prepare for rescanning of unmodified source |
abstract void |
setSource(char[] value)
Set the text to be processed by this lexer |
void |
setSource(java.lang.String value)
Set the text to be processed by this lexer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.aptana.ide.lexer.ILexer |
|---|
getSourceUnsafe |
| Field Detail |
|---|
protected int lastMatchedTokenIndex
protected int currentOffset
| Constructor Detail |
|---|
public AbstractLexer()
| Method Detail |
|---|
public void setLexemeCache(LexemeList lexemeCache)
ILexer
setLexemeCache in interface ILexerlexemeCache - The list of previously scanned lexemesILexer.setLexemeCache(com.aptana.ide.lexer.LexemeList)protected Lexeme getCachedLexeme()
public abstract char getCharacterAt(int offset)
ILexer
getCharacterAt in interface ILexeroffset - The offset within the source
ILexer.getCharacterAt(int)public int getCurrentOffset()
ILexer
getCurrentOffset in interface ILexerILexer.getCurrentOffset()public ITokenList getCurrentTokenList()
ILexer
getCurrentTokenList in interface ILexerILexer.getCurrentTokenList()public void setCurrentOffset(int offset)
ILexer
setCurrentOffset in interface ILexeroffset - The new offset valueILexer.setCurrentOffset(int)public int getEOFOffset()
ILexer
getEOFOffset in interface ILexerILexer.getEOFOffset()public void setEOFOffset(int offset)
ILexer
setEOFOffset in interface ILexeroffset - The new EOF offset for the current stream of text being processed by this lexerILexer.setEOFOffset(int)public java.lang.String getGroup()
ILexer
getGroup in interface ILexerILexer.getGroup()
public void setGroup(java.lang.String groupName)
throws LexerException
ILexer
setGroup in interface ILexergroupName - The name of the group to activate
LexerExceptionILexer.setGroup(java.lang.String)
public void setIgnoreSet(java.lang.String language,
int[] set)
ILexer
setIgnoreSet in interface ILexerlanguage - The target language to apply this ignore setset - The set of token type to skipILexer.setIgnoreSet(java.lang.String, int[])public java.lang.String getLanguage()
ILexer
getLanguage in interface ILexerILexer.getLanguage()public java.lang.String[] getLanguages()
ILexer
getLanguages in interface ILexerILexer.getLanguages()
public void setLanguage(java.lang.String language)
throws LexerException
ILexer
setLanguage in interface ILexerlanguage - The language this lexer will target
LexerExceptionILexer.setLanguage(java.lang.String)
public void setLanguageAndGroup(java.lang.String language,
java.lang.String group)
throws LexerException
ILexer
setLanguageAndGroup in interface ILexerlanguage - The new languagegroup - The group within the language
LexerExceptionILexer.setLanguageAndGroup(java.lang.String, java.lang.String)public abstract java.lang.String getSource()
ILexer
getSource in interface ILexerILexer.getSource()protected abstract char[] getSourceCharacters()
public abstract int getSourceLength()
ILexer
getSourceLength in interface ILexerILexer.getSourceLength()public abstract void setSource(char[] value)
ILexer
setSource in interface ILexervalue - The new source textILexer.setSource(char[])public void setSource(java.lang.String value)
ILexer
setSource in interface ILexervalue - The new source textILexer.setSource(java.lang.String)public ITokenList getTokenList(java.lang.String language)
ILexer
getTokenList in interface ILexerILexer.getTokenList(java.lang.String)public boolean isEOS()
ILexer
isEOS in interface ILexerILexer.isEOS()public void addLanguage(ITokenList tokens)
ILexer
addLanguage in interface ILexerILexer.addLanguage(com.aptana.ide.lexer.ITokenList)
public void seal()
throws LexerException
ILexer
seal in interface ILexerLexerExceptionILexer.seal()
protected Lexeme createLexeme(IToken token,
java.lang.String text,
int offset)
token - The token class for this lexemetext - The token's associated textoffset - The token's offset within the source file
public abstract Range find(java.lang.String groupName)
throws LexerException
ILexer
find in interface ILexergroupName - The current language's group name that contains the patterns to find
LexerExceptionILexer.find(java.lang.String)protected abstract int match()
public void setLexerState(java.lang.String group,
int offset)
throws LexerException
ILexer
setLexerState in interface ILexergroup - The group to switch to before beginning the rescanoffset - The offset within the source where to begin rescanning
LexerExceptionILexer.setLexerState(java.lang.String, int)
public void setLexerState(java.lang.String group,
char[] source,
int offset,
LexemeList cache)
throws LexerException
ILexer
setLexerState in interface ILexergroup - The group to switch to before beginning the next lexsource - The new source code to lexoffset - The offset within the source where to begin re-lexingcache - The lexeme cache from the last lex
LexerExceptionILexer.setLexerState(java.lang.String, char[], int, com.aptana.ide.lexer.LexemeList)public Lexeme getNextLexeme()
ILexer
getNextLexeme in interface ILexerILexer.getNextLexeme()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||