Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#654 Ren'Py Lexer

Completed
closed
Neil Hodgson
Scintilla (356)
3
2010-02-15
2010-02-03
Tom Rothamel
No

I'd like to add a Scintilla lexer for the Ren'Py script language. (http://www.renpy.org).

Ren'Py's script language is lexically quite similar to Python. Apart from additional keywords, the only major difference is that in Ren'Py, strings with one quote character (" or ') can span multiple lines, similar to Python's triple-quoted strings.

I'm wondering what the best way of going about doing this is. My current thought is that since the language is so similar to Python, the right idea is to modify LexPython to take an additional property, and to somehow set that property for Ren'Py files and leave it unset for Python files. I'm not sure how to do the latter, however.

Alternatively, I could fork LexPython into LexRenpy, but that would be a lot of code duplication.

What do you think?

Discussion

  • Neil Hodgson
    Neil Hodgson
    2010-02-03

    It is probably best to use the Python lexer and add a property lexer.python.strings.over.newline (or a better name if you can think of one). Use the implementation of lexer.python.literals.binary for how the code should look. Then implement the feature.

    How to expose this feature to work differently for Python and Ren'Py files depends on the editor you are using. SciTE can't easily do this although you could try to script it with the OnOpen event.

     
  • Neil Hodgson
    Neil Hodgson
    2010-02-03

    • priority: 5 --> 3
    • assigned_to: nobody --> nyamatongwe
     
  • Tom Rothamel
    Tom Rothamel
    2010-02-04

    I've attached a patch that implements lexer.python.strings.over.newline. If this goes in, I'll just post a renpy.properties file to the Ren'Py website, which enables this and adds support for the various keywords.

    Thanks... and thanks for Scintilla.

     
  • Neil Hodgson
    Neil Hodgson
    2010-02-05

    • milestone: --> Completed
     
  • Neil Hodgson
    Neil Hodgson
    2010-02-05

    Committed to CVS. Minor change to avoid warning by comparing return from GetPropertyInt to 0:

    bool stringsOverNewline = styler.GetPropertyInt("lexer.python.strings.over.newline") != 0;

     
  • Neil Hodgson
    Neil Hodgson
    2010-02-15

    • status: open --> closed