question: private static ImmutableList < Elem > parse ( String pattern ) { List < Elem > elems = new ArrayList < > ( ) ; while ( pattern . length ( ) > 0 ) { int slash ; if ( pattern . startsWith ( WILDCARD_PATTERN ) ) { elems . add ( Elem . WILDCARD ) ; pattern = pattern . substring ( WILDCARD_PATTERN . length ( ) ) ; } else if ( ( slash = pattern . indexOf ( "/" ) ) >= 0 ) { elems . add ( Elem . createLiteral ( pattern . substring ( 0 , slash ) ) ) ; pattern = pattern . substring ( slash ) ; } else { elems . add ( Elem . createLiteral ( pattern ) ) ; pattern = "" ; } if ( pattern . startsWith ( "/" ) ) { pattern = pattern . substring ( 1 ) ; } } return ImmutableList . < Elem > copyOf ( elems ) ; }
target:  Parses pattern, with the leading '^' and trailing '$' removed, into a list representing the pattern.