GoScintilla - 2.7 (Purebasic 4.5 onwards)

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by eddy »

a little suggestion (see above) : Append Text / Prepend Text
Added functions : GOSCI_DecFoldLevel(id) and GOSCI_IncFoldLevel(id) to be used within a user-defined line styling function only.
Thx

The custom styling function works great :mrgreen:. I made a custom PB styler based on Syntilla Regex.
The code is simplier but it runs probably a little bit slower.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by srod »

Yes I considered using Scintilla's regex's but decided that it would probably be too slow. :)
I may look like a mule, but I'm not a complete ass.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by Mistrel »

I thought regular expressions were supposed to be fast? :?
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by eddy »

Mistrel wrote:I thought regular expressions were supposed to be fast? :?
REGEXs are optimized
but my lexer algorythm is not.

The difference will be visible after loading a large file
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by eddy »

many regexs

Code: Select all

CreateStylingRules("PB")
AddStylingRule(#STYLE_DEFAULT, "[ \t]+")
If AddStylingRule(#STYLES_COMMENTS, "[;][^\r\n]*")
   AddStylingFolder(1, ";{[^\r\n]*")
   AddStylingFolder(0, ";}[^\r\n]*")
EndIf
AddStylingRule(#STYLES_NUMBERS, "[\d][\d.]*")
AddStylingRule(#STYLES_NUMBERS, "[.][\d]+")
AddStylingRule(#STYLES_NUMBERS, "['][^']*[']?")
AddStylingRule(#STYLES_NUMBERS, "[$][\dA-F]*")
AddStylingRule(#STYLES_NUMBERS, "[%][0-1]+")
AddStylingRule(#STYLES_CONSTANTS, "[#][\w\d]*[$]?")
If AddStylingRule(#STYLES_STRUCTURES, "[\\][\s]*[\w\d]+[$]?")
   AddStylingLeftPart("[\\][\s]*", #STYLES_SEPARATORS)
EndIf
If AddStylingRule(#STYLES_STRUCTURES, "[.][\s]*[\w][\w\d]*")
   AddStylingLeftPart("[.][\s]*", #STYLES_SEPARATORS)
   AddStylingException(0, "[abcdfilqsuw]", #STYLES_NORMAL)
EndIf
If AddStylingRule(#STYLES_POINTERS, "([@][*]?|[*])([\w][\w\d]*[$]?)?");
   AddStylingException(-1, "[\[{(,:\-=+*<>/%&|]*[\s]*")
EndIf
AddStylingRule(#STYLES_OPERATORS, "[\-=+*<>/%&|][\s]*")
AddStylingRule(#STYLES_SEPARATORS, "[(),:.\[\]{}\\]+[\s]*")
If AddStylingRule(#STYLE_DEFAULT, "[\w][\w\d]*[$]?")
   AddStylingException(1, "[\s]*([.][\s]*[\w]+[\s]*)?[(]", #STYLES_FUNCTIONS)
   AddStylingException(0, "(?i)(debug|procedurereturn|procedure[$]?|endprocedure|end|endif|if|dim|protected|endmacro|macro)", #STYLES_KEYWORDS)
   AddStylingFolder(1,"(?i)(procedure[$]?|macro)")
   AddStylingFolder(0,"(?i)(endprocedure|endmacro)")
EndIf
AddStylingRule(#STYLES_STRINGS, "[\x22][^\x22]*[\x22]?")
AddStylingRule(#STYLES_NORMAL, "[^ \t(),:.\[\]{}\\\-=+*<>/%&|#\x22']+")
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: GoScintilla - 1.0 beta 2 (PB 4.4 only)

Post by eddy »

Regex has a good performance.
But the main problem is its complexity (for a beginner)
ts-soft wrote: 2. case correction
I found a way to do it but there's a remaining problem (cursor jump)
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by eddy »

:arrow: GoScintilla with Regex styling engine : http://www.datafilehost.com/download-109801d9.html
- folding
- autocase
- complete sample of PB styling
- many regex

It's a mod of GoScintilla beta4:
- added : GOSCI_GetCharAdded()
- modified : GOSCI_ScintillaCallBackXXX()

Image
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by srod »

Eddy, please start a new thread for your new version of GoScintilla. I shall be sticking with my version at the moment because it suits my purposes and may add your modifications at some later time, when I have time to take a look. I have no internet connection at this time (am having to borrow one) and will be without internet for some time now by the looks of it.
I may look like a mule, but I'm not a complete ass.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by eddy »

srod wrote:Eddy, please start a new thread for your new version of GoScintilla. I shall be sticking with my version at the moment because it suits my purposes and may add your modifications at some later time, when I have time to take a look. I have no internet connection at this time (am having to borrow one) and will be without internet for some time now by the looks of it.
I see. Ok
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by srod »

Now that I have had a look Eddy, your ammendments really do belong in a different library than GoScintilla as it is so heavily dependent on RegExs etc. to the extent that you are using your own Lexer etc. It all looks very sophisticated (I know very little about RegEx's! :) )

What I would suggest is that rather than try and work this into GoScintilla that you instead create a kind of 'add-on' which will need its own documentation. Throwing this in with GoScintilla makes things very confusing as it is not immediately clear which bits belong to which etc. and nor is it clear how exactly we use your code?

Consider an 'add-on' module which can be bolted into GoScintilla as a separate entity. Provide some docs and some commented demos and I think it will be a great addition. Personally, I shall stick with not using RegEx's because I don't like 'em very much; I cannot imagine that they are very fast. Between us, we'd give people the choice of which kind of Lexer to use etc.

What do you think?
I may look like a mule, but I'm not a complete ass.
User avatar
eddy
Addict
Addict
Posts: 1479
Joined: Mon May 26, 2003 3:07 pm
Location: Nantes

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by eddy »

You're right.
Regex is powerful but its syntax is awful sometimes :mrgreen:
So I'll be probably start a sub-version fork.
Imagewin10 x64 5.72 | IDE | PB plugin | Tools | Sprite | JSON | visual tool
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by ts-soft »

Bugreport on Linux :wink:

After changing all #White, #Red and so on to real colors comes a Error in GoScintilla.pbi
at line 1251 - 'Character$' length to Trim() has to be one.

Code: Select all

keyWord$ = Trim(keyWord$)
?

Tested on ubuntu x86 and x64 with the same result.

greetings
Thomas
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by srod »

Sorry Thomas but I do not understand that error?
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by ts-soft »

srod wrote:Sorry Thomas but I do not understand that error?
alike, i think this is a bug on the linux-version but can only reproduce with your large code :shock:

as workaround i have removed this line.

greetings
Thomas
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Re: GoScintilla - 1.0 beta 4 (PB 4.4 only)

Post by Justin »

This tool is really great, thanks srod for posting it.

I had to modify it with my own hash table instead of the PB Map functions, they are useless to me since they are not dynamic. Same as lists.

Now my question, in the BlockCommentStyler example how to recognice single line comments also? in the form:

// commented line

i'm a bit lost. thanks.
Post Reply