com.intellij.lexer
Class StringLiteralLexer

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

public class StringLiteralLexer
extends LexerBase


Field Summary
static char NO_QUOTE_CHAR
           
 
Constructor Summary
StringLiteralLexer(char quoteChar, IElementType originalLiteralToken)
           
StringLiteralLexer(char quoteChar, IElementType originalLiteralToken, boolean canEscapeEol, java.lang.String additionalValidEscapes)
           
 
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.
 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 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 com.intellij.lexer.LexerBase
getCurrentPosition, restore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_QUOTE_CHAR

public static final char NO_QUOTE_CHAR
See Also:
Constant Field Values
Constructor Detail

StringLiteralLexer

public StringLiteralLexer(char quoteChar,
                          IElementType originalLiteralToken)

StringLiteralLexer

public StringLiteralLexer(char quoteChar,
                          IElementType originalLiteralToken,
                          boolean canEscapeEol,
                          java.lang.String additionalValidEscapes)
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,
                  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.

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

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.


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