#1008 KVIrc script lexer

Completed
closed
Neil Hodgson
None
5
2013-11-28
2013-08-17
Omega Weapon
No

As mentioned in the scintilla-interest posting, I would like to contribute a KVIrc script lexer (that will eventually be picked up by geany, where I have further changes).

Would a patch against the state of Scintilla as it was in the original geany code (323 in version.txt) be acceptable, or should I pull down from the default branch of the mercurial repo and work from that?

Thanks

Discussion

  • Neil Hodgson
    Neil Hodgson
    2013-08-17

    Its unlikely to be much different. Try whatever is easiest and I'll post back any problems.

     
  • Omega Weapon
    Omega Weapon
    2013-08-18

    Great - I have attached the patch based on the following, minus generated files:

    git diff master -- scintilla
    
     
  • Neil Hodgson
    Neil Hodgson
    2013-08-19

    Windows line ends \r\n appear to increment the line number twice in the folder. This will cause folds to appear on wrong lines.

    The use of isdigit without checking for ASCII first is undefined and can lead to out-of-bounds memory access. Use IsASCII (not isascii) first or use IsADigit.

    lexkvirc.cxx(323): warning : C6386: Buffer overrun while writing to 's': the writable size is '100' bytes, but 'wordLen' bytes might be written.

    Since some more lexers have been defined since the release this was branched from
    val SCLEX_KVIRC=110

     
  • Omega Weapon
    Omega Weapon
    2013-08-20

    Thanks - will hopefully have another version later today. That looks like a pylint warning - what tool are you using to check the code?

     
  • Neil Hodgson
    Neil Hodgson
    2013-08-20

    That one is from the Code Analysis feature of Visual Studio. Its a classic off-by-one error.

     
  • Omega Weapon
    Omega Weapon
    2013-08-20

    OK, v2 of patch attached with all points actioned. Lexer now has ID 110 based on what you've said (confirmed with tip of scintilla repo too).

    I tried to read how isdigit is implemented but gave up :/ Perhaps after a few years of solid C... I was aware of unbounded string functions being unsafe but not simple type functions. The implementation of isascii looks alright - were you recommending your provided functions for style?

     
  • Neil Hodgson
    Neil Hodgson
    2013-08-21

    Committed as [1569d0].

    isascii isn't included in ISO C++ so compilers in strict modes will reject it. isdigit and related functions are often implemented with a array of 128 or 256 elements. Sometimes the bounds are checked but, for speed, they don't have to be.

     

    Related

    Commit: [1569d0]

  • Omega Weapon
    Omega Weapon
    2013-08-21

    Thanks, that was quick :)

    Ah, sorry, I was thinking in terms of C - I can see its POSIX functionality which explains why it looks standard to me.

    I have updated my notes on isdigit, thanks.

     
  • Neil Hodgson
    Neil Hodgson
    2013-08-31

    • status: open --> closed
    • assigned_to: Neil Hodgson
     
  • Matthew Brush
    Matthew Brush
    2013-11-21

    I think this is wrong in Scintilla.iface:

    lex KVIrc=SCLEX_KVIRC SCLEX_KVIRC_
    

    Otherwise the styles can't be matched by prefix. I think it should be:

    lex KVIrc=SCLEX_KVIRC SCE_KVIRC_
    
     
    • Neil Hodgson
      Neil Hodgson
      2013-11-21

      This was recently fixed by [2d9376].

       

      Related

      Commit: [2d9376]

  • Omega Weapon
    Omega Weapon
    2013-11-28

    Cheers.