com.stimulsoft.base
Class StiLexer

java.lang.Object
  extended by com.stimulsoft.base.StiLexer

public class StiLexer
extends java.lang.Object

Copyright Stimulsoft


Field Summary
 java.lang.String baseText
           
 int begToken
          Start of current token.
 int positionInText
          Gets or sets current position in text.
 java.util.List<java.lang.Integer> positions
          Start positions of token.
 
Constructor Summary
StiLexer(java.lang.String textValue)
          Creates a new instance of the StiLexer class.
 
Method Summary
static java.util.List<StiToken> getAllTokens(java.lang.String str)
           
 StiPosition getPosition(int positionInText)
          Gets position of token in text.
 java.lang.StringBuilder getText()
          text for analys.
 StiToken getToken()
          Gets next token.
static boolean identExists(java.lang.String str, java.lang.String name, boolean caseSensitive)
           
 void replaceWithNotEqualPrefix(StiTokenType prefix, java.lang.String oldValue, java.lang.String newValue)
          Replaces all occurrences of a specified String, with another specified String.
 void replaceWithPrefix(java.lang.String prefix, java.lang.String oldValue, java.lang.String newValue)
          Replaces all occurrences of a specified String, with another specified String.
static java.lang.String replaceWithPrefix(java.lang.String textValue, java.lang.String prefix, java.lang.String oldValue, java.lang.String newValue)
          Replaces all occurrences of a specified String, with another specified String.
 void reset()
          Reset state.
 void savePosToken()
          Saves position of token in text.
 StiToken scanChar()
          Scans the symbol.
 StiToken scanIdent()
          Scans the identifier.
 StiToken scanNumber()
          Scans the number.
 StiToken scanString()
          Scans the String.
 void setText(java.lang.StringBuilder value)
          text for analys.
 void skip()
          Skips all not control symbols.
 void ungetToken()
          Returns to previous token.
 boolean waitAssign2()
          Wait the assign.
 boolean waitComma2()
          Wait the right bracket.
 boolean waitLbrace2()
          Wait the left brace.
 boolean waitLparen2()
          Wait the left paren.
 boolean waitRbrace2()
          Wait the right brace.
 boolean waitRparen2()
          Wait the right paren.
 boolean waitSemicolon2()
          Wait the semicolon.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseText

public java.lang.String baseText

positions

public java.util.List<java.lang.Integer> positions
Start positions of token.


positionInText

public int positionInText
Gets or sets current position in text.


begToken

public int begToken
Start of current token.

Constructor Detail

StiLexer

public StiLexer(java.lang.String textValue)
Creates a new instance of the StiLexer class.

Parameters:
textValue - The text for lexical analysis.
Method Detail

getText

public java.lang.StringBuilder getText()
text for analys.

Returns:
the text

setText

public void setText(java.lang.StringBuilder value)
text for analys.

Parameters:
text - the text to set

savePosToken

public void savePosToken()
Saves position of token in text.


getPosition

public StiPosition getPosition(int positionInText)
Gets position of token in text.

Parameters:
positionInText - Position in text.
Returns:
Position of token in text.

skip

public void skip()
Skips all not control symbols.


waitLparen2

public boolean waitLparen2()
Wait the left paren.

Returns:

waitComma2

public boolean waitComma2()
Wait the right bracket.

Returns:

waitAssign2

public boolean waitAssign2()
Wait the assign.

Returns:

waitRparen2

public boolean waitRparen2()
Wait the right paren.

Returns:

waitLbrace2

public boolean waitLbrace2()
Wait the left brace.

Returns:

waitSemicolon2

public boolean waitSemicolon2()
Wait the semicolon.

Returns:

waitRbrace2

public boolean waitRbrace2()
Wait the right brace.

Returns:

scanNumber

public StiToken scanNumber()
Scans the number.

Returns:
Token containing number.

scanIdent

public StiToken scanIdent()
Scans the identifier.

Returns:
Token containing identifier.

scanString

public StiToken scanString()
Scans the String.

Returns:
Token containing String

scanChar

public StiToken scanChar()
Scans the symbol.

Returns:
Token containing symbol.

ungetToken

public void ungetToken()
Returns to previous token.


getToken

public StiToken getToken()
Gets next token.

Returns:
Next token.

reset

public void reset()
Reset state.


replaceWithPrefix

public static java.lang.String replaceWithPrefix(java.lang.String textValue,
                                                 java.lang.String prefix,
                                                 java.lang.String oldValue,
                                                 java.lang.String newValue)
Replaces all occurrences of a specified String, with another specified String. Before oldValue must follow specified prefix - token. Replacing is produced with provision for tokens.

Parameters:
textValue - text for replace.
prefix - Prefix - token.
oldValue - A String to be replaced.
newValue - A String to replace all occurrences of oldValue.
Returns:
Replaced String.

replaceWithPrefix

public void replaceWithPrefix(java.lang.String prefix,
                              java.lang.String oldValue,
                              java.lang.String newValue)
Replaces all occurrences of a specified String, with another specified String. Before oldValue must follow specified prefix - String. Replacing is produced with provision for tokens.

Parameters:
prefix - Prefix - String.
oldValue - A String to be replaced.
newValue - A String to replace all occurrences of oldValue.

replaceWithNotEqualPrefix

public void replaceWithNotEqualPrefix(StiTokenType prefix,
                                      java.lang.String oldValue,
                                      java.lang.String newValue)
Replaces all occurrences of a specified String, with another specified String. Before oldValue must not follow specified prefix - String.

Parameters:
prefix - Prefix - String.
oldValue - A String to be replaced.
newValue - A String to replace all occurrences of oldValue.

identExists

public static boolean identExists(java.lang.String str,
                                  java.lang.String name,
                                  boolean caseSensitive)

getAllTokens

public static java.util.List<StiToken> getAllTokens(java.lang.String str)