Class SourceUtil

java.lang.Object
processing.mode.java.preproc.SourceUtil

public class SourceUtil extends Object
  • Field Details

    • IMPORT_REGEX

      public static final Pattern IMPORT_REGEX
    • IMPORT_REGEX_NO_KEYWORD

      public static final Pattern IMPORT_REGEX_NO_KEYWORD
    • TYPE_CONSTRUCTOR_REGEX

      public static final Pattern TYPE_CONSTRUCTOR_REGEX
    • HEX_LITERAL_REGEX

      public static final Pattern HEX_LITERAL_REGEX
    • FLOATING_POINT_LITERAL_VERIFIER

      public static final Pattern FLOATING_POINT_LITERAL_VERIFIER
    • COLOR_TYPE_REGEX

      public static final Pattern COLOR_TYPE_REGEX
    • NUMBER_LITERAL_REGEX

      public static final Pattern NUMBER_LITERAL_REGEX
  • Constructor Details

    • SourceUtil

      public SourceUtil()
  • Method Details

    • parseProgramImports

      public static List<ImportStatement> parseProgramImports(CharSequence source)
    • replaceTypeConstructors

      public static List<TextTransform.Edit> replaceTypeConstructors(CharSequence source)
    • replaceHexLiterals

      public static List<TextTransform.Edit> replaceHexLiterals(CharSequence source)
    • preprocessAST

      public static List<TextTransform.Edit> preprocessAST(org.eclipse.jdt.core.dom.CompilationUnit cu)
    • replaceColorRegex

      public static List<TextTransform.Edit> replaceColorRegex(CharSequence source)
    • fixFloatsRegex

      public static List<TextTransform.Edit> fixFloatsRegex(CharSequence source)
    • scrubCommentsAndStrings

      public static void scrubCommentsAndStrings(StringBuilder p)
    • checkForMissingBraces

      public static int[] checkForMissingBraces(CharSequence c, int start, int end)
      Checks a single code fragment (such as a tab) for non-matching braces. Broken out to allow easy use in JavaBuild.
      Parameters:
      c - Program code scrubbed of comments and string literals.
      start - Start index, inclusive.
      end - End index, exclusive.
      Returns:
      int[4] Depth at which the loop stopped, followed by the line number, column, and string index (within the range) at which an error was found, if any.
    • getCount

      public static int getCount(String body, String search)
      Determine how many times a string appears in another.
      Parameters:
      body - The string in which occurrences should be counted.
      search - The string to look for.
      Returns:
      The number of times search appears in body.