Package com.stimulsoft.base
Class StiLexer
java.lang.Object
com.stimulsoft.base.StiLexer
Copyright Stimulsoft
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAllTokens(String str) getPosition(int positionInText) Gets position of token in text.getText()text for analys.getToken()Gets next token.static booleanidentExists(String str, String name, boolean caseSensitive) static booleanstatic booleanChecks if a string is a C# keyword.voidreplaceWithNotEqualPrefix(StiTokenType prefix, String oldValue, String newValue) Replaces all occurrences of a specified String, with another specified String.voidreplaceWithPrefix(String prefix, String oldValue, String newValue) Replaces all occurrences of a specified String, with another specified String.static StringreplaceWithPrefix(String textValue, String prefix, String oldValue, String newValue) Replaces all occurrences of a specified String, with another specified String.voidreset()Reset state.voidSaves position of token in text.scanChar()Scans the symbol.Scans the identifier.final StiTokenScans an interpolated string, which begins with $" and can contain expressions in { }.Scans the number.Scans the String.voidsetText(StringBuilder value) text for analys.voidSkips all not control symbols.voidReturns to previous token.booleanWait the assign.booleanWait the right bracket.booleanWait the left brace.booleanWait the left paren.booleanWait the right brace.booleanWait the right paren.booleanWait the semicolon.
-
Field Details
-
baseText
-
positions
Start positions of token. -
positionInText
public int positionInTextGets or sets current position in text. -
begToken
public int begTokenStart of current token.
-
-
Constructor Details
-
StiLexer
Creates a new instance of the StiLexer class.- Parameters:
textValue- The text for lexical analysis.
-
-
Method Details
-
getText
text for analys.- Returns:
- the text
-
setText
text for analys.- Parameters:
text- the text to set
-
savePosToken
public void savePosToken()Saves position of token in text. -
getPosition
Gets position of token in text.- Parameters:
positionInText- Position in text.- Returns:
- Position of token in text.
-
skipWhitespaceAndComments
public void skipWhitespaceAndComments()Skips all not control symbols. -
waitLparen2
public boolean waitLparen2()Wait the left paren.- Returns:
-
waitComma2
public boolean waitComma2()Wait the right bracket.- Returns:
-
isKeyword
-
isKeyword
Checks if a string is a C# keyword.- Parameters:
ident- The string to check.includingTypes- True if the string is a keyword; otherwise, false.- 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
Scans the number.- Returns:
- Token containing number.
-
scanIdent
Scans the identifier.- Returns:
- Token containing identifier.
-
scanString
Scans the String.- Returns:
- Token containing String
-
scanChar
Scans the symbol.- Returns:
- Token containing symbol.
-
ungetToken
public void ungetToken()Returns to previous token. -
getToken
Gets next token.- Returns:
- Next token.
-
reset
public void reset()Reset state. -
scanInterpolatedString
Scans an interpolated string, which begins with $" and can contain expressions in { }.- Returns:
- Token containing the interpolated string content.
-
replaceWithPrefix
public static String replaceWithPrefix(String textValue, String prefix, String oldValue, 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
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
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
-
getAllTokens
-