User forums > General (but related to Code::Blocks)
PHP lexer
adam:
Ok i seem to have gotten this sorta working though there must be an internal issue with wxscintilla. I have the lexer file setup properly and everything. Here is what I've found so far.
In wxscintilla.h:
wxSCI_LEX_PHPSCRIPT 69
Default 118
Start tag 18
Matched Bracket 34
Unmatched Bracket 35
Complex variable 104
Double quote string 119
Single quote string 120
Keyword 121
Number 122
Variable 123
Comment 124
One line comment 125
String variable 126
Operator 127
In LexHTML.cxx:
static const char * const htmlWordListDesc[] = {
"HTML elements and attributes", // 0
"JavaScript keywords", // 1
"VBScript keywords", // 2
"Python keywords", // 3
"PHP keywords", // 4
"SGML and DTD keywords", // 5
0,
};
static const char * const phpscriptWordListDesc[] = {
"", //Unused 0
"", //Unused 1
"", //Unused 2
"", //Unused 3
"PHP keywords", // 4
"", //Unused // 5
0,
};
The text output that I get in cb when i load a php file is something like this
<?php
class database {
}
?>
Though the text color is still black just blue underlined. The <?php and ?> are correct in the coloring that i gave them.
So more info that could help is that when it was on wxSCI_LEX_HTML and you wrote < ?PHP with the space the underlining went away and syntax highlighting work within sets of < > as if it where an HTML tag and like normal if it wasn't within < >. Though keyword highlighting still doesn't work
sethjackson:
I've tried and tried and tried to get a PHP lexer working, but to no avail. I get the same results you did......
I'm really not sure why this happens. :P
MortenMacFly:
Hehe... I've got a PHP lexer in the backhand for some time now... still struggeling with a similar issue... ;-)
I think the reason is that some lexers in wxScintilla are based on others (e.g. vbscript is based on vb). I believe it has to do with the fact that PHP is somehow based on the HTML lexer which either needs modification or even integration of the PHP part... not sure about this.
With regards, Morten.
dmoore:
--- Quote from: MortenMacFly on November 27, 2006, 09:49:12 pm ---Hehe... I've got a PHP lexer in the backhand for some time now... still struggeling with a similar issue... ;-)
I think the reason is that some lexers in wxScintilla are based on others (e.g. vbscript is based on vb). I believe it has to do with the fact that PHP is somehow based on the HTML lexer which either needs modification or even integration of the PHP part... not sure about this.
With regards, Morten.
--- End quote ---
The php lexer appears to work just fine in SciTE. As you suspect, Morten, it appears that the php lexer depends on the HTML lexer: In SciTE, to modify php options, you have to open html properties. Perhaps the way to proceed is to extend the html lexer to incorporate php keywords and file extensions using the settings in SciTE as a reference? (NB: pasting some php into an html file in C::B also leads to the same formatting problem that adam reports - i.e. the current html lexer in C::B doesn't understand php either)
sethjackson:
--- Quote from: dmoore on November 27, 2006, 10:01:31 pm ---
--- Quote from: MortenMacFly on November 27, 2006, 09:49:12 pm ---Hehe... I've got a PHP lexer in the backhand for some time now... still struggeling with a similar issue... ;-)
I think the reason is that some lexers in wxScintilla are based on others (e.g. vbscript is based on vb). I believe it has to do with the fact that PHP is somehow based on the HTML lexer which either needs modification or even integration of the PHP part... not sure about this.
With regards, Morten.
--- End quote ---
The php lexer appears to work just fine in SciTE. As you suspect, Morten, it appears that the php lexer depends on the HTML lexer: In SciTE, to modify php options, you have to open html properties. Perhaps the way to proceed is to extend the html lexer to incorporate php keywords and file extensions using the settings in SciTE as a reference? (NB: pasting some php into an html file in C::B also leads to the same formatting problem that adam reports - i.e. the current html lexer in C::B doesn't understand php either)
--- End quote ---
Already tried adding PHP stuff to the HTML lexer. It was a no go. :P
Navigation
[0] Message Index
[#] Next page
Go to full version