Language Injection phpLiteralExpression with wildcard

How would I make a language injection setting to
essentially match php occurances of <<<JS*

Using * as a wildcard for any one or more characters

+ phpLiteralExpression("JS*") didn't cut it. . .

5 comments
Comment actions Permalink

Why do you need that?


0
Comment actions Permalink

Because I have a class with several different heredoc definations of long javascript code. It is a pain to have to manually inject JS language into each one on every edit and the default setting only recognizes <<<JS which you can only use once in a file.  Having it also automatically inject <<<JS2... <<JSfoo would be great. Is there a better way I can be doing this?

0
Comment actions Permalink
the default setting only recognizes <<<JS which you can only use once in a file.

New to me -- did not know that. Can you point me to a official documentation which states this limitation?

Why this works just fine then?

<php
$zz = <<<JS
var meow = 125;
JS;


echo $zz, "\n";

$zz = <<<JS
alert('Hello!');
JS;


echo $zz, "\n";

0
Comment actions Permalink

Not sure where I got that. You are right though. Thanks!

0
Comment actions Permalink

<<<JS which you can only use once in a file


This is just incorrect.

And no, such (JS*) name matching is not possible and not planned.
0

Please sign in to leave a comment.