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

@ -312,7 +312,7 @@ void CSyntax::Highlight(const wchar *ltext, const wchar *e, HighlightOutput& hls
name[highlight].Find(iid) >= 0 ? hl_style[INK_UPP] :
uq >= 0 ? uq < kw_macros ? hl_style[INK_UPPMACROS] :
uq < kw_logs ? hl_style[INK_UPPLOGS] :
uq < kw_sql_base ? hl_style[INK_SQLBASE] :
uq < kw_sql_base ? hl_style[INK_SQLBASE] :
uq < kw_sql_func ? hl_style[INK_SQLFUNC] :
hl_style[INK_SQLBOOL] :
IsUpperString(iid) && !macro ? hl_style[INK_UPPER] :

View file

@ -151,7 +151,7 @@ void CSyntax::InitKeywords()
"opacity",
"background-clip", "background-origin", "background-size", "border-bottom-left-radius", "border-bottom-right-radius",
"border-image", "border-image-outset", "border-image-repeat", "border-image-slice", "border-image-source",
"border-image-width", "border-radius", "border-top-left-radius", "border-top-right-radius", "box-decoration-break",
"border-image-width", "border-radius", "border-top-left-radius", "border-top-right-radius", "box-decoration-break",
"box-shadow",
"overflow-x", "overflow-y",
"align-content", "align-items", "align-self", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow",
@ -202,7 +202,7 @@ void CSyntax::InitKeywords()
};
static const char *upp_macros[] = {
"CLASSNAME", "THISBACK", "THISBACK1", "THISBACK2", "THISBACK3", "THISBACK4",
"PTEBACK", "PTEBACK1", "PTEBACK2", "PTEBACK3", "PTEBACK4",
"PTEBACK", "PTEBACK1", "PTEBACK2", "PTEBACK3", "PTEBACK4",
"QUOTE", "XASSERT", "NEVER", "XNEVER", "CHECK", "XCHECK", "ASSERT", "ASSERT_",
"NAMESPACE_UPP", "END_UPP_NAMESPACE", "NEVER_", "SKYLARK", "RPC_METHOD", "RPC_GMETHOD",
NULL
@ -212,7 +212,7 @@ void CSyntax::InitKeywords()
"LLOG", "LLOGF", "LDUMP", "LDUMPC", "LDUMPCC", "LDUMPCCC", "LDUMPM",
"DLOG", "DLOGF", "DDUMP", "DDUMPC", "DDUMPCC", "DDUMPCCC", "DDUMPM",
"RLOG", "RLOGF", "RDUMP", "RDUMPC", "RDUMPCC", "RDUMPCCC", "RDUMPM",
"LOGBEGIN", "LOGEND", "LOGBLOCK", "LOGHEXDUMP", "LOGSRCPOS",
"LOGBEGIN", "LOGEND", "LOGBLOCK", "LOGHEXDUMP", "LOGSRCPOS",
"RLOGBEGIN", "RLOGEND", "RLOGBLOCK", "RLOGHEXDUMP", "RLOGSRCPOS", "RQUOTE",
"RTIMING", "TIMING", "LTIMING", "DTIMING", "RTIMESTOP", "TIMESTOP", "LTIMESTOP", "DTIMESTOP",
"LOGHEX", "DUMPHEX", "DLOGHEX", "DDUMPHEX", "RLOGHEX", "RDUMPHEX", "LLOGHEX", "LDUMPHEX",
@ -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,12 +344,12 @@ 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++);
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
};