Class FormatCache_java

java.lang.Object
eu.bandm.tools.umod.FormatCache_java

public class FormatCache_java extends Object
Cache for metajava expressions, to that the parsing and construction must happen only once for each input text. Parsing errors are reported by exceptions.
  • Field Details

    • formatCache

      protected static final Map<String,Format> formatCache
      The only cache storage. Since the valid external representations of the three syntactic forms "expression", "statement", and "statements" are disjoined, one map is sufficient.
    • formatClosure

      protected static final FormatClosure formatClosure
      The parser for the metajava format expressions.
  • Constructor Details

    • FormatCache_java

      public FormatCache_java()
  • Method Details

    • statement

      public static Format statement(String s)
      Parse a Java statement, construct the format, cache it and return it.
      Parameters:
      s - source text
      Returns:
      the parsing result
      Throws:
      IllegalArgumentException - on a syntax error
    • statements

      public static Format statements(String s)
      Parse a sequence of Java statements, construct the format, cache it and return it.
      Parameters:
      s - source text
      Returns:
      the parsing result
      Throws:
      IllegalArgumentException - on a syntax error
    • expression

      public static Format expression(String s)
      Parse a Java expression, construct the format, cache it and return it.
      Parameters:
      s - source text
      Returns:
      the parsing result
      Throws:
      IllegalArgumentException - on a syntax error