How to extend a syntax?


#1

I’ve got a file format that’s very similar to XML, except that CDATA sections contain Javascript code instead of plain text. (Or you could also say that specific XML elements, such as <script>...</script>, contain Javascript code.)

I’d like to create a new syntax for these files that reuses the XML syntax for the most part, except for these Javascript snippets.

The format is the following, so I’m not clear whether I should key off of CDATA sections or off of the element name…

<script><![CDATA[
    ...Javascript code goes here...
]]></script>

How to extend/modify existing syntax?
#2

Duplicate of …

Which references …

Closing as duplicate …


#3