В ср, 2006-11-01 в 10:53 +1100, Peter Hodge написа: > --- ÐикÑоѬ ÐaожђÑ&аѬов <[EMAIL PROTECTED]> wrote: > > > Hello, > > > > I'm working on a syntax file for .edc files. The problem before me is > > that I want to use a different syntax file for a "script" part. I've > > created the syntax file for the script syntax, and I've read how yto use > > "syn include". > > > > The real problem is, that in the .edc files, scripts are located within: > > script { > > SCRIPT HERE > > } > > ,however, the scripts themselves can also have {} braces. I've written > > the following, but it only uncludes the script syntax upto the first "}" > > brace, and I have no idea how to make it end on the _matching_ "}" brace > > instead: > > > > ----------------------------------------------------------------------- > > syn include @edcEmbryo syntax/embryo.vim > > unlet b:current_syntax > > syn region edcScript start="\<script\>\s*\n*\s*{" end="}" > > [EMAIL PROTECTED],edcScriptTag > > syn keyword edcScriptTag contained script > > ----------------------------------------------------------------------- > > > > So the question is, if I have: > > script { > > if (foo) { > > bar; > > } else { > > baz; > > } > > } > > how do I make vim use the script syntax all the way up to the closing } > > brace for the "script"? > > Hello, > > Your syntax file 'embryo.vim' will need regions match up all {} pairs as well. > > syn region embryoBraces matchgroup=Delimiter start=/{/ end=/}/ transparent > > regards, > Peter >
adding an embryoBraces region now makes all the script part highlighted correctly, but it doesn't stop. It continues trying to highlight the rest of the .edc file as if it was an embryo file. > 1. Maybe this can fix the problem: namely, using this inclusion method > mentioned in ':help syn-include' : > :runtime! syntax/embryo.vim > :unlet b:current_syntax > , instead of using 'syn include'. Does this help ? > > If this won't help, how about two less probably possiblities: > > 2. Just for the sake of experiment, does the problem go away > when you modify the 'syn region' to this: > > syn region edcScript start="\<script\>\s*\n*\s*{" end="^}" ... > > I realise this is not the proper final fix, but just to see what makes the > problem. Without (1) and (2), I think vim > has egg-and-chicken problem trying to determine where > @edcEmbryo ends. > > 3. Does something change if you comment out the 'syn keyword ... script' > statement ? > One less probably suspicion is that that 'keyword script' badly interacts with > pattern containing 'script' with 'region ... start="\<script\>... > This seems less probale because you say that beginning of edcScript > region matches correctly. > > Yakov 1. I've tried that before. doesn't work, as it breaks everything. 2. the end } for the script is not neceserily at the beginning of the line (and it almost never is) 3. I don't quite understand that point, but the script start is matched correctly. > > Send instant messages to your online friends http://au.messenger.yahoo.com -- Виктор Кожухаров /Viktor Kojouharov/
signature.asc
Description: Това е цифрово подписана част от писмото