Pascal lexer

All questions regarding lexer highlighting schemes are discussed here...
Post Reply
ANewUser
Posts: 50
Joined: 25.01.2020 12:15

Pascal lexer

Post by ANewUser »

Hello!
I think there is only one Pascal lexer for all the variations (Delphi, Turbo Pascal, Borland Pascal, Free Pascal, RemObjects PascalScript, ...).

There are keywords, types which do not be highlighted.
The & "operator" (https://www.freepascal.org/docs-html/cu ... 5-140001.4):
procedure &while; // declaring
&while; // calling
method declaration (https://www.freepascal.org/docs-html/cu ... 980006.5.1):
message reintroduce
function modifiers (https://www.freepascal.org/docs-html/cu ... 0900014.10):
alias export interrupt iocheck local noreturn nostackframe saveregisters softfloat
number, boolean, pointer types (https://www.freepascal.org/docs-html/cu ... 5-240003.1):
Integer Shortint SmallInt Longint Longword Int64 Byte Word Cardinal QWord
Real Single Double Extended Comp Currency
Boolean Boolean8 Boolean16 Boolean32 Boolean64 ByteBool WordBool LongBool QWordBool
Pointer
character, string types (https://www.freepascal.org/docs-html/cu ... 8-310003.2):
ShortString AnsiString WideString UnicodeString
Char AnsiChar WideChar
Pchar Punicodechar
set operators (basically functions) (https://www.freepascal.org/docs-html/cu ... 400012.8.5):
include( ), exclude( )
Thank you!
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

& is already supported, it is NOT operator, it is escape symbol so &while is normal name, not keyword.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

added all those words, lexer updated. Pls test. Thanks
ANewUser
Posts: 50
Joined: 25.01.2020 12:15

Post by ANewUser »

Yes, the & symbol visible but (I prefer the visibility when one uses syntax highlighting):
https://i.imgur.com/Xrcnqy2.png
https://i.imgur.com/BpTfb6m.png
Thank you!
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

your screenshot for Pascal: yes, & highlighted with red underline if used incorrectly, and not highlighted if it's part of Id. fully Ok.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

C# lexer updated now. @ char did not make next "class" normal id, it was misfeature.
this C# IDE
https://repl.it/languages/csharp
always hilites @ as part of next id.
ANewUser
Posts: 50
Joined: 25.01.2020 12:15

Post by ANewUser »

The underlining incorrect parts feature is based on regular expressions or something else?
The search & extract is a great feature, but how can one extract only specific parts (using subexpressions)? I don't need the whole match only one or more submatches in a specific order. a silly example:

Code: Select all

the search expression: ".+(\d+).+([d-h]+)xyz"
and the extract would be: "[$2]some text[$1]\n"
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

it is 'parser rule' in lexer, which finds all strange symbols and gives them red-underline. it finds & after rule for '&\w+'.
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Extract cannot find subexpressions yet, only the whole match. but you can improve the plugin "Extract Strings"
https://github.com/CudaText-addons/cuda_extract_strings
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

Lexer Pascal is totally reworked!
Before file was 35K, now it's 23K.
- new rules for function blocks, more simple, and new lexer "states" (added NOTES text about them)
- removed Grammar
- changed token-types
- better detect symbol tokens (e.g. don't detect :=- or ++ or +@ as one token)
- removed many almost duplicate rules for block-ends
- removed several styles (for code-tree: only SynWRite did use them; for interface/implementation section)
- fixed codetree for "interface"/"object" with functions
Post Reply