Lexer PureBasic

All questions regarding lexer highlighting schemes are discussed here...
skarsgal
Posts: 17
Joined: 18.12.2022 17:27

Lexer PureBasic

Post by skarsgal »

Hi Alexey,
I ask you to create the lexer for PureBasic (a very powerful and advanced basic language).
I have found the source of this syntax highlighting on Andrè Simon's website:

Details:
- website: http://andre-simon.de/
- download area: http://andre-simon.de/zip/download.php
- download archive 'highlight-4.14-x64.zip': http://andre-simon.de/zip/highlight-4.14-x64.zip (copy this link in your browser and confirm)
- in this archive browse inside directory: 'langDefs'
- extract the file: purebasic.lang (ascii)

This syntax highlighting (created by Tristano Ajmone) is for PureBasic v5.00 -- 5.61, while the current version of Purebasic is 6.12.0 of 18/09/2024.

Do You can create a lexer for PureBasic?
Thanks
Attachments
purebasic_lang.zip
(5.2 KiB) Downloaded 7 times
main Alexey
Posts: 2288
Joined: 25.08.2021 18:15

Re: Lexer PureBasic

Post by main Alexey »

Before I do, I am interested - how popular is it? ie how many users, how many projects on language?
(e.g. FreePascal - many users, and many small projects, and big forum)

And 2nd: give me 1-2 sample source code repos with some projects, so I can test lexer.
skarsgal
Posts: 17
Joined: 18.12.2022 17:27

Re: Lexer PureBasic

Post by skarsgal »

main Alexey wrote: 29.12.2024 20:24 Before I do, I am interested - how popular is it? ie how many users, how many projects on language?
(e.g. FreePascal - many users, and many small projects, and big forum)
Unfortunately it is not very widespread even though it is a programming language that has been in development for 20 years.
The reason is that the compiler is a paid program that costs € 79.00.
A very important resource is the forum, where you can find an answer to (almost) every question.
1. PureBasic Forum: https://www.purebasic.fr/english/
2. Forum total members: n. 6,461
3. Forum total posts: n. 576,233
main Alexey wrote: 29.12.2024 20:24 And 2nd: give me 1-2 sample source code repos with some projects, so I can test lexer.
--> go to GitHub and search for 'PureBasic Topics': https://github.com/topics/purebasic
a. fantaisie-software/purebasic: https://github.com/fantaisie-software/purebasic
--> PureBasic OpenSource Projects -> download a zip archive https://github.com/tajmone/purebasic/archive/master.zip
b. fantaisie-software/awesome-purebasic: https://github.com/fantaisie-software/awesome-purebasic
--> pbsamples: https://github.com/deseven/pbsamples/ar ... master.zip
--> small-PureBasic-projects: https://github.com/codeprof/small-PureB ... master.zip
c. tajmone/doxter: https://github.com/tajmone/doxter
--> doxter: https://github.com/tajmone/doxter/archi ... master.zip
d. diStorm Disassembler for PureBasic: https://github.com/ToniPB/distorm-PB
--> Disassembler: https://github.com/ToniPB/distorm-PB/ar ... master.zip
e. SicroAtGit/PB-CodeArchiv-Rebirth: https://github.com/SicroAtGit/PB-CodeArchiv-Rebirth
--> CodeArchiv-Rebirth: https://github.com/SicroAtGit/PB-CodeAr ... master.zip
f. Dadido3/D3hex: https://github.com/Dadido3/D3hex
--> D3hex: https://github.com/Dadido3/D3hex/archiv ... master.zip
g. tajmone/name-that-color: https://github.com/tajmone/name-that-color
--> name-that-color: https://github.com/tajmone/name-that-co ... master.zip
h. i2pdf - image to pdf: https://www.purebasic.fr/english/viewtopic.php?t=36984
--> i2pdf download: http://luis.no-ip.net/i2pdf/i2pdf.zip (copy this link in your browser and confirm)
--> after download look for subfolder 'src' and extract it
--> (see this program on Portable Freeware: https://www.portablefreeware.com/index.php?q=i2pdf&m=)

Note_1
this samples have 1 or 2 ascii files:
- .pb (PurerBasic)
- .pbi (PureBasic Include) it is a file called by .pb (It is an optional file)

Note_2
if you wish, you can download the Demo version of the compiler:
- fully functional
- compilation limited to about 1,000 lines of code
download link: https://www.purebasic.com/download/Pure ... mo_x64.exe
--> this installer is compiled with Inno Setup v6.1.0
--> extract with InnoUnpacker by Jürgen Rathlev https://www.rathlev-home.de/index-e.htm ... tml#unpack
--> the compiler is Portable via command line flag
Attachments
PureBasic_Portable_launchers_x32-x64.zip
(101.53 KiB) Downloaded 5 times
PureBasic - command-line options.zip
(1.34 KiB) Downloaded 4 times
i2pdf_src.zip
(55.76 KiB) Downloaded 5 times
main Alexey
Posts: 2288
Joined: 25.08.2021 18:15

Re: Lexer PureBasic

Post by main Alexey »

it is not widespread, and SublimeText syntax file has only 350 downloads.
https://packagecontrol.io/packages/PureBasic
(for popular langs, Sublime files have 3K+ downloads.)
can you read lexer tutorials
https://github.com/Alexey-T/CudaText/tr ... /tutorials
and construct lexer from scratch, please?
Last edited by main Alexey on 31.12.2024 17:14, edited 1 time in total.
main Alexey
Posts: 2288
Joined: 25.08.2021 18:15

Re: Lexer PureBasic

Post by main Alexey »

wait, I can build the _base of lexer_ (unfinished lexer). then we will see how to continue.
main Alexey
Posts: 2288
Joined: 25.08.2021 18:15

Re: Lexer PureBasic

Post by main Alexey »

draft version is made.
https://github.com/Alexey-T/CudaText-le ... /PureBasic
copy these files (except INF file) into subfolder data/lexlib near other LCF files.

I did not read docs yet. so many issues are possible. let's test and find them all. I can continue this work.

- keywords were found by my reading of sample projects. I don't know the full list of keywords, check them.
- symbol $ - how to highlight it? as part of previous token? e.g. here: #AB$, Ab$.
- I added only blocks folding found in samples. check all possible blocks foldings.
skarsgal
Posts: 17
Joined: 18.12.2022 17:27

Re: Lexer PureBasic

Post by skarsgal »

main Alexey wrote: 31.12.2024 15:22 it is not widespread, and SublimeText syntax file has only 350 downloads.
https://packagecontrol.io/packages/PureBasic
(for popular langs, Sublime files have 3K+ downloads.)
It is possible 'translate' the lexer PureBasic from Sublime Text repository ?
main Alexey wrote: 31.12.2024 17:13 draft version is made.
https://github.com/Alexey-T/CudaText-le ... /PureBasic
copy these files (except INF file) into subfolder data/lexlib near other LCF files.
Thanks
main Alexey wrote: 31.12.2024 17:13 - keywords were found by my reading of sample projects. I don't know the full list of keywords, check them.
There is an online resource:
see on Pure Basic Reference Manual at https://www.purebasic.com/documentation/
There are two paragraph:
- Basic Keywords
- Advanced Keyworks
with all keywords and usage samples
main Alexey wrote: 31.12.2024 17:13 - symbol $ - how to highlight it? as part of previous token? e.g. here: #AB$, Ab$.
See on : Pure Basic Reference Manual --> General Syntax Rules at https://www.purebasic.com/documentation ... rules.html
main Alexey wrote: 31.12.2024 17:13 - I added only blocks folding found in samples. check all possible blocks, which are not folded.
I'm sorry, I don't know how to do it.
main Alexey
Posts: 2288
Joined: 25.08.2021 18:15

Re: Lexer PureBasic

Post by main Alexey »

I updated lexer on the same URL. added all keywords (also from Sublime syntax file). fixed ~-strings. fixed $ as last char of names. added float numbers like 1.2e-3.
main Alexey
Posts: 2288
Joined: 25.08.2021 18:15

Re: Lexer PureBasic

Post by main Alexey »

updated again. added highlight of labels (Name: but not Name::Name). added folding for 'DataSection'.
skarsgal
Posts: 17
Joined: 18.12.2022 17:27

Re: Lexer PureBasic

Post by skarsgal »

main Alexey wrote: 31.12.2024 20:36 updated again. added highlight of labels (Name: but not Name::Name). added folding for 'DataSection'.
Thank a lot for this PureBasic lexer. :D

b.t.w.
PureBasic documentation links:
1. PureBasic Reference Manual v6.00
-> url: https://www.purebasic.com/documentation/PureBasic.pdf --> (copy this link in your browser and confirm)
2. PureBasic Reference Manual v6.12 (small, without library descriptions)
-> url: https://www.purebasic.com/documentation ... cSmall.pdf
3. PureBasic - A Beginner’s Guide To Computer Programming
-> url: http://purearea.net/pb/download/PureBasicBook.pdf
4. PureBasic - Books & Tutorials
-> url: http://purearea.net/pb/english/tutorials.htm
5. PureBasic UserGuide - Overview
-> url: https://www.purebasic.com/documentation ... rview.html
Post Reply