Menu

Edit settings of an existing language?

saktan
2008-09-27
2012-11-13
  • saktan

    saktan - 2008-09-27

    I mean not editing the style of a lang. but adding extra keywords, modifying block commenting char seq.s. etc.

    Is it possible, huh?

    Thanks...
    saktan

     
    • Aaron W

      Aaron W - 2008-10-01

      OK, so I need to change the settings of PHP syntax highlighting.  The problem is, within a heredoc (<<<EOD  ... \nEOD;), it's not recognizing curly braces {} as variable delimiters, which they are :: http://us.php.net/manual/en/language.types.string.php#language.types.string.parsing

      So, I need to have it recognize everything within curly braces INSIDE a STRING as a STRING VARIABLE.

      How can I do that?  Is that possible?

      I looked in langs.xml, but all that's defined in there are file externsions, comment delimiters, and keywords to highlight, but no other language syntax.

      It seems as if those other actual language syntax definitions are hidden away in some other place.

      Any pointers?

      Thank you very much.

       
      • Daniel Spawn

        Daniel Spawn - 2008-10-01

        You have to go through the code...

        At least that's what I figured from here:

        http://sourceforge.net/forum/message.php?msg_id=5290974

        If you find a way around, please tell me

         
        • Aaron W

          Aaron W - 2008-10-02

          Yeah, I think you're right.  Thanks.

          Looks like there's a series of files named like LexLangname.cxx (ie, "LexPython.cxx") in the ./scintilla/src dir of the source.  PHP lexing appears to be defined in "LexOthers.cxx".  So anything deeper than keywords, comment markers, and colors for existing definitions seems to require modifying that source code.

          I did find something interesting looking at someone else's "userDefineLang.xml" (generated by the User-Define Language tool in NPP) here's an excerpt --- notice the "Keywords name='Operators'" and "Keywords name='Folder+'" etc. Maybe it's possible to add something like this to langs.xml to extend existing definitions?  But how to define that something within something else = an existing type?  I dunno.  It may not be possible.
          ---------------------
          This was for "GScript2"
                      <Keywords name="Delimiters">&quot;&apos;0&quot;&apos;0</Keywords>
                      <Keywords name="Folder+"></Keywords>
                      <Keywords name="Folder-"></Keywords>
                      <Keywords name="Operators">( ) , . : ; [ ] { }</Keywords>
                      <Keywords name="Comment">1/* 2*/ 0//</Keywords>
                      <Keywords name="Words1">function return break if public with for while do case default switch else enum const in continue class</Keywords>
                      <Keywords name="Words2">true false null nil NULL new</Keywords>
                      <Keywords name="Words3">echo triggeraction length size sleep index pos type = == &amp;&amp; || != ! ? @ @= &lt; &gt; &lt;= =&lt; &gt;= =&gt;</Keywords>
                      <Keywords name="Words4"></Keywords>

          --------------------

          I was actually wrong, on the PHP thing, though.  It does mark string variables inside of heredocs as "default" text (even though it should probably mark them as "string variable"), but, oh well.  I misunderstood - not everything between curly brackets is interpreted by PHP as a string var, but only when there is a curly bracket + variable, ie {$foo} or ${foo}, but not {foo()}  as I thought. {foo()} is actually invalid syntax in a string or heredoc.

           
    • Daniel Spawn

      Daniel Spawn - 2008-09-27

      For autocomplete you can edit the files in the APIs folder...
      For syntax coloring, im afraid you have to go through the code... at least for php its that way