Posted 21 years ago
by Joe Madia

I'm doing some testing with the 2.0 preview release and have a question about the dynamnic language tutorials. (So far, the nested language support in 2.0 looks extremely impressive!)
To illustrate the question, start with the C#-Within-Xml dynamic language sample from within the editor application (Language | Dynamically Create | Middle Radio Button) and place the following source code into the editor:
The %> within the C# string literal is being matched as the end of the C# block. (The 'int x = 5' is not highlighted as C#.) It appears that the outer language's end-pattern takes precedence over the inner languages lexical scopes.
I believe that the observed behavior is correct for most scenarios. (It matches the ASP parser exactly, if I recall correctly.) However, I have a case that could benefit from the other interpretation of the the example code. Is there any way to modify the inner or outer grammar so that the %> within the C# string literal does not end the C# code block?
Thanks in advance for any help!
To illustrate the question, start with the C#-Within-Xml dynamic language sample from within the editor application (Language | Dynamically Create | Middle Radio Button) and place the following source code into the editor:
Quote:
<font size="1" face="Verdana, Arial">quote:</font><HR>
<tagblock>
<!-- This ASP-style directive block transitions to C# language -->
<%
// C# comment
string s = "<% %>";
int x = 5;
%>
</tagblock>
<HR>
The %> within the C# string literal is being matched as the end of the C# block. (The 'int x = 5' is not highlighted as C#.) It appears that the outer language's end-pattern takes precedence over the inner languages lexical scopes.
I believe that the observed behavior is correct for most scenarios. (It matches the ASP parser exactly, if I recall correctly.) However, I have a case that could benefit from the other interpretation of the the example code. Is there any way to modify the inner or outer grammar so that the %> within the C# string literal does not end the C# code block?
Thanks in advance for any help!