Friday, July 21, 2017

How PHP syntax file works?

Hello!
I'm trying to write text editor with syntax highlighting based on vim syntax files.
And I have the small problem.
There is here the PHP code:
=========== 8< ========
<script>
<?
{
?>
javascript_function()
=========== >8 ========
The first line opens javaScript region by the next syntax rule:
syn region javaScript start=+<script\_[^>]*>+ keepend end=+</script\_[^>]*>+me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,htmlScriptTag,@htmlPreproc

The second line opens phpRegion region by the next syntax rule:
syn region phpRegion matchgroup=Delimiter start="<?\(php\)\=" end="?>" contains=@phpClTop keepend

The third line opens phpParent region by the next syntax rule:
syn region phpParent matchgroup=Delimiter start="{" end="}" contained contains=@phpClFunction,phpFoldHtmlInside transparent fold

And the fourth line opens phpFoldHtmlInside region by the next syntax rule:
syn region phpFoldHtmlInside matchgroup=Delimiter start="?>" end="<?\(php\)\=" contained transparent contains=@htmlTop

HTML! Not JavaScript! So how the vim do this trick? There is no phpFoldJavaScriptInside region. Why the vim continues highlight region after "?>" as JavaScript and not HTML?

Big thanks!

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment