Class StiLexer

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

public class StiLexer extends Object
Copyright Stimulsoft
  • Field Details

    • baseText

      public String baseText
    • positions

      public List<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 Details

    • StiLexer

      public StiLexer(String textValue)
      Creates a new instance of the StiLexer class.
      Parameters:
      textValue - The text for lexical analysis.
  • Method Details

    • getText

      public StringBuilder getText()
      text for analys.
      Returns:
      the text
    • setText

      public void setText(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.
    • 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

      public static boolean isKeyword(String ident)
    • isKeyword

      public static boolean isKeyword(String ident, boolean includingTypes)
      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

      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.
    • scanInterpolatedString

      public final StiToken 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

      public void replaceWithPrefix(String prefix, String oldValue, 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, String oldValue, 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(String str, String name, boolean caseSensitive)
    • getAllTokens

      public static List<StiToken> getAllTokens(String str)