Child Languages and Scopes

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Joachim Schwieren

I have declared an HTML language and want to use a separate PHP language as child language that is applied when <? ... ?> appears in the HTML code.

I have embedded the child language as follows:
<State Key="ProcessingInstructionState" Filename="PHP.xml" ChildLanguageBackColor="WhiteSmoke">
<!-- Scopes -->
<ExplicitPatternGroup Type="StartScope" TokenKey="ProcessingInstructionStartToken" Style="ProcessingInstructionDelimiterStyle" PatternValue="&lt;?" />
<ExplicitPatternGroup Type="EndScope" TokenKey="ProcessingInstructionEndToken" Style="ProcessingInstructionDelimiterStyle" PatternValue="?&gt;" />    
This works nice but when I have a PHP code snippet that uses the EndScope inside, the language is changed back to HTML. Here is an example:
  echo("Everything is ok here");
  define("xml_field","<?xml version=\"1.0\" encoding=\"utf-8\"?><modules>");
  echo("The line above causes the problem");
When the parser comes to encoding=\"utf-8\"?> it assumes that the child language ends here but this is not the case since the ?> is inside a string scope of the PHP language.

How can I get this working?

Thanks and best regards,


Comments (2)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Joe,

Take a look at the documentation under "SyntaxEditor Dynamic Language XML Definition Specification / Scope Tag". You'd probably want to set AncestorEndScopeCheckEnabled to false.

Actipro Software Support

Posted 14 years ago by Joachim Schwieren
Yeah, that's it! Thanks! :-)
The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.