public static Expression regexLiteral ( String contents ) { int firstSlash = contents . indexOf ( ' ' ) ; int lastSlash = contents . lastIndexOf ( ' ' ) ; checkArgument ( firstSlash < lastSlash && firstSlash != - 1 , "expected regex to start with a '/' and have a second '/' near the end, got %s" , contents ) ; return Leaf . create ( contents , /* isCheap= */ false ) ; }
Creates a code chunk representing a JavaScript regular expression literal .