|
|
|
@ -46,11 +46,11 @@ TextEditor::TextEditor()
|
|
|
|
|
, mHandleKeyboardInputs(true)
|
|
|
|
|
, mHandleMouseInputs(true)
|
|
|
|
|
, mIgnoreImGuiChild(false)
|
|
|
|
|
, mShowWhitespaces(true)
|
|
|
|
|
, mShowWhitespaces(false)
|
|
|
|
|
, mStartTime(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())
|
|
|
|
|
{
|
|
|
|
|
SetPalette(GetDarkPalette());
|
|
|
|
|
SetLanguageDefinition(LanguageDefinition::HLSL());
|
|
|
|
|
SetLanguageDefinition(LanguageDefinition::CPlusPlus());
|
|
|
|
|
mLines.push_back(Line());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2804,357 +2804,3 @@ const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::CPlusPlus(
|
|
|
|
|
return langDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::HLSL()
|
|
|
|
|
{
|
|
|
|
|
static bool inited = false;
|
|
|
|
|
static LanguageDefinition langDef;
|
|
|
|
|
if (!inited)
|
|
|
|
|
{
|
|
|
|
|
static const char* const keywords[] = {
|
|
|
|
|
"AppendStructuredBuffer", "asm", "asm_fragment", "BlendState", "bool", "break", "Buffer", "ByteAddressBuffer", "case", "cbuffer", "centroid", "class", "column_major", "compile", "compile_fragment",
|
|
|
|
|
"CompileShader", "const", "continue", "ComputeShader", "ConsumeStructuredBuffer", "default", "DepthStencilState", "DepthStencilView", "discard", "do", "double", "DomainShader", "dword", "else",
|
|
|
|
|
"export", "extern", "false", "float", "for", "fxgroup", "GeometryShader", "groupshared", "half", "Hullshader", "if", "in", "inline", "inout", "InputPatch", "int", "interface", "line", "lineadj",
|
|
|
|
|
"linear", "LineStream", "matrix", "min16float", "min10float", "min16int", "min12int", "min16uint", "namespace", "nointerpolation", "noperspective", "NULL", "out", "OutputPatch", "packoffset",
|
|
|
|
|
"pass", "pixelfragment", "PixelShader", "point", "PointStream", "precise", "RasterizerState", "RenderTargetView", "return", "register", "row_major", "RWBuffer", "RWByteAddressBuffer", "RWStructuredBuffer",
|
|
|
|
|
"RWTexture1D", "RWTexture1DArray", "RWTexture2D", "RWTexture2DArray", "RWTexture3D", "sample", "sampler", "SamplerState", "SamplerComparisonState", "shared", "snorm", "stateblock", "stateblock_state",
|
|
|
|
|
"static", "string", "struct", "switch", "StructuredBuffer", "tbuffer", "technique", "technique10", "technique11", "texture", "Texture1D", "Texture1DArray", "Texture2D", "Texture2DArray", "Texture2DMS",
|
|
|
|
|
"Texture2DMSArray", "Texture3D", "TextureCube", "TextureCubeArray", "true", "typedef", "triangle", "triangleadj", "TriangleStream", "uint", "uniform", "unorm", "unsigned", "vector", "vertexfragment",
|
|
|
|
|
"VertexShader", "void", "volatile", "while",
|
|
|
|
|
"bool1","bool2","bool3","bool4","double1","double2","double3","double4", "float1", "float2", "float3", "float4", "int1", "int2", "int3", "int4", "in", "out", "inout",
|
|
|
|
|
"uint1", "uint2", "uint3", "uint4", "dword1", "dword2", "dword3", "dword4", "half1", "half2", "half3", "half4",
|
|
|
|
|
"float1x1","float2x1","float3x1","float4x1","float1x2","float2x2","float3x2","float4x2",
|
|
|
|
|
"float1x3","float2x3","float3x3","float4x3","float1x4","float2x4","float3x4","float4x4",
|
|
|
|
|
"half1x1","half2x1","half3x1","half4x1","half1x2","half2x2","half3x2","half4x2",
|
|
|
|
|
"half1x3","half2x3","half3x3","half4x3","half1x4","half2x4","half3x4","half4x4",
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : keywords)
|
|
|
|
|
langDef.mKeywords.insert(k);
|
|
|
|
|
|
|
|
|
|
static const char* const identifiers[] = {
|
|
|
|
|
"abort", "abs", "acos", "all", "AllMemoryBarrier", "AllMemoryBarrierWithGroupSync", "any", "asdouble", "asfloat", "asin", "asint", "asint", "asuint",
|
|
|
|
|
"asuint", "atan", "atan2", "ceil", "CheckAccessFullyMapped", "clamp", "clip", "cos", "cosh", "countbits", "cross", "D3DCOLORtoUBYTE4", "ddx",
|
|
|
|
|
"ddx_coarse", "ddx_fine", "ddy", "ddy_coarse", "ddy_fine", "degrees", "determinant", "DeviceMemoryBarrier", "DeviceMemoryBarrierWithGroupSync",
|
|
|
|
|
"distance", "dot", "dst", "errorf", "EvaluateAttributeAtCentroid", "EvaluateAttributeAtSample", "EvaluateAttributeSnapped", "exp", "exp2",
|
|
|
|
|
"f16tof32", "f32tof16", "faceforward", "firstbithigh", "firstbitlow", "floor", "fma", "fmod", "frac", "frexp", "fwidth", "GetRenderTargetSampleCount",
|
|
|
|
|
"GetRenderTargetSamplePosition", "GroupMemoryBarrier", "GroupMemoryBarrierWithGroupSync", "InterlockedAdd", "InterlockedAnd", "InterlockedCompareExchange",
|
|
|
|
|
"InterlockedCompareStore", "InterlockedExchange", "InterlockedMax", "InterlockedMin", "InterlockedOr", "InterlockedXor", "isfinite", "isinf", "isnan",
|
|
|
|
|
"ldexp", "length", "lerp", "lit", "log", "log10", "log2", "mad", "max", "min", "modf", "msad4", "mul", "noise", "normalize", "pow", "printf",
|
|
|
|
|
"Process2DQuadTessFactorsAvg", "Process2DQuadTessFactorsMax", "Process2DQuadTessFactorsMin", "ProcessIsolineTessFactors", "ProcessQuadTessFactorsAvg",
|
|
|
|
|
"ProcessQuadTessFactorsMax", "ProcessQuadTessFactorsMin", "ProcessTriTessFactorsAvg", "ProcessTriTessFactorsMax", "ProcessTriTessFactorsMin",
|
|
|
|
|
"radians", "rcp", "reflect", "refract", "reversebits", "round", "rsqrt", "saturate", "sign", "sin", "sincos", "sinh", "smoothstep", "sqrt", "step",
|
|
|
|
|
"tan", "tanh", "tex1D", "tex1D", "tex1Dbias", "tex1Dgrad", "tex1Dlod", "tex1Dproj", "tex2D", "tex2D", "tex2Dbias", "tex2Dgrad", "tex2Dlod", "tex2Dproj",
|
|
|
|
|
"tex3D", "tex3D", "tex3Dbias", "tex3Dgrad", "tex3Dlod", "tex3Dproj", "texCUBE", "texCUBE", "texCUBEbias", "texCUBEgrad", "texCUBElod", "texCUBEproj", "transpose", "trunc"
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : identifiers)
|
|
|
|
|
{
|
|
|
|
|
Identifier id;
|
|
|
|
|
id.mDeclaration = "Built-in function";
|
|
|
|
|
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[ \\t]*#[ \\t]*[a-zA-Z_]+", PaletteIndex::Preprocessor));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\'\\\\?[^\\']\\'", PaletteIndex::CharLiteral));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
|
|
|
|
|
|
|
|
|
|
langDef.mCommentStart = "/*";
|
|
|
|
|
langDef.mCommentEnd = "*/";
|
|
|
|
|
langDef.mSingleLineComment = "//";
|
|
|
|
|
|
|
|
|
|
langDef.mCaseSensitive = true;
|
|
|
|
|
langDef.mAutoIndentation = true;
|
|
|
|
|
|
|
|
|
|
langDef.mName = "HLSL";
|
|
|
|
|
|
|
|
|
|
inited = true;
|
|
|
|
|
}
|
|
|
|
|
return langDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::GLSL()
|
|
|
|
|
{
|
|
|
|
|
static bool inited = false;
|
|
|
|
|
static LanguageDefinition langDef;
|
|
|
|
|
if (!inited)
|
|
|
|
|
{
|
|
|
|
|
static const char* const keywords[] = {
|
|
|
|
|
"auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "inline", "int", "long", "register", "restrict", "return", "short",
|
|
|
|
|
"signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while", "_Alignas", "_Alignof", "_Atomic", "_Bool", "_Complex", "_Generic", "_Imaginary",
|
|
|
|
|
"_Noreturn", "_Static_assert", "_Thread_local"
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : keywords)
|
|
|
|
|
langDef.mKeywords.insert(k);
|
|
|
|
|
|
|
|
|
|
static const char* const identifiers[] = {
|
|
|
|
|
"abort", "abs", "acos", "asin", "atan", "atexit", "atof", "atoi", "atol", "ceil", "clock", "cosh", "ctime", "div", "exit", "fabs", "floor", "fmod", "getchar", "getenv", "isalnum", "isalpha", "isdigit", "isgraph",
|
|
|
|
|
"ispunct", "isspace", "isupper", "kbhit", "log10", "log2", "log", "memcmp", "modf", "pow", "putchar", "putenv", "puts", "rand", "remove", "rename", "sinh", "sqrt", "srand", "strcat", "strcmp", "strerror", "time", "tolower", "toupper"
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : identifiers)
|
|
|
|
|
{
|
|
|
|
|
Identifier id;
|
|
|
|
|
id.mDeclaration = "Built-in function";
|
|
|
|
|
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[ \\t]*#[ \\t]*[a-zA-Z_]+", PaletteIndex::Preprocessor));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\'\\\\?[^\\']\\'", PaletteIndex::CharLiteral));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
|
|
|
|
|
|
|
|
|
|
langDef.mCommentStart = "/*";
|
|
|
|
|
langDef.mCommentEnd = "*/";
|
|
|
|
|
langDef.mSingleLineComment = "//";
|
|
|
|
|
|
|
|
|
|
langDef.mCaseSensitive = true;
|
|
|
|
|
langDef.mAutoIndentation = true;
|
|
|
|
|
|
|
|
|
|
langDef.mName = "GLSL";
|
|
|
|
|
|
|
|
|
|
inited = true;
|
|
|
|
|
}
|
|
|
|
|
return langDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::C()
|
|
|
|
|
{
|
|
|
|
|
static bool inited = false;
|
|
|
|
|
static LanguageDefinition langDef;
|
|
|
|
|
if (!inited)
|
|
|
|
|
{
|
|
|
|
|
static const char* const keywords[] = {
|
|
|
|
|
"auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "inline", "int", "long", "register", "restrict", "return", "short",
|
|
|
|
|
"signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while", "_Alignas", "_Alignof", "_Atomic", "_Bool", "_Complex", "_Generic", "_Imaginary",
|
|
|
|
|
"_Noreturn", "_Static_assert", "_Thread_local"
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : keywords)
|
|
|
|
|
langDef.mKeywords.insert(k);
|
|
|
|
|
|
|
|
|
|
static const char* const identifiers[] = {
|
|
|
|
|
"abort", "abs", "acos", "asin", "atan", "atexit", "atof", "atoi", "atol", "ceil", "clock", "cosh", "ctime", "div", "exit", "fabs", "floor", "fmod", "getchar", "getenv", "isalnum", "isalpha", "isdigit", "isgraph",
|
|
|
|
|
"ispunct", "isspace", "isupper", "kbhit", "log10", "log2", "log", "memcmp", "modf", "pow", "putchar", "putenv", "puts", "rand", "remove", "rename", "sinh", "sqrt", "srand", "strcat", "strcmp", "strerror", "time", "tolower", "toupper"
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : identifiers)
|
|
|
|
|
{
|
|
|
|
|
Identifier id;
|
|
|
|
|
id.mDeclaration = "Built-in function";
|
|
|
|
|
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
langDef.mTokenize = [](const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end, PaletteIndex & paletteIndex) -> bool
|
|
|
|
|
{
|
|
|
|
|
paletteIndex = PaletteIndex::Max;
|
|
|
|
|
|
|
|
|
|
while (in_begin < in_end && isascii(*in_begin) && isblank(*in_begin))
|
|
|
|
|
in_begin++;
|
|
|
|
|
|
|
|
|
|
if (in_begin == in_end)
|
|
|
|
|
{
|
|
|
|
|
out_begin = in_end;
|
|
|
|
|
out_end = in_end;
|
|
|
|
|
paletteIndex = PaletteIndex::Default;
|
|
|
|
|
}
|
|
|
|
|
else if (TokenizeCStyleString(in_begin, in_end, out_begin, out_end))
|
|
|
|
|
paletteIndex = PaletteIndex::String;
|
|
|
|
|
else if (TokenizeCStyleCharacterLiteral(in_begin, in_end, out_begin, out_end))
|
|
|
|
|
paletteIndex = PaletteIndex::CharLiteral;
|
|
|
|
|
else if (TokenizeCStyleIdentifier(in_begin, in_end, out_begin, out_end))
|
|
|
|
|
paletteIndex = PaletteIndex::Identifier;
|
|
|
|
|
else if (TokenizeCStyleNumber(in_begin, in_end, out_begin, out_end))
|
|
|
|
|
paletteIndex = PaletteIndex::Number;
|
|
|
|
|
else if (TokenizeCStylePunctuation(in_begin, in_end, out_begin, out_end))
|
|
|
|
|
paletteIndex = PaletteIndex::Punctuation;
|
|
|
|
|
|
|
|
|
|
return paletteIndex != PaletteIndex::Max;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
langDef.mCommentStart = "/*";
|
|
|
|
|
langDef.mCommentEnd = "*/";
|
|
|
|
|
langDef.mSingleLineComment = "//";
|
|
|
|
|
|
|
|
|
|
langDef.mCaseSensitive = true;
|
|
|
|
|
langDef.mAutoIndentation = true;
|
|
|
|
|
|
|
|
|
|
langDef.mName = "C";
|
|
|
|
|
|
|
|
|
|
inited = true;
|
|
|
|
|
}
|
|
|
|
|
return langDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::SQL()
|
|
|
|
|
{
|
|
|
|
|
static bool inited = false;
|
|
|
|
|
static LanguageDefinition langDef;
|
|
|
|
|
if (!inited)
|
|
|
|
|
{
|
|
|
|
|
static const char* const keywords[] = {
|
|
|
|
|
"ADD", "EXCEPT", "PERCENT", "ALL", "EXEC", "PLAN", "ALTER", "EXECUTE", "PRECISION", "AND", "EXISTS", "PRIMARY", "ANY", "EXIT", "PRINT", "AS", "FETCH", "PROC", "ASC", "FILE", "PROCEDURE",
|
|
|
|
|
"AUTHORIZATION", "FILLFACTOR", "PUBLIC", "BACKUP", "FOR", "RAISERROR", "BEGIN", "FOREIGN", "READ", "BETWEEN", "FREETEXT", "READTEXT", "BREAK", "FREETEXTTABLE", "RECONFIGURE",
|
|
|
|
|
"BROWSE", "FROM", "REFERENCES", "BULK", "FULL", "REPLICATION", "BY", "FUNCTION", "RESTORE", "CASCADE", "GOTO", "RESTRICT", "CASE", "GRANT", "RETURN", "CHECK", "GROUP", "REVOKE",
|
|
|
|
|
"CHECKPOINT", "HAVING", "RIGHT", "CLOSE", "HOLDLOCK", "ROLLBACK", "CLUSTERED", "IDENTITY", "ROWCOUNT", "COALESCE", "IDENTITY_INSERT", "ROWGUIDCOL", "COLLATE", "IDENTITYCOL", "RULE",
|
|
|
|
|
"COLUMN", "IF", "SAVE", "COMMIT", "IN", "SCHEMA", "COMPUTE", "INDEX", "SELECT", "CONSTRAINT", "INNER", "SESSION_USER", "CONTAINS", "INSERT", "SET", "CONTAINSTABLE", "INTERSECT", "SETUSER",
|
|
|
|
|
"CONTINUE", "INTO", "SHUTDOWN", "CONVERT", "IS", "SOME", "CREATE", "JOIN", "STATISTICS", "CROSS", "KEY", "SYSTEM_USER", "CURRENT", "KILL", "TABLE", "CURRENT_DATE", "LEFT", "TEXTSIZE",
|
|
|
|
|
"CURRENT_TIME", "LIKE", "THEN", "CURRENT_TIMESTAMP", "LINENO", "TO", "CURRENT_USER", "LOAD", "TOP", "CURSOR", "NATIONAL", "TRAN", "DATABASE", "NOCHECK", "TRANSACTION",
|
|
|
|
|
"DBCC", "NONCLUSTERED", "TRIGGER", "DEALLOCATE", "NOT", "TRUNCATE", "DECLARE", "NULL", "TSEQUAL", "DEFAULT", "NULLIF", "UNION", "DELETE", "OF", "UNIQUE", "DENY", "OFF", "UPDATE",
|
|
|
|
|
"DESC", "OFFSETS", "UPDATETEXT", "DISK", "ON", "USE", "DISTINCT", "OPEN", "USER", "DISTRIBUTED", "OPENDATASOURCE", "VALUES", "DOUBLE", "OPENQUERY", "VARYING","DROP", "OPENROWSET", "VIEW",
|
|
|
|
|
"DUMMY", "OPENXML", "WAITFOR", "DUMP", "OPTION", "WHEN", "ELSE", "OR", "WHERE", "END", "ORDER", "WHILE", "ERRLVL", "OUTER", "WITH", "ESCAPE", "OVER", "WRITETEXT"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (auto& k : keywords)
|
|
|
|
|
langDef.mKeywords.insert(k);
|
|
|
|
|
|
|
|
|
|
static const char* const identifiers[] = {
|
|
|
|
|
"ABS", "ACOS", "ADD_MONTHS", "ASCII", "ASCIISTR", "ASIN", "ATAN", "ATAN2", "AVG", "BFILENAME", "BIN_TO_NUM", "BITAND", "CARDINALITY", "CASE", "CAST", "CEIL",
|
|
|
|
|
"CHARTOROWID", "CHR", "COALESCE", "COMPOSE", "CONCAT", "CONVERT", "CORR", "COS", "COSH", "COUNT", "COVAR_POP", "COVAR_SAMP", "CUME_DIST", "CURRENT_DATE",
|
|
|
|
|
"CURRENT_TIMESTAMP", "DBTIMEZONE", "DECODE", "DECOMPOSE", "DENSE_RANK", "DUMP", "EMPTY_BLOB", "EMPTY_CLOB", "EXP", "EXTRACT", "FIRST_VALUE", "FLOOR", "FROM_TZ", "GREATEST",
|
|
|
|
|
"GROUP_ID", "HEXTORAW", "INITCAP", "INSTR", "INSTR2", "INSTR4", "INSTRB", "INSTRC", "LAG", "LAST_DAY", "LAST_VALUE", "LEAD", "LEAST", "LENGTH", "LENGTH2", "LENGTH4",
|
|
|
|
|
"LENGTHB", "LENGTHC", "LISTAGG", "LN", "LNNVL", "LOCALTIMESTAMP", "LOG", "LOWER", "LPAD", "LTRIM", "MAX", "MEDIAN", "MIN", "MOD", "MONTHS_BETWEEN", "NANVL", "NCHR",
|
|
|
|
|
"NEW_TIME", "NEXT_DAY", "NTH_VALUE", "NULLIF", "NUMTODSINTERVAL", "NUMTOYMINTERVAL", "NVL", "NVL2", "POWER", "RANK", "RAWTOHEX", "REGEXP_COUNT", "REGEXP_INSTR",
|
|
|
|
|
"REGEXP_REPLACE", "REGEXP_SUBSTR", "REMAINDER", "REPLACE", "ROUND", "ROWNUM", "RPAD", "RTRIM", "SESSIONTIMEZONE", "SIGN", "SIN", "SINH",
|
|
|
|
|
"SOUNDEX", "SQRT", "STDDEV", "SUBSTR", "SUM", "SYS_CONTEXT", "SYSDATE", "SYSTIMESTAMP", "TAN", "TANH", "TO_CHAR", "TO_CLOB", "TO_DATE", "TO_DSINTERVAL", "TO_LOB",
|
|
|
|
|
"TO_MULTI_BYTE", "TO_NCLOB", "TO_NUMBER", "TO_SINGLE_BYTE", "TO_TIMESTAMP", "TO_TIMESTAMP_TZ", "TO_YMINTERVAL", "TRANSLATE", "TRIM", "TRUNC", "TZ_OFFSET", "UID", "UPPER",
|
|
|
|
|
"USER", "USERENV", "VAR_POP", "VAR_SAMP", "VARIANCE", "VSIZE "
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : identifiers)
|
|
|
|
|
{
|
|
|
|
|
Identifier id;
|
|
|
|
|
id.mDeclaration = "Built-in function";
|
|
|
|
|
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\\'[^\\\']*\\\'", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
|
|
|
|
|
|
|
|
|
|
langDef.mCommentStart = "/*";
|
|
|
|
|
langDef.mCommentEnd = "*/";
|
|
|
|
|
langDef.mSingleLineComment = "//";
|
|
|
|
|
|
|
|
|
|
langDef.mCaseSensitive = false;
|
|
|
|
|
langDef.mAutoIndentation = false;
|
|
|
|
|
|
|
|
|
|
langDef.mName = "SQL";
|
|
|
|
|
|
|
|
|
|
inited = true;
|
|
|
|
|
}
|
|
|
|
|
return langDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::AngelScript()
|
|
|
|
|
{
|
|
|
|
|
static bool inited = false;
|
|
|
|
|
static LanguageDefinition langDef;
|
|
|
|
|
if (!inited)
|
|
|
|
|
{
|
|
|
|
|
static const char* const keywords[] = {
|
|
|
|
|
"and", "abstract", "auto", "bool", "break", "case", "cast", "class", "const", "continue", "default", "do", "double", "else", "enum", "false", "final", "float", "for",
|
|
|
|
|
"from", "funcdef", "function", "get", "if", "import", "in", "inout", "int", "interface", "int8", "int16", "int32", "int64", "is", "mixin", "namespace", "not",
|
|
|
|
|
"null", "or", "out", "override", "private", "protected", "return", "set", "shared", "super", "switch", "this ", "true", "typedef", "uint", "uint8", "uint16", "uint32",
|
|
|
|
|
"uint64", "void", "while", "xor"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (auto& k : keywords)
|
|
|
|
|
langDef.mKeywords.insert(k);
|
|
|
|
|
|
|
|
|
|
static const char* const identifiers[] = {
|
|
|
|
|
"cos", "sin", "tab", "acos", "asin", "atan", "atan2", "cosh", "sinh", "tanh", "log", "log10", "pow", "sqrt", "abs", "ceil", "floor", "fraction", "closeTo", "fpFromIEEE", "fpToIEEE",
|
|
|
|
|
"complex", "opEquals", "opAddAssign", "opSubAssign", "opMulAssign", "opDivAssign", "opAdd", "opSub", "opMul", "opDiv"
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : identifiers)
|
|
|
|
|
{
|
|
|
|
|
Identifier id;
|
|
|
|
|
id.mDeclaration = "Built-in function";
|
|
|
|
|
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\'\\\\?[^\\']\\'", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
|
|
|
|
|
|
|
|
|
|
langDef.mCommentStart = "/*";
|
|
|
|
|
langDef.mCommentEnd = "*/";
|
|
|
|
|
langDef.mSingleLineComment = "//";
|
|
|
|
|
|
|
|
|
|
langDef.mCaseSensitive = true;
|
|
|
|
|
langDef.mAutoIndentation = true;
|
|
|
|
|
|
|
|
|
|
langDef.mName = "AngelScript";
|
|
|
|
|
|
|
|
|
|
inited = true;
|
|
|
|
|
}
|
|
|
|
|
return langDef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const TextEditor::LanguageDefinition& TextEditor::LanguageDefinition::Lua()
|
|
|
|
|
{
|
|
|
|
|
static bool inited = false;
|
|
|
|
|
static LanguageDefinition langDef;
|
|
|
|
|
if (!inited)
|
|
|
|
|
{
|
|
|
|
|
static const char* const keywords[] = {
|
|
|
|
|
"and", "break", "do", "", "else", "elseif", "end", "false", "for", "function", "if", "in", "", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (auto& k : keywords)
|
|
|
|
|
langDef.mKeywords.insert(k);
|
|
|
|
|
|
|
|
|
|
static const char* const identifiers[] = {
|
|
|
|
|
"assert", "collectgarbage", "dofile", "error", "getmetatable", "ipairs", "loadfile", "load", "loadstring", "next", "pairs", "pcall", "print", "rawequal", "rawlen", "rawget", "rawset",
|
|
|
|
|
"select", "setmetatable", "tonumber", "tostring", "type", "xpcall", "_G", "_VERSION","arshift", "band", "bnot", "bor", "bxor", "btest", "extract", "lrotate", "lshift", "replace",
|
|
|
|
|
"rrotate", "rshift", "create", "resume", "running", "status", "wrap", "yield", "isyieldable", "debug","getuservalue", "gethook", "getinfo", "getlocal", "getregistry", "getmetatable",
|
|
|
|
|
"getupvalue", "upvaluejoin", "upvalueid", "setuservalue", "sethook", "setlocal", "setmetatable", "setupvalue", "traceback", "close", "flush", "input", "lines", "open", "output", "popen",
|
|
|
|
|
"read", "tmpfile", "type", "write", "close", "flush", "lines", "read", "seek", "setvbuf", "write", "__gc", "__tostring", "abs", "acos", "asin", "atan", "ceil", "cos", "deg", "exp", "tointeger",
|
|
|
|
|
"floor", "fmod", "ult", "log", "max", "min", "modf", "rad", "random", "randomseed", "sin", "sqrt", "string", "tan", "type", "atan2", "cosh", "sinh", "tanh",
|
|
|
|
|
"pow", "frexp", "ldexp", "log10", "pi", "huge", "maxinteger", "mininteger", "loadlib", "searchpath", "seeall", "preload", "cpath", "path", "searchers", "loaded", "module", "require", "clock",
|
|
|
|
|
"date", "difftime", "execute", "exit", "getenv", "remove", "rename", "setlocale", "time", "tmpname", "byte", "char", "dump", "find", "format", "gmatch", "gsub", "len", "lower", "match", "rep",
|
|
|
|
|
"reverse", "sub", "upper", "pack", "packsize", "unpack", "concat", "maxn", "insert", "pack", "unpack", "remove", "move", "sort", "offset", "codepoint", "char", "len", "codes", "charpattern",
|
|
|
|
|
"coroutine", "table", "io", "os", "string", "utf8", "bit32", "math", "debug", "package"
|
|
|
|
|
};
|
|
|
|
|
for (auto& k : identifiers)
|
|
|
|
|
{
|
|
|
|
|
Identifier id;
|
|
|
|
|
id.mDeclaration = "Built-in function";
|
|
|
|
|
langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\\'[^\\\']*\\\'", PaletteIndex::String));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
|
|
|
|
|
langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
|
|
|
|
|
|
|
|
|
|
langDef.mCommentStart = "--[[";
|
|
|
|
|
langDef.mCommentEnd = "]]";
|
|
|
|
|
langDef.mSingleLineComment = "--";
|
|
|
|
|
|
|
|
|
|
langDef.mCaseSensitive = true;
|
|
|
|
|
langDef.mAutoIndentation = false;
|
|
|
|
|
|
|
|
|
|
langDef.mName = "Lua";
|
|
|
|
|
|
|
|
|
|
inited = true;
|
|
|
|
|
}
|
|
|
|
|
return langDef;
|
|
|
|
|
}
|
|
|
|
|