I've a preprocessor (xhp) that allows me to write unquoted text in php code e.g.:
<foo>
my enemies' base
</foo>
might appear in a .php file, but as soon as emacs sees that single quote it sees the entire rest of the file as being in a string.
The simplest solution that I'd be happy with would be just assuming the string is one-line only.
I don't know what major-mode you're using, but in general the trick is to change the syntax of the ' character with something like (modify-syntax-entry ?\' "." <syntaxtable>)
. Of course, if the ' character can sometimes delimit strings and sometimes not, then it's more tricky and you'll need to come up with a font-lock-syntactic-keywords
(or syntax-propertize-function
) rule which can tell which is used at any given point.
E.g. assuming PHP never treats ' as a string delimiter, something like the following might solve your problem:
(add-hook 'php-mode-hook
(lambda () (modify-syntax-table ?\' ".")))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With