On Thursday, December 26, 2013 7:22:22 PM UTC-6, riemann wrote: > > > > We should agree on the fact that in a "language.vim" file the user specifies > what should be highlighted and how it should be rendered for that particular > filetype expressing this desired behaviour following the rules indicated in > :help syntax. >
Ok. Agreed. > > Than the implementation of this is of course done in source code as we can > see > in the almost ten thousand lines of code of syntax.c. > But it turns out that the feature in question is not obtainable with the means > exposed by Vim, so no vim script can do this. > Here I disagree. The language.vim file you speak of defines regular expressions. The syntax.c file highlights those regular expressions, nothing more. Vim doesn't keep a semantic understanding of code structure anywhere. Everything Vim knows about the highlighted code is defined in the language.vim file, and everything matched by that file is accessible in vimscript using synstack() and other functions. The information you seek to highlight isn't made available to vimscript, because vim itself doesn't know that information. Vim doesn't actually understand the code. It just highlights regular expressions. > Then there are two choices: use external software (in the case of easytags > that you suggested it's exuberant ctags) Yes, because you need an external tool that actually attempts to parse and understand the code in a meaningful fashion. Once you have that understanding of the code, you can use that to define new syntax rules. > or edit syntax.c. > I followed the second for reasons already expressed. Sure, it would be neat if there was some way for Vim to actually do this for arbitrary languages. I'm interested in seeing what you've accomplished. But what you're looking for in the code just isn't there. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
