Page 1 of 1

Pascal lexer

Posted: 29.02.2020 13:03
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!

Posted: 29.02.2020 13:56
by Alexey
& is already supported, it is NOT operator, it is escape symbol so &while is normal name, not keyword.

Posted: 29.02.2020 14:20
by Alexey
added all those words, lexer updated. Pls test. Thanks

Posted: 01.03.2020 15:09
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!

Posted: 01.03.2020 15:19
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.

Posted: 01.03.2020 15:29
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.

Posted: 01.03.2020 16:19
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"

Posted: 01.03.2020 16:44
by Alexey
it is 'parser rule' in lexer, which finds all strange symbols and gives them red-underline. it finds & after rule for '&\w+'.

Posted: 01.03.2020 16:46
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

Posted: 21.08.2020 15:53
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