com.intellij.lexer
Class EmptyLexer

java.lang.Object
  extended by com.intellij.lexer.LexerBase
      extended by com.intellij.lexer.EmptyLexer
All Implemented Interfaces:
Lexer

public class EmptyLexer
extends LexerBase


Constructor Summary
EmptyLexer()
           
 
Method Summary
 void advance()
          Advances the lexer to the next token.
 char[] getBuffer()
          Returns the buffer over which the lexer is running.
 int getBufferEnd()
          Returns the offset at which the lexer will stop lexing.
 LexerPosition getCurrentPosition()
          Returns the current position and state of the lexer.
 int getState()
          Returns the current state of the lexer.
 int getTokenEnd()
          Returns the end offset of the current token.
 int getTokenStart()
          Returns the start offset of the current token.
 IElementType getTokenType()
          Returns the token at the current position of the lexer.
 void restore(LexerPosition position)
          Restores the lexer to the specified state and position.
 void start(char[] buffer)
          Prepare for lexing character data from buffer passed.
 void start(char[] buffer, int startOffset, int endOffset)
          Prepare for lexing character data from buffer passed.
 void start(char[] buffer, int startOffset, int endOffset, int initialState)
          Prepare for lexing character data from buffer passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyLexer

public EmptyLexer()
Method Detail

start

public void start(char[] buffer)
Description copied from interface: Lexer
Prepare for lexing character data from buffer passed. Lexing should be performed starting from offset 0 and terminated (EOFed) at offset buffer.length. Internal lexer state is supposed to be initial. YY_INITIAL for JLex and JFlex generated lexer.

Parameters:
buffer - character data for lexing.

start

public void start(char[] buffer,
                  int startOffset,
                  int endOffset)
Description copied from interface: Lexer
Prepare for lexing character data from buffer passed. Lexing should be performed starting from offset startOffset and terminated (EOFed) at offset endOffset. Internal lexer state is supposed to be initial. YY_INITIAL for JLex and JFlex generated lexer.

Parameters:
buffer - character data for lexing.
startOffset - offset to start lexing from
endOffset - offset to stop lexing at

start

public void start(char[] buffer,
                  int startOffset,
                  int endOffset,
                  int initialState)
Description copied from interface: Lexer
Prepare for lexing character data from buffer passed. Lexing should be performed starting from offset startOffset> and terminated (EOFed) at offset endOffset. Internal lexer state is supposed to be initialState. It is guaranteed that the value of initialState has been returned by Lexer.getState() method of this Lexer at condition startOffset=getTokenStart() This method is used to incrementally relex changed characters using lexing data acquired from this particular lexer sometime in the past.

Parameters:
buffer - character data for lexing.
startOffset - offset to start lexing from
endOffset - offset to stop lexing at
initialState - the initial state of the lexer.

getState

public int getState()
Description copied from interface: Lexer
Returns the current state of the lexer.

Returns:
the lexer state.

getTokenType

public IElementType getTokenType()
Description copied from interface: Lexer
Returns the token at the current position of the lexer.

Returns:
the current token.

getTokenStart

public int getTokenStart()
Description copied from interface: Lexer
Returns the start offset of the current token.

Returns:
the current token start offset.

getTokenEnd

public int getTokenEnd()
Description copied from interface: Lexer
Returns the end offset of the current token.

Returns:
the current token end offset.

advance

public void advance()
Description copied from interface: Lexer
Advances the lexer to the next token.


getCurrentPosition

public LexerPosition getCurrentPosition()
Description copied from interface: Lexer
Returns the current position and state of the lexer.

Specified by:
getCurrentPosition in interface Lexer
Overrides:
getCurrentPosition in class LexerBase
Returns:
the lexer position and state.

restore

public void restore(LexerPosition position)
Description copied from interface: Lexer
Restores the lexer to the specified state and position.

Specified by:
restore in interface Lexer
Overrides:
restore in class LexerBase
Parameters:
position - the state and position to restore to.

getBuffer

public char[] getBuffer()
Description copied from interface: Lexer
Returns the buffer over which the lexer is running. This method should return the same buffer instance which was passed to the start() method.

Returns:
the lexer buffer.

getBufferEnd

public int getBufferEnd()
Description copied from interface: Lexer
Returns the offset at which the lexer will stop lexing. This method should return the length of the buffer or the value passed in the endOffset parameter to the start() method.

Returns:
the lexing end offset