Package proguard.util

Class ListParser

java.lang.Object
proguard.util.ListParser
All Implemented Interfaces:
StringParser

public class ListParser extends Object implements StringParser
This StringParser can create StringMatcher instances for regular expressions. The regular expressions are either presented as a list, or they are interpreted as comma-separated lists, optionally prefixed with '!' negators. If an entry with a negator matches, a negative match is returned, without considering any subsequent entries in the list. The creation of StringMatcher instances for the entries is delegated to the given StringParser.

For example, "*.xml,*.jpg" matches all strings with the given extensions; "!dummy" matches all strings except "dummy"; "!dummy.xml,*.xml" matches all strings with .xml, except "dummy.xml"; "special.xml,!*.xml" matches "special.xml" and all other non-.xml strings.

  • Constructor Summary

    Constructors
    Constructor
    Description
    ListParser(StringParser stringParser)
    Creates a new ListParser that parses individual elements in the comma-separated list with the given StringParser.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    main(String[] args)
    A main method for testing name matching.
    parse(String regularExpression)
    Creates a StringMatcher for the given regular expression.
    parse(List<String> regularExpressions)
    Creates a StringMatcher for the given regular expression, which can be a list of optionally negated simple entries.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ListParser

      public ListParser(StringParser stringParser)
      Creates a new ListParser that parses individual elements in the comma-separated list with the given StringParser.
  • Method Details

    • parse

      public StringMatcher parse(String regularExpression)
      Description copied from interface: StringParser
      Creates a StringMatcher for the given regular expression.
      Specified by:
      parse in interface StringParser
    • parse

      public StringMatcher parse(List<String> regularExpressions)
      Creates a StringMatcher for the given regular expression, which can be a list of optionally negated simple entries.

      An empty list results in a StringMatcher that matches any string.

    • main

      public static void main(String[] args)
      A main method for testing name matching.