Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 06:46 07 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Additional Editor & Language.

Author Message
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 11:28am 20 May 2016
Copy link to clipboard 
Print this post

Hi All,

I find myself constantly using Notepad++ as a secondary editor.

Usually have the code I'm working on open in MMedit & other snippets & test code on the tabs in Notepad++.

If I select Visual Basic as the language, the formatting is close to what I see in MMedit.

Is there a keyword list for MMbasic I can download & use to define a custom language so I can configure NP++ to display the same as MMedit?

Had a look at Crimson Editor, but it reminded me I'd tried it before & then moved on to NP++.

One thing I like in NP++ is that it can open remembering all the files you previously had open.

And if you were to have say Test.bas open, then open it & make changes in MMedit,
NP++ will notify you that the file has changed since being opened & ask you if you want to refresh the tab it's displayed in.

If I can get a keyword list & define the language, it can then export it as an XML file that anyone can use.

cheers

Phil
 
redrok

Senior Member

Joined: 15/09/2014
Location: United States
Posts: 209
Posted: 11:58am 20 May 2016
Copy link to clipboard 
Print this post

Ditto everything Phil23 said except for "EditPLUS", my favorite editor.


Thanks!
redrok
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 12:07pm 20 May 2016
Copy link to clipboard 
Print this post

  redrok said   Ditto everything Phil23 said except for "EditPLUS", my favorite editor.


Thanks!
redrok


Googling EditPLUS Vs NotePad++.......

Have used MMEdit2 for the 2nd editor with multiple files open.
Great in the way it can list & collapse the subs etc, but what I miss is the notification of a file being changed & needing to be reloaded.

Cheers.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5914
Posted: 12:09pm 20 May 2016
Copy link to clipboard 
Print this post

To get a keyword list, you can copy the one from MMEdit.
It is called keywords.dat and lives in the MMEdit data folder.
You can find the data folder from 'About' in the help menu.

The lists are not complete but close.

The keywords.dat file is re-written each time you select a syntax file so there will be a number of files you need to use depending on the devices you wish to support.

I use Notepad++ also and have been playing with a plugin to send the file to your device. Still early days. I don't have a working syntax file for MMBasic.

Jim
VK7JH
MMedit   MMBasic Help
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 10:56am 09 May 2017
Copy link to clipboard 
Print this post

Been playing with this on & off for a while now.

Slowly changing the User Defined language in Notepad++.

I've got a fair bit of it working.
Not sure how current the Keyword list is.

HEX numbers were a little tricky.
I haven't added all the delimiters & operators yet as it's still WIP.

The delimiters & operators are displayed in pink, only so I can see what's happening to the text etc on either side of them, helps with defining the language.

Only have the folder set for SUBs, FUNCTIONs, & SELECT CASE at this stage.

Haven't quite worked out how to get it all working in sync once I add IF's & LOOPs.
Multi line IF's has me a bit stumped.

If anyone wants to give it a try, just import the MMbasic.xml from the zip file into the Notepad's User Defined Languages.

Cheers

Phil.

2017-05-09_205521_MMbasic.zip
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3019
Posted: 12:49pm 09 May 2017
Copy link to clipboard 
Print this post

Ok, colors--thank you.

The only thing that jumps out at me initially is that in CFunctions, some of the numbers display in red and some in black.



MMEdit does the same, but different numbers are red. This is of no consequence to me.

I use npp a lot, so thanks for this.

Lance


Edited by lizby 2017-05-10
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5914
Posted: 03:09pm 09 May 2017
Copy link to clipboard 
Print this post

  lizby said  
The only thing that jumps out at me initially is that in CFunctions, some of the numbers display in red and some in black.

That is something that is difficult to do anything about.
NPP looks at a 'word' and if it only contains numerals it is a number.
Added to that it can contain a sign '-' e for exponential and still be a number.
Depending on the lexer, HEX numbers will appear as a number but they usually need &h, 0X etc
In MMEdit, if the 'word' starts with a numeral it is treated as a number.
This means that a variable such as 1X will display as a number but X1 will display as a word.

The only way is to turn off colouring at the start of a cfunction and back on at the end.
That requires greater control of the Scintilla gadget that is doing the hard work.

Jim
VK7JH
MMedit   MMBasic Help
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 12:07am 10 May 2017
Copy link to clipboard 
Print this post

  TassyJim said  
  lizby said  
The only thing that jumps out at me initially is that in CFunctions, some of the numbers display in red and some in black.

That is something that is difficult to do anything about.
NPP looks at a 'word' and if it only contains numerals it is a number.


I think it's something to do with looking at things in 2 ways.

First NP++ looks forward in the "String", then it can look backwards at the same data to arrive at the correct decision.

I never did look at cFunctions...
But I presume the same thing might happen with font definitions.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 12:26am 10 May 2017
Copy link to clipboard 
Print this post

  lizby said   Ok, colors--thank you.

The only thing that jumps out at me initially is that in CFunctions, some of the numbers display in red and some in black.


That seems to be related to the "Prefix 2" in the numbers definition.

See in these examples, adding 0-F in this field should fix that bit.

Dunno if it will break it else where.

Phil.







 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 12:31am 10 May 2017
Copy link to clipboard 
Print this post

Not really readable above, but Prefix 2 needs:-

0 1 2 3 4 5 6 7 8 9 0 A B C D E F





In the above example I just added C & 1 after the &H for a test.

Phil
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 12:36am 10 May 2017
Copy link to clipboard 
Print this post

Updated XML file for the above change.

2017-05-10_103612_MMbasic.zip





Phil
Edited by Phil23 2017-05-11
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3019
Posted: 02:39am 10 May 2017
Copy link to clipboard 
Print this post

Looks good. Thank you.

PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 261
Posted: 10:13am 10 May 2017
Copy link to clipboard 
Print this post

Twistpad on a Windows 7 PC seems to do a good job of colorizing the MMBASIC keywords and comments.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 10:37am 11 May 2017
Copy link to clipboard 
Print this post

Does anyone understand "Parsers" well enough to be willing to have a look at getting the function list going in NP++ for the User Defined Language I've been posting?

There's an explanation on this page, about how to set it up, but I don't understand the syntax.

It also mentions that in the case of a User Defined Language, like mine above:-

[Code]if langID cannot be found above, you can set the file extensions ...

<association id="my_parser_id" ext=".my_parser_ext1" />
<association id="my_parser_id" ext=".my_parser_ext2" />

and for User Defined Languages (UDL's) use ...

<association id="my_parser_id" userDefinedLangName="My UDL Name" />[/code]

Having the Function List working would provide a huge editing advantage for MMbasic, and I presume the required Parser will only need about 3 keywords,

SUB, FUNCTION & SELECT CASE.

Cheers

Phil.
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1664
Posted: 09:04pm 11 May 2017
Copy link to clipboard 
Print this post

Really Don't understand the XML here, but getting this result...





Notice it's picking up the End Sub & End Function words....

this is the Parser I'm using, wbut it's a bit out of my depth.

[Code]<function mainExpr="((SUB|FUNCTION)).*?(?:\(|$)" displayMode="$className->$functionName"> [/code]

Can anyone tell me how to make it ignore the END SUB & END FUNCTION lines?

This is the entire functionList.xml I'm working with ('we are hacking a VB section pasted near the end).

Would be great if someone could help out in getting the last step.

Cheers

Phil.

Probably need my Language file from earlier in this thread.

2017-05-12_070330_functionList.zip

 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024