Hi,
I have the following rule for a block comment:
{ name = 'comment.block.active4d'; begin = '/*'; end = '*/'; patterns = ( { include = '#fusedoc'; } ); }
Within a block comment, the fusedoc rule looks for some xml:
fusedoc = { begin = '^\s*<fusedoc '; end = '^\s*</fusedoc>'; patterns = ( { include = 'text.xml'; } ); }
The problem is that I want the text.xml language parser to parse the line on which '<fusedoc ' is found. However, it seems that it will only parse the lines between the begin and end lines.
Is there any way to have the first and last lines of the fusedoc rule be parsed by text.xml?
Regards,
Aparajita www.aparajitaworld.com
"If you dare to fail, you are bound to succeed." - Sri Chinmoy | www.srichinmoylibrary.com
On 18/4/2006, at 22:28, Aparajita Fishman wrote:
[...] Is there any way to have the first and last lines of the fusedoc rule be parsed by text.xml?
Yes, use look-ahead and look-behind assertions in the begin/end patterns. E.g.:
fusedoc = { begin = '(?=^\s*<fusedoc )'; end = '(?<=</fusedoc>)'; patterns = ( { include = 'text.xml'; } ); }
This way, the patterns themselves will match zero characters.
Look-behind however can only be fixed width, so there is no way to ensure that ‘^\s*’ is in front of the end-tag.
[...] Is there any way to have the first and last lines of the fusedoc rule be parsed by text.xml?
Yes, use look-ahead and look-behind assertions in the begin/end patterns. E.g.:
fusedoc = { begin = '(?=^\s*<fusedoc )'; end = '(?<=</fusedoc>)'; patterns = ( { include = 'text.xml'; } ); }
This way, the patterns themselves will match zero characters.
Fantastic! Thank you, this is a good technique to know.
Regards,
Aparajita www.aparajitaworld.com
"If you dare to fail, you are bound to succeed." - Sri Chinmoy | www.srichinmoylibrary.com