CodeEditor: PHP keywords added

git-svn-id: svn://ultimatepp.org/upp/trunk@8852 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-08-27 08:55:25 +00:00
parent 9ecb6473e2
commit f57f53269a
4 changed files with 27 additions and 9 deletions

View file

@ -304,6 +304,22 @@ void CSyntax::InitKeywords()
"alert", "eval", "toString", "valueOf", "length",
NULL
};
static const char *php[] = {
"__halt_compiler", "abstract", "and", "array", "as", "break", "callable", "case",
"catch", "class", "clone", "const", "continue", "declare", "default", "die", "do",
"echo", "else", "elseif", "empty", "enddeclare", "endfor", "endforeach", "endif",
"endswitch", "endwhile", "eval", "exit", "extends", "final", "for", "foreach",
"function", "global", "goto", "if", "implements", "include", "include_once",
"instanceof", "insteadof", "interface", "isset", "list", "namespace", "new", "or",
"print", "private", "protected", "public", "require", "require_once", "return",
"static", "switch", "throw", "trait", "try", "unset", "use", "var", "while", "xor",
NULL
};
static const char *php2[] = {
"__CLASS__", "__DIR__", "__FILE__", "__FUNCTION__", "__LINE__",
"__METHOD__", "__NAMESPACE__", "__TRAIT__",
NULL
};
LoadSyntax(cpp, upp); // Order here is important, must be the same as enum
LoadSyntax(usc, usclib);
@ -316,7 +332,8 @@ void CSyntax::InitKeywords()
LoadSyntax(cs, empty);
LoadSyntax(javascript, javascriptn);
LoadSyntax(css, cssn);
LoadSyntax(empty, empty);
LoadSyntax(empty, empty); // This is JSON - no keywords to highlights
LoadSyntax(php, php2);
kw_macros = InitUpp(upp_macros);
kw_logs = InitUpp(upp_logs);
@ -327,10 +344,10 @@ void CSyntax::InitKeywords()
int CSyntax::LoadSyntax(const char *keywords[], const char *names[]) // Changed
{
Index <String> &key = keyword.Add() ;
Index<String>& key = keyword.Add() ;
while(*keywords)
key.Add(*keywords++);
Index <String> &nam = name.Add();
Index <String>& nam = name.Add();
while(*names)
nam.Add(*names++);
return keyword.GetCount() - 1;

View file

@ -44,6 +44,7 @@ INITBLOCK
RegisterCSyntax("t", CSyntax::HIGHLIGHT_T, "*.t *.jt", "U++ translation (.t)");
RegisterCSyntax("usc", CSyntax::HIGHLIGHT_USC, "*.usc", "U++ widget definitions (.usc)");
RegisterCSyntax("calc", CSyntax::HIGHLIGHT_CALC, "", "");
RegisterCSyntax("php", CSyntax::HIGHLIGHT_PHP, "*.php", "PHP");
EditorSyntax::Register("xml", callback2(CreateTagSyntax, false, false), "*.xml *.xsd", "XML (.xml)");
EditorSyntax::Register("html", callback2(CreateTagSyntax, true, false), "*.html *.htm", "HTML (.html)");

View file

@ -66,7 +66,7 @@ public:
enum HighlightType {
HIGHLIGHT_NONE = -1, HIGHLIGHT_CPP = 0, HIGHLIGHT_USC, HIGHLIGHT_JAVA, HIGHLIGHT_T,
HIGHLIGHT_CALC, HIGHLIGHT_LAY, HIGHLIGHT_SCH, HIGHLIGHT_SQL, HIGHLIGHT_CS,
HIGHLIGHT_JAVASCRIPT, HIGHLIGHT_CSS, HIGHLIGHT_JSON,
HIGHLIGHT_JAVASCRIPT, HIGHLIGHT_CSS, HIGHLIGHT_JSON, HIGHLIGHT_PHP,
HIGHLIGHT_COUNT
};