#47 Multi-Level Syntax

open
None
3
2003-01-20
2003-01-19
Anonymous
No

Hello
what about support, for example, CSS inside the
<style> tag in html?

Discussion

  • Neil Hodgson

    Neil Hodgson - 2003-01-20
    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
     
  • Neil Hodgson

    Neil Hodgson - 2003-01-20

    Logged In: YES
    user_id=12579

    One way is to combine more lexers in editing a file. I don't
    know how this is difficult.

    Another way is to reimplement CSS lexer in HTML lexer. The
    problem is, that there are not enough free states for it. I
    though about it some time ago and my proposal is to
    separate HTML lexer into ASP and PHP (and maybe pure
    HTML) lexer and include CSS everywhere. Any comments?

    Jakub Vrana

     
  • Xavier Trochu

    Xavier Trochu - 2003-01-23

    Logged In: YES
    user_id=1927

    I'd love to see a more generic approach to this problem.

    The way I see it, Scintilla would maintain a stack of lexers
    when parsing the file. Each parser would have a way to push
    a new lexer into the the stack when it encounters a
    particular token (like <script> tag), and should have a way
    to pop the lexer back when reading another token (like
    </script>), if and only if the other lexer is in a
    particular state, (not inside a string, for instance).

    I know this probably means a lot of work, but this would be
    a great advantage.

    For instance, I once started to code in cheetah, which is a
    superset of Python to generate template. The generated text
    was php, with of course HTML, CSS and javascript included.
    Building a lexer for this particular application is
    difficult and not very useful, yet the solution given above
    would allow this situation to be handled satisfactory
    without much work, if you already have a Python, HTML, CSS
    and javascript lexers.

     
  • Neil Hodgson

    Neil Hodgson - 2003-01-27

    Logged In: YES
    user_id=12579

    You don't just need a stack of lexers, you need a way for
    islands of text for a particular lexer to communicate - if your
    ASP lexer sees a language directive then this has to be
    remembered for the next piece of ASP text. SinkWorld tries
    to solve this and there is code in the current SinkWorld CVS
    for this feature. There are still quite a few outstanding issues
    and I haven't enough time available to concentrate on
    SinkWorld. http://scintilla.sourceforge.net/SinkWorld.html
    SinkWorld deals with the situation where you instantiate a
    lexer multiple times such as where a HTML uses both server
    side and client side JavaScript so needs 2 JavaScript lexers.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks