Tutorial: creating new lexer

All questions regarding lexer highlighting schemes are discussed here...
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Tutorial: creating new lexer

Post by Alexey »

Tutorials are in the [CudaText]/readme folder as ODT files.
(OpenOffice or Windows 7 WordPad).

LexerConfig.odt
TutorialLexer1.odt
TutorialLexer2.odt
TutorialLexer3.odt
TutorialLexer4.odt
TutorialLexerLig.odt
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Post by Stefan »

Whoa, this project is getting under way in true Alex-speed. Good, I am with you guys. How does this work out, format-wise, what am I supposed to do? Never been to any of these sharing portals google what-not platforms. Do we wait for Alex to post something there and then comment on it? Re-phrase it? Carry out little tasks and upload our screenshots?
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Post by Stefan »

Well done, Alex. :)
Right choice to use the tutorial format - it's better suited for complex things like lexers, making sure we're synced to the same actual settings.

Had to cope with some minor confusion, but overall I got a good kick-off start - thanks. For me it was important to see the connecting chain from RegEx via Parsers to Tokens. Finally I understand why I need tokens in the first place.

Seems like RegEx is really a central linchpin in this whole lexer concept. Need to boost my RegEx skills - and will translate the RegEx help topic along the way. And also the tutorial ...

Looking forward to the next episode.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Thank. The next one may be about "Rules" tab. thing i missed yet. maybe later- about "Grammar"
Shadeclan
Posts: 12
Joined: 04.06.2013 12:35

Post by Shadeclan »

Can you explain to me what exactly is a token? Is it a type of language construct? Can I define different language constructs, such as variables, operators, logic syntax, etc as tokens?

What is the purpose of tokens? Is it to make parsing easier somehow?
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Token is a minimal parsed element. E.g. dot, comma, equal, word, number, complex symbol like := or ==.

Ye, define as much of em as u wish. but too much of em will slow down lexer ...
Shadeclan
Posts: 12
Joined: 04.06.2013 12:35

Post by Shadeclan »

I tried to create a style in the style tab but it doesn't let me change the name of the style - it just says "style 1". Do I have to change the name of the style somewhere else?
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Use an edit field below the styles listbox
Shadeclan
Posts: 12
Joined: 04.06.2013 12:35

Post by Shadeclan »

Found it! It was a bit subtle, though. The borders of the text box are difficult to see and it is positioned between the list and a blank area underneath the list. An unfortunate positioning - the eye tends to skip over it.

You might want to move the text box to the top of the list and enhance the borders or do away with it completely and allow editing directly in the list.
Stefan
Posts: 112
Joined: 06.10.2012 15:06

Post by Stefan »

Shadeclan wrote: An unfortunate positioning - the eye tends to skip over it.
I agree. Had the same problem, took me a few attempts to figure it out.

I also think the focus should stay in the list or edit-box when pressing Enter, and not trigger the overall OK button at the bottom.
Locked