Is there any way to do this in GtkSourceView?



Hi,
I'm trying to create a .lang file for text that looks like html interspersed with escape sequences "\<code>;", where <code> is written in a scripting language called Wrapl. The interpreter parses <code> so it can contain additional semicolons, but only within matching brackets. However the syntax highlighting switches back to html after the first semicolon. I realize this might be tricky to solve, but it could be possible to only switch back to html mode at the first semicolon after a matching bracket. Is there any way to do this?

This is my .lang file at the moment:

<language id="rhtml" _name="rHtml" version="2.0" _section="Sources">
  <metadata>
    <property name="globs">*.rhtml;*.inc</property>
  </metadata>
  <definitions>
    <context id="wrapl-block">
      <start>\\</start>
      <end>;</end>
      <include>
        <context ref="wrapl:wrapl"/>
      </include>
    </context>
    <replace id="html:embedded-lang-hook" ref="wrapl-block"/>
    <context id="rhtml">
      <include>
        <context ref="wrapl-block"/>
        <context ref="html:html"/>
      </include>
    </context>
  </definitions>
</language>

For example:

<title>\out:write(TITLE);</title>

works fine, but

\DEF GenerateFile(name, file) (
    FileSys.FileTime('../{file}.xml') < FileSys.FileTime('{file}.html') => RET;
    dbg:write('Generating {file}.\n');
);

stops after the semicolon after RET.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]