Class ExpressionParser


  • public class ExpressionParser
    extends java.lang.Object
    Parser for integer expressions.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull Expression parseExpression​(@NotNull java.lang.String str)
      Parses an integer constant.
      static int parseInt​(@NotNull java.lang.String str)
      Parses an integer constant.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • parseInt

        public static int parseInt​(@NotNull
                                   @NotNull java.lang.String str)
                            throws java.io.IOException
        Parses an integer constant. Valid constants are "3", "3+4", and "1+2-3+4".
        Parameters:
        str - the integer constant string to parse
        Returns:
        the integer value
        Throws:
        java.io.IOException - if a parsing error occurs
      • parseExpression

        @NotNull
        public static @NotNull Expression parseExpression​(@NotNull
                                                          @NotNull java.lang.String str)
                                                   throws java.io.IOException
        Parses an integer constant. Valid constants are "3", "3+4", and "1+2-3+4".
        Parameters:
        str - the integer constant string to parse
        Returns:
        the integer expression
        Throws:
        java.io.IOException - if a parsing error occurs