groovy lexer does not smart enough to understand whether a regex contents injections or not . so the parser should do this job . we create additional marker2 for the case of absence of injections . in this case resulting tree is as follows : regex mregexliteral mdollarslashregexliteral mregexbegin ... mregexcontent ... mregexend ... this tree emulates tree of simple grliteralimpl structure so we can use regexes where simple strings are expected . concode_field_sep PsiBuilder myBuilder concode_elem_sep boolean myForRefExpr concode_elem_sep GroovyElementType myCompoundLiteral concode_elem_sep IElementType myEnd concode_elem_sep GroovyParser myParser concode_elem_sep IElementType mySimpleLiteral concode_elem_sep IElementType myContent concode_elem_sep Logger LOG concode_elem_sep IElementType myBegin concode_elem_sep String myMessage concode_field_sep void finishSimpleLiteral concode_elem_sep void processContent concode_elem_sep boolean parseInjection
boolean function ( @ NotNull PsiBuilder arg0 , @ NotNull GroovyParser arg1 , boolean arg2 , @ NotNull IElementType arg3 , @ NotNull IElementType arg4 , @ NotNull IElementType arg5 , @ Nullable IElementType arg6 , @ NotNull GroovyElementType arg7 , @ NotNull String arg8 ) { return new CompoundStringExpression ( arg0 , arg1 , arg2 , arg3 , arg4 , arg5 , arg6 , arg7 , arg8 ) . parse ( ) ; }