Beginner's Tutorial for Lexing and Folding

517 views
Skip to first unread message

Andreas Tscharner

unread,
Feb 16, 2014, 12:15:29 PM2/16/14
to scintilla...@googlegroups.com
Hello World,

When I started using Scintilla I had a very hard time to figure out how
to implement a lexer for a new language. To make things easier for other
beginners I've written a little tutorial.

But English is not my native language. I suppose I have quite a few
funny (completely wrong) sentences in the tutorial. So I'd really
appreciate it if you could read it and send me some feedback (e-mail,
patches, open a new issue in the tracker, ...).

Once its quality is acceptable I'll ask Neil if he could link it from
the Scintilla documentation page.

https://bitbucket.org/StarFire/scintilla-doc/downloads/Scintilla-var'aq-Tutorial.pdf
https://bitbucket.org/StarFire/scintilla-doc/downloads

Thank you very much!
Andreas
--
Andreas Tscharner sterne...@gmail.com
------------------------------------------------------------------------
Der entscheidende Vorteil eines Chats gegenueber einem normalen Telefon-
anruf ist der, dass ersterer langsamer geht und mehr kostet (fuer den
lebenswichtigen Austausch von Informationen wie "hya folks", "C U
l8er" und ":-)") ... Aus Murphy's Computergesetzen

Neil Hodgson

unread,
Feb 16, 2014, 4:54:23 PM2/16/14
to Scintilla mailing list
Since you are only implementing ILexer and not ILexerWithSubStyles, the Version method should return lvOriginal. If you return 1, this is interpreted as lvSubStyles so Scintilla may call methods not in ILexer and crash.

Neil

Andreas Tscharner

unread,
Feb 17, 2014, 5:10:12 PM2/17/14
to scintilla...@googlegroups.com
Thank you Neil, I've corrected this mistake and uploaded an updated
version of the tutorial.

I am quite sure there is still more to fix in the tutorial...

https://bitbucket.org/StarFire/scintilla-doc/downloads

TIA and best regards

Neil Hodgson

unread,
Feb 17, 2014, 8:32:01 PM2/17/14
to Scintilla mailing list
Andreas Tscharner:

> Thank you Neil, I've corrected this mistake and uploaded an updated version of the tutorial.

Committed some more explanation for the Version method to Hg.

Neil

Neil Hodgson

unread,
Feb 21, 2014, 7:47:51 PM2/21/14
to Scintilla mailing list
I couldn’t find an easy way to download the lexer code. Copying it from the PDF munges line ends and adds page numbers so is difficult to examine.

Neil

Andreas Tscharner

unread,
Feb 24, 2014, 5:17:24 PM2/24/14
to scintilla...@googlegroups.com
Hello Neil,
I have uploaded the lexer code next to the tutorial PDF:

https://bitbucket.org/StarFire/scintilla-doc/downloads

Best regards

Chris Gillard

unread,
Feb 27, 2014, 7:01:54 AM2/27/14
to scintilla...@googlegroups.com
Hi Andreas,

Your document is very good timing for me and has saved me hours of reading, quessing and 'trial and error' coding.

I have written a more complete thank you in my 'Beginner' thread just above this one.

I may have future questions for you I'm afraid but I will try not to make it too many.

Good luck with  var'aq and the Klingons!

Thank you.

Chris
Reply all
Reply to author
Forward
0 new messages