How PHP syntax file works?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How PHP syntax file works?

unDEFER
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How PHP syntax file works?

unDEFER
суббота, 22 июля 2017 г., 6:37:56 UTC+3 пользователь unDEFER написал:

> 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

OK. I have found with syntrace that really vim closes phpRegion here. Seems it is possible because phpParent is transparent, but in the documentation I didn't found anything about it.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...