threedslider wrote:Say us a little bit of what do you are doing it ? What is your purpose ?
Hello i try to create a web editor with manage the 4 languages HTML/PHP/CSS/JS
viewtopic.php?p=649971#p649971
threedslider wrote:Lexer used for what ?
Thanks to AZJIO

i learn that apparently FRED not need a LEXER (Surely SciLexer) at the moment of he create his ScintillaGadget
viewtopic.php?p=629667#p629667
So we must coding for parsing and recognize the keywords
Like FRED i have create my own, finish at 90%, but now i want to compare the professionnal LEXER (Now LEXILLA whom replace SciLexer) with mine, for see what is the better to use for me
One of the advantage to use a LEXER is the refresh automaticaly when you add characters or paste code
@AXOLOTL
One thousand of thanks AXOLOTL !!!
for lost your precious time for little KCC

Really... I felt a bit alone in this mess and I was starting to get depressed from trying everything without success.
Like you see, when i have try all possibility i have found nearly all the same value of constants
Code: Select all
#SCI_PB_STYLE_CRLF = 0
#SCI_PB_STYLE_COMMENT = 1
#SCI_PB_STYLE_NUMBER = 2
#SCI_PB_STYLE_STRING = 4
#SCI_PB_STYLE_NOTFOUND1 = 5
#SCI_PB_STYLE_SPACE = 6
#SCI_PB_STYLE_TEXT = 7
#SCI_PB_STYLE_CONSTANT = 13
#SCI_PB_STYLE_DOLLAR = 17
#SCI_PB_STYLE_EMPTY_CHARAC = 32
But thanks to you, i can now bolding the keywords, and create EXACTELY the same coloring syntax like PB, and understand how that works
It's really not simple to understand the rules of SCINTILLA and his LEXER
Code: Select all
; https://www.purebasic.fr/english/viewtopic.php?p=616117#p616117
Prototype.i CreateLexerProto(name.p-utf8)
Prototype.i GetLexerCountProto()
Prototype GetLexerNameProto(index.i, *BufferName, *BufferNameLength)
; extracted from https://github.com/ScintillaOrg/lexilla/blob/master/include/LexicalStyles.iface
; # Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC
;
#SCE_B_DEFAULT = 0
#SCE_B_COMMENT = 1
#SCE_B_NUMBER = 2
#SCE_B_KEYWORD = 3
#SCE_B_STRING = 4
#SCE_B_PREPROCESSOR = 5
#SCE_B_OPERATOR = 6
#SCE_B_IDENTIFIER = 7
#SCE_B_DATE = 8
#SCE_B_STRINGEOL = 9
#SCE_B_KEYWORD2 = 10
#SCE_B_KEYWORD3 = 11
#SCE_B_KEYWORD4 = 12
#SCE_B_CONSTANT = 13
#SCE_B_ASM = 14
#SCE_B_LABEL = 15
#SCE_B_ERROR = 16
#SCE_B_HEXNUMBER = 17
#SCE_B_BINNUMBER = 18
#SCE_B_COMMENTBLOCK = 19
#SCE_B_DOCLINE = 20
#SCE_B_DOCBLOCK = 21
#SCE_B_DOCKEYWORD = 22
Procedure ForTestTheLookOFPROCEDURE(KccParam.s)
EndProcedure
If OpenLibrary(0, "Lexilla.dll")
CreateLexer.CreateLexerProto = GetFunction(0, "CreateLexer")
GetLexerCount.GetLexerCountProto = GetFunction(0, "GetLexerCount")
GetLexerName.GetLexerNameProto = GetFunction(0, "GetLexerName")
If CreateLexer = 0 Or GetLexerCount = 0 Or GetLexerName = 0
Debug "Invalid Lexilla lib"
End
EndIf
EndIf
If OpenWindow(0, 0, 0, 1000, 700, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ScintillaGadget(0, 10, 10, 980, 690, 0)
CreateLexer.CreateLexerProto = GetFunction(0, "CreateLexer")
GetLexerCount.GetLexerCountProto = GetFunction(0, "GetLexerCount")
GetLexerName.GetLexerNameProto = GetFunction(0, "GetLexerName")
PureBasicLexer = CreateLexer("purebasic")
ScintillaSendMessage(0, #SCI_SETILEXER, 0, PureBasicLexer)
*PtrPolice = UTF8("Consolas")
ScintillaSendMessage(SciID, #SCI_STYLESETFONT, #STYLE_DEFAULT, *PtrPolice)
FreeMemory(*PtrPolice)
ScintillaSendMessage(0, #SCI_STYLESETFORE, #STYLE_DEFAULT, 0)
ScintillaSendMessage(0, #SCI_STYLESETSIZE, #STYLE_DEFAULT, 11)
ScintillaSendMessage(0, #SCI_STYLESETBACK, #STYLE_DEFAULT, RGB(255, 255, 223))
ScintillaSendMessage(0, #SCI_STYLECLEARALL)
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_DEFAULT , #Black) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_COMMENT , RGB(0, 170, 170)) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_NUMBER , #Black) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_KEYWORD , RGB(0, 0, 255)) ;
ScintillaSendMessage(0, #SCI_STYLESETBOLD, #SCE_B_KEYWORD , #True)
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_STRING , #Black) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_PREPROCESSOR , $F78865);
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_OPERATOR , #Black) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_IDENTIFIER , RGB(0, 0, 255)) ; <= all text is using this color
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_DATE , $71AE71) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_STRINGEOL , $DE98D9) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_KEYWORD2 , $00FFFF) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_KEYWORD3 , $8080FF) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_KEYWORD4 , $D3D08C) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_CONSTANT , RGB(146, 74, 113)) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_ASM , RGB(146, 74, 113)) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_LABEL , #Black) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_ERROR , #Black) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_HEXNUMBER , #Red) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_BINNUMBER , #Red) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_COMMENTBLOCK , #Red) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_DOCLINE , #Red) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_DOCBLOCK , #Red) ;
ScintillaSendMessage(0, #SCI_STYLESETFORE, #SCE_B_DOCKEYWORD , #Red) ;
; lower characters are important
Global Keyword$ = "structure endstructure procedure endprocedure " +
"if endif for next " +
"repeat until " +
"global protected " +
""
*PtrKWords = UTF8(Keyword$)
ScintillaSendMessage(0, #SCI_SETKEYWORDS, 0, *PtrKWords) ; <= only 0 is working
FreeMemory(*PtrKWords)
Delay(100)
Canal = ReadFile(#PB_Any, #PB_Compiler_File, #PB_UTF8)
If Canal
TailleFichier = Lof(Canal)
*Ptr = AllocateMemory(TailleFichier)
ReadData(Canal, *Ptr, TailleFichier)
CloseFile(Canal)
ScintillaSendMessage(SciID, #SCI_SETTEXT, 0, *Ptr)
FreeMemory(*Ptr)
Else
MessageRequester("Erreur fichier", "Le fichier" + #CRLF$ + #PB_Compiler_File + #CRLF$ + "n'a pu être ouvert.")
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
I see when even a litte problem
The $ character is RED because even if it is at the end, it is considerate like #SCE_B_HEXNUMBER
It's right in PB, at the begining it's a #SCE_B_HEXNUMBER but at the end it's a variable
Believe you there are a way for explain that to the LEXER ?
Axoloti wrote:BTW: Your DLL is probably x86.
Yes the DLL is X86