PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
TextEditor::LanguageDefinition Struct Reference

#include <TextEditor.h>

Public Types

typedef std::pair< std::string, PaletteIndexTokenRegexString
 
typedef std::vector< TokenRegexStringTokenRegexStrings
 
typedef bool(* TokenizeCallback) (const char *in_begin, const char *in_end, const char *&out_begin, const char *&out_end, PaletteIndex &paletteIndex)
 

Public Member Functions

 LanguageDefinition ()
 

Static Public Member Functions

static const LanguageDefinitionCPlusPlus ()
 
static const LanguageDefinitionHLSL ()
 
static const LanguageDefinitionGLSL ()
 
static const LanguageDefinitionC ()
 
static const LanguageDefinitionSQL ()
 
static const LanguageDefinitionAngelScript ()
 
static const LanguageDefinitionLua ()
 

Public Attributes

std::string mName
 
Keywords mKeywords
 
Identifiers mIdentifiers
 
Identifiers mPreprocIdentifiers
 
std::string mCommentStart
 
std::string mCommentEnd
 
std::string mSingleLineComment
 
char mPreprocChar
 
bool mAutoIndentation
 
TokenizeCallback mTokenize
 
TokenRegexStrings mTokenRegexStrings
 
bool mCaseSensitive
 

Detailed Description

Definition at line 151 of file TextEditor.h.

Member Typedef Documentation

◆ TokenizeCallback

typedef bool(* TextEditor::LanguageDefinition::TokenizeCallback) (const char *in_begin, const char *in_end, const char *&out_begin, const char *&out_end, PaletteIndex &paletteIndex)

Definition at line 155 of file TextEditor.h.

◆ TokenRegexString

Definition at line 153 of file TextEditor.h.

◆ TokenRegexStrings

Definition at line 154 of file TextEditor.h.

Constructor & Destructor Documentation

◆ LanguageDefinition()

TextEditor::LanguageDefinition::LanguageDefinition ( )
inline

Definition at line 171 of file TextEditor.h.

Member Function Documentation

◆ AngelScript()

const TextEditor::LanguageDefinition & TextEditor::LanguageDefinition::AngelScript ( )
static

Definition at line 3057 of file TextEditor.cpp.

3058{
3059 static bool inited = false;
3060 static LanguageDefinition langDef;
3061 if (!inited)
3062 {
3063 static const char* const keywords[] = {
3064 "and", "abstract", "auto", "bool", "break", "case", "cast", "class", "const", "continue", "default", "do", "double", "else", "enum", "false", "final", "float", "for",
3065 "from", "funcdef", "function", "get", "if", "import", "in", "inout", "int", "interface", "int8", "int16", "int32", "int64", "is", "mixin", "namespace", "not",
3066 "null", "or", "out", "override", "private", "protected", "return", "set", "shared", "super", "switch", "this ", "true", "typedef", "uint", "uint8", "uint16", "uint32",
3067 "uint64", "void", "while", "xor"
3068 };
3069
3070 for (auto& k : keywords)
3071 langDef.mKeywords.insert(k);
3072
3073 static const char* const identifiers[] = {
3074 "cos", "sin", "tab", "acos", "asin", "atan", "atan2", "cosh", "sinh", "tanh", "log", "log10", "pow", "sqrt", "abs", "ceil", "floor", "fraction", "closeTo", "fpFromIEEE", "fpToIEEE",
3075 "complex", "opEquals", "opAddAssign", "opSubAssign", "opMulAssign", "opDivAssign", "opAdd", "opSub", "opMul", "opDiv"
3076 };
3077 for (auto& k : identifiers)
3078 {
3079 Identifier id;
3080 id.mDeclaration = "Built-in function";
3081 langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
3082 }
3083
3084 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
3085 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\'\\\\?[^\\']\\'", PaletteIndex::String));
3086 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
3087 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
3088 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
3089 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
3090 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
3091 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
3092
3093 langDef.mCommentStart = "/*";
3094 langDef.mCommentEnd = "*/";
3095 langDef.mSingleLineComment = "//";
3096
3097 langDef.mCaseSensitive = true;
3098 langDef.mAutoIndentation = true;
3099
3100 langDef.mName = "AngelScript";
3101
3102 inited = true;
3103 }
3104 return langDef;
3105}

References TextEditor::Identifier, mAutoIndentation, mCaseSensitive, mCommentEnd, mCommentStart, TextEditor::Identifier::mDeclaration, mIdentifiers, mKeywords, mName, mSingleLineComment, mTokenRegexStrings, TextEditor::Number, TextEditor::Punctuation, and TextEditor::String.

◆ C()

const TextEditor::LanguageDefinition & TextEditor::LanguageDefinition::C ( )
static

Definition at line 2927 of file TextEditor.cpp.

2928{
2929 static bool inited = false;
2930 static LanguageDefinition langDef;
2931 if (!inited)
2932 {
2933 static const char* const keywords[] = {
2934 "auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "inline", "int", "long", "register", "restrict", "return", "short",
2935 "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while", "_Alignas", "_Alignof", "_Atomic", "_Bool", "_Complex", "_Generic", "_Imaginary",
2936 "_Noreturn", "_Static_assert", "_Thread_local"
2937 };
2938 for (auto& k : keywords)
2939 langDef.mKeywords.insert(k);
2940
2941 static const char* const identifiers[] = {
2942 "abort", "abs", "acos", "asin", "atan", "atexit", "atof", "atoi", "atol", "ceil", "clock", "cosh", "ctime", "div", "exit", "fabs", "floor", "fmod", "getchar", "getenv", "isalnum", "isalpha", "isdigit", "isgraph",
2943 "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"
2944 };
2945 for (auto& k : identifiers)
2946 {
2947 Identifier id;
2948 id.mDeclaration = "Built-in function";
2949 langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
2950 }
2951
2952 langDef.mTokenize = [](const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end, PaletteIndex & paletteIndex) -> bool
2953 {
2954 paletteIndex = PaletteIndex::Max;
2955
2956 while (in_begin < in_end && isascii(*in_begin) && isblank(*in_begin))
2957 in_begin++;
2958
2959 if (in_begin == in_end)
2960 {
2961 out_begin = in_end;
2962 out_end = in_end;
2963 paletteIndex = PaletteIndex::Default;
2964 }
2965 else if (TokenizeCStyleString(in_begin, in_end, out_begin, out_end))
2966 paletteIndex = PaletteIndex::String;
2967 else if (TokenizeCStyleCharacterLiteral(in_begin, in_end, out_begin, out_end))
2968 paletteIndex = PaletteIndex::CharLiteral;
2969 else if (TokenizeCStyleIdentifier(in_begin, in_end, out_begin, out_end))
2970 paletteIndex = PaletteIndex::Identifier;
2971 else if (TokenizeCStyleNumber(in_begin, in_end, out_begin, out_end))
2972 paletteIndex = PaletteIndex::Number;
2973 else if (TokenizeCStylePunctuation(in_begin, in_end, out_begin, out_end))
2974 paletteIndex = PaletteIndex::Punctuation;
2975
2976 return paletteIndex != PaletteIndex::Max;
2977 };
2978
2979 langDef.mCommentStart = "/*";
2980 langDef.mCommentEnd = "*/";
2981 langDef.mSingleLineComment = "//";
2982
2983 langDef.mCaseSensitive = true;
2984 langDef.mAutoIndentation = true;
2985
2986 langDef.mName = "C";
2987
2988 inited = true;
2989 }
2990 return langDef;
2991}

References TextEditor::CharLiteral, TextEditor::Default, TextEditor::Identifier, mAutoIndentation, TextEditor::Max, mCaseSensitive, mCommentEnd, mCommentStart, TextEditor::Identifier::mDeclaration, mIdentifiers, mKeywords, mName, mSingleLineComment, mTokenize, TextEditor::Number, TextEditor::Punctuation, and TextEditor::String.

◆ CPlusPlus()

const TextEditor::LanguageDefinition & TextEditor::LanguageDefinition::CPlusPlus ( )
static

Definition at line 2737 of file TextEditor.cpp.

2738{
2739 static bool inited = false;
2740 static LanguageDefinition langDef;
2741 if (!inited)
2742 {
2743 static const char* const cppKeywords[] = {
2744 "alignas", "alignof", "and", "and_eq", "asm", "atomic_cancel", "atomic_commit", "atomic_noexcept", "auto", "bitand", "bitor", "bool", "break", "case", "catch", "char", "char16_t", "char32_t", "class",
2745 "compl", "concept", "const", "constexpr", "const_cast", "continue", "decltype", "default", "delete", "do", "double", "dynamic_cast", "else", "enum", "explicit", "export", "extern", "false", "float",
2746 "for", "friend", "goto", "if", "import", "inline", "int", "long", "module", "mutable", "namespace", "new", "noexcept", "not", "not_eq", "nullptr", "operator", "or", "or_eq", "private", "protected", "public",
2747 "register", "reinterpret_cast", "requires", "return", "short", "signed", "sizeof", "static", "static_assert", "static_cast", "struct", "switch", "synchronized", "template", "this", "thread_local",
2748 "throw", "true", "try", "typedef", "typeid", "typename", "union", "unsigned", "using", "virtual", "void", "volatile", "wchar_t", "while", "xor", "xor_eq"
2749 };
2750 for (auto& k : cppKeywords)
2751 langDef.mKeywords.insert(k);
2752
2753 static const char* const identifiers[] = {
2754 "abort", "abs", "acos", "asin", "atan", "atexit", "atof", "atoi", "atol", "ceil", "clock", "cosh", "ctime", "div", "exit", "fabs", "floor", "fmod", "getchar", "getenv", "isalnum", "isalpha", "isdigit", "isgraph",
2755 "ispunct", "isspace", "isupper", "kbhit", "log10", "log2", "log", "memcmp", "modf", "pow", "printf", "sprintf", "snprintf", "putchar", "putenv", "puts", "rand", "remove", "rename", "sinh", "sqrt", "srand", "strcat", "strcmp", "strerror", "time", "tolower", "toupper",
2756 "std", "string", "vector", "map", "unordered_map", "set", "unordered_set", "min", "max"
2757 };
2758 for (auto& k : identifiers)
2759 {
2760 Identifier id;
2761 id.mDeclaration = "Built-in function";
2762 langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
2763 }
2764
2765 langDef.mTokenize = [](const char * in_begin, const char * in_end, const char *& out_begin, const char *& out_end, PaletteIndex & paletteIndex) -> bool
2766 {
2767 paletteIndex = PaletteIndex::Max;
2768
2769 while (in_begin < in_end && isascii(*in_begin) && isblank(*in_begin))
2770 in_begin++;
2771
2772 if (in_begin == in_end)
2773 {
2774 out_begin = in_end;
2775 out_end = in_end;
2776 paletteIndex = PaletteIndex::Default;
2777 }
2778 else if (TokenizeCStyleString(in_begin, in_end, out_begin, out_end))
2779 paletteIndex = PaletteIndex::String;
2780 else if (TokenizeCStyleCharacterLiteral(in_begin, in_end, out_begin, out_end))
2781 paletteIndex = PaletteIndex::CharLiteral;
2782 else if (TokenizeCStyleIdentifier(in_begin, in_end, out_begin, out_end))
2783 paletteIndex = PaletteIndex::Identifier;
2784 else if (TokenizeCStyleNumber(in_begin, in_end, out_begin, out_end))
2785 paletteIndex = PaletteIndex::Number;
2786 else if (TokenizeCStylePunctuation(in_begin, in_end, out_begin, out_end))
2787 paletteIndex = PaletteIndex::Punctuation;
2788
2789 return paletteIndex != PaletteIndex::Max;
2790 };
2791
2792 langDef.mCommentStart = "/*";
2793 langDef.mCommentEnd = "*/";
2794 langDef.mSingleLineComment = "//";
2795
2796 langDef.mCaseSensitive = true;
2797 langDef.mAutoIndentation = true;
2798
2799 langDef.mName = "C++";
2800
2801 inited = true;
2802 }
2803 return langDef;
2804}

References TextEditor::CharLiteral, TextEditor::Default, TextEditor::Identifier, mAutoIndentation, TextEditor::Max, mCaseSensitive, mCommentEnd, mCommentStart, TextEditor::Identifier::mDeclaration, mIdentifiers, mKeywords, mName, mSingleLineComment, mTokenize, TextEditor::Number, TextEditor::Punctuation, and TextEditor::String.

◆ GLSL()

const TextEditor::LanguageDefinition & TextEditor::LanguageDefinition::GLSL ( )
static

Definition at line 2878 of file TextEditor.cpp.

2879{
2880 static bool inited = false;
2881 static LanguageDefinition langDef;
2882 if (!inited)
2883 {
2884 static const char* const keywords[] = {
2885 "auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "inline", "int", "long", "register", "restrict", "return", "short",
2886 "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while", "_Alignas", "_Alignof", "_Atomic", "_Bool", "_Complex", "_Generic", "_Imaginary",
2887 "_Noreturn", "_Static_assert", "_Thread_local"
2888 };
2889 for (auto& k : keywords)
2890 langDef.mKeywords.insert(k);
2891
2892 static const char* const identifiers[] = {
2893 "abort", "abs", "acos", "asin", "atan", "atexit", "atof", "atoi", "atol", "ceil", "clock", "cosh", "ctime", "div", "exit", "fabs", "floor", "fmod", "getchar", "getenv", "isalnum", "isalpha", "isdigit", "isgraph",
2894 "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"
2895 };
2896 for (auto& k : identifiers)
2897 {
2898 Identifier id;
2899 id.mDeclaration = "Built-in function";
2900 langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
2901 }
2902
2903 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[ \\t]*#[ \\t]*[a-zA-Z_]+", PaletteIndex::Preprocessor));
2904 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
2905 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\'\\\\?[^\\']\\'", PaletteIndex::CharLiteral));
2906 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
2907 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
2908 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
2909 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
2910 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
2911 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
2912
2913 langDef.mCommentStart = "/*";
2914 langDef.mCommentEnd = "*/";
2915 langDef.mSingleLineComment = "//";
2916
2917 langDef.mCaseSensitive = true;
2918 langDef.mAutoIndentation = true;
2919
2920 langDef.mName = "GLSL";
2921
2922 inited = true;
2923 }
2924 return langDef;
2925}

References TextEditor::CharLiteral, TextEditor::Identifier, mAutoIndentation, mCaseSensitive, mCommentEnd, mCommentStart, TextEditor::Identifier::mDeclaration, mIdentifiers, mKeywords, mName, mSingleLineComment, mTokenRegexStrings, TextEditor::Number, TextEditor::Preprocessor, TextEditor::Punctuation, and TextEditor::String.

◆ HLSL()

const TextEditor::LanguageDefinition & TextEditor::LanguageDefinition::HLSL ( )
static

Definition at line 2806 of file TextEditor.cpp.

2807{
2808 static bool inited = false;
2809 static LanguageDefinition langDef;
2810 if (!inited)
2811 {
2812 static const char* const keywords[] = {
2813 "AppendStructuredBuffer", "asm", "asm_fragment", "BlendState", "bool", "break", "Buffer", "ByteAddressBuffer", "case", "cbuffer", "centroid", "class", "column_major", "compile", "compile_fragment",
2814 "CompileShader", "const", "continue", "ComputeShader", "ConsumeStructuredBuffer", "default", "DepthStencilState", "DepthStencilView", "discard", "do", "double", "DomainShader", "dword", "else",
2815 "export", "extern", "false", "float", "for", "fxgroup", "GeometryShader", "groupshared", "half", "Hullshader", "if", "in", "inline", "inout", "InputPatch", "int", "interface", "line", "lineadj",
2816 "linear", "LineStream", "matrix", "min16float", "min10float", "min16int", "min12int", "min16uint", "namespace", "nointerpolation", "noperspective", "NULL", "out", "OutputPatch", "packoffset",
2817 "pass", "pixelfragment", "PixelShader", "point", "PointStream", "precise", "RasterizerState", "RenderTargetView", "return", "register", "row_major", "RWBuffer", "RWByteAddressBuffer", "RWStructuredBuffer",
2818 "RWTexture1D", "RWTexture1DArray", "RWTexture2D", "RWTexture2DArray", "RWTexture3D", "sample", "sampler", "SamplerState", "SamplerComparisonState", "shared", "snorm", "stateblock", "stateblock_state",
2819 "static", "string", "struct", "switch", "StructuredBuffer", "tbuffer", "technique", "technique10", "technique11", "texture", "Texture1D", "Texture1DArray", "Texture2D", "Texture2DArray", "Texture2DMS",
2820 "Texture2DMSArray", "Texture3D", "TextureCube", "TextureCubeArray", "true", "typedef", "triangle", "triangleadj", "TriangleStream", "uint", "uniform", "unorm", "unsigned", "vector", "vertexfragment",
2821 "VertexShader", "void", "volatile", "while",
2822 "bool1","bool2","bool3","bool4","double1","double2","double3","double4", "float1", "float2", "float3", "float4", "int1", "int2", "int3", "int4", "in", "out", "inout",
2823 "uint1", "uint2", "uint3", "uint4", "dword1", "dword2", "dword3", "dword4", "half1", "half2", "half3", "half4",
2824 "float1x1","float2x1","float3x1","float4x1","float1x2","float2x2","float3x2","float4x2",
2825 "float1x3","float2x3","float3x3","float4x3","float1x4","float2x4","float3x4","float4x4",
2826 "half1x1","half2x1","half3x1","half4x1","half1x2","half2x2","half3x2","half4x2",
2827 "half1x3","half2x3","half3x3","half4x3","half1x4","half2x4","half3x4","half4x4",
2828 };
2829 for (auto& k : keywords)
2830 langDef.mKeywords.insert(k);
2831
2832 static const char* const identifiers[] = {
2833 "abort", "abs", "acos", "all", "AllMemoryBarrier", "AllMemoryBarrierWithGroupSync", "any", "asdouble", "asfloat", "asin", "asint", "asint", "asuint",
2834 "asuint", "atan", "atan2", "ceil", "CheckAccessFullyMapped", "clamp", "clip", "cos", "cosh", "countbits", "cross", "D3DCOLORtoUBYTE4", "ddx",
2835 "ddx_coarse", "ddx_fine", "ddy", "ddy_coarse", "ddy_fine", "degrees", "determinant", "DeviceMemoryBarrier", "DeviceMemoryBarrierWithGroupSync",
2836 "distance", "dot", "dst", "errorf", "EvaluateAttributeAtCentroid", "EvaluateAttributeAtSample", "EvaluateAttributeSnapped", "exp", "exp2",
2837 "f16tof32", "f32tof16", "faceforward", "firstbithigh", "firstbitlow", "floor", "fma", "fmod", "frac", "frexp", "fwidth", "GetRenderTargetSampleCount",
2838 "GetRenderTargetSamplePosition", "GroupMemoryBarrier", "GroupMemoryBarrierWithGroupSync", "InterlockedAdd", "InterlockedAnd", "InterlockedCompareExchange",
2839 "InterlockedCompareStore", "InterlockedExchange", "InterlockedMax", "InterlockedMin", "InterlockedOr", "InterlockedXor", "isfinite", "isinf", "isnan",
2840 "ldexp", "length", "lerp", "lit", "log", "log10", "log2", "mad", "max", "min", "modf", "msad4", "mul", "noise", "normalize", "pow", "printf",
2841 "Process2DQuadTessFactorsAvg", "Process2DQuadTessFactorsMax", "Process2DQuadTessFactorsMin", "ProcessIsolineTessFactors", "ProcessQuadTessFactorsAvg",
2842 "ProcessQuadTessFactorsMax", "ProcessQuadTessFactorsMin", "ProcessTriTessFactorsAvg", "ProcessTriTessFactorsMax", "ProcessTriTessFactorsMin",
2843 "radians", "rcp", "reflect", "refract", "reversebits", "round", "rsqrt", "saturate", "sign", "sin", "sincos", "sinh", "smoothstep", "sqrt", "step",
2844 "tan", "tanh", "tex1D", "tex1D", "tex1Dbias", "tex1Dgrad", "tex1Dlod", "tex1Dproj", "tex2D", "tex2D", "tex2Dbias", "tex2Dgrad", "tex2Dlod", "tex2Dproj",
2845 "tex3D", "tex3D", "tex3Dbias", "tex3Dgrad", "tex3Dlod", "tex3Dproj", "texCUBE", "texCUBE", "texCUBEbias", "texCUBEgrad", "texCUBElod", "texCUBEproj", "transpose", "trunc"
2846 };
2847 for (auto& k : identifiers)
2848 {
2849 Identifier id;
2850 id.mDeclaration = "Built-in function";
2851 langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
2852 }
2853
2854 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[ \\t]*#[ \\t]*[a-zA-Z_]+", PaletteIndex::Preprocessor));
2855 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
2856 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\'\\\\?[^\\']\\'", PaletteIndex::CharLiteral));
2857 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
2858 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
2859 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
2860 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
2861 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
2862 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
2863
2864 langDef.mCommentStart = "/*";
2865 langDef.mCommentEnd = "*/";
2866 langDef.mSingleLineComment = "//";
2867
2868 langDef.mCaseSensitive = true;
2869 langDef.mAutoIndentation = true;
2870
2871 langDef.mName = "HLSL";
2872
2873 inited = true;
2874 }
2875 return langDef;
2876}

References TextEditor::CharLiteral, TextEditor::Identifier, mAutoIndentation, mCaseSensitive, mCommentEnd, mCommentStart, TextEditor::Identifier::mDeclaration, mIdentifiers, mKeywords, mName, mSingleLineComment, mTokenRegexStrings, TextEditor::Number, TextEditor::Preprocessor, TextEditor::Punctuation, and TextEditor::String.

Referenced by TextEditor::TextEditor().

◆ Lua()

const TextEditor::LanguageDefinition & TextEditor::LanguageDefinition::Lua ( )
static

Definition at line 3107 of file TextEditor.cpp.

3108{
3109 static bool inited = false;
3110 static LanguageDefinition langDef;
3111 if (!inited)
3112 {
3113 static const char* const keywords[] = {
3114 "and", "break", "do", "", "else", "elseif", "end", "false", "for", "function", "if", "in", "", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"
3115 };
3116
3117 for (auto& k : keywords)
3118 langDef.mKeywords.insert(k);
3119
3120 static const char* const identifiers[] = {
3121 "assert", "collectgarbage", "dofile", "error", "getmetatable", "ipairs", "loadfile", "load", "loadstring", "next", "pairs", "pcall", "print", "rawequal", "rawlen", "rawget", "rawset",
3122 "select", "setmetatable", "tonumber", "tostring", "type", "xpcall", "_G", "_VERSION","arshift", "band", "bnot", "bor", "bxor", "btest", "extract", "lrotate", "lshift", "replace",
3123 "rrotate", "rshift", "create", "resume", "running", "status", "wrap", "yield", "isyieldable", "debug","getuservalue", "gethook", "getinfo", "getlocal", "getregistry", "getmetatable",
3124 "getupvalue", "upvaluejoin", "upvalueid", "setuservalue", "sethook", "setlocal", "setmetatable", "setupvalue", "traceback", "close", "flush", "input", "lines", "open", "output", "popen",
3125 "read", "tmpfile", "type", "write", "close", "flush", "lines", "read", "seek", "setvbuf", "write", "__gc", "__tostring", "abs", "acos", "asin", "atan", "ceil", "cos", "deg", "exp", "tointeger",
3126 "floor", "fmod", "ult", "log", "max", "min", "modf", "rad", "random", "randomseed", "sin", "sqrt", "string", "tan", "type", "atan2", "cosh", "sinh", "tanh",
3127 "pow", "frexp", "ldexp", "log10", "pi", "huge", "maxinteger", "mininteger", "loadlib", "searchpath", "seeall", "preload", "cpath", "path", "searchers", "loaded", "module", "require", "clock",
3128 "date", "difftime", "execute", "exit", "getenv", "remove", "rename", "setlocale", "time", "tmpname", "byte", "char", "dump", "find", "format", "gmatch", "gsub", "len", "lower", "match", "rep",
3129 "reverse", "sub", "upper", "pack", "packsize", "unpack", "concat", "maxn", "insert", "pack", "unpack", "remove", "move", "sort", "offset", "codepoint", "char", "len", "codes", "charpattern",
3130 "coroutine", "table", "io", "os", "string", "utf8", "bit32", "math", "debug", "package"
3131 };
3132 for (auto& k : identifiers)
3133 {
3134 Identifier id;
3135 id.mDeclaration = "Built-in function";
3136 langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
3137 }
3138
3139 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
3140 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\\'[^\\\']*\\\'", PaletteIndex::String));
3141 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
3142 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
3143 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
3144 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
3145 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
3146
3147 langDef.mCommentStart = "--[[";
3148 langDef.mCommentEnd = "]]";
3149 langDef.mSingleLineComment = "--";
3150
3151 langDef.mCaseSensitive = true;
3152 langDef.mAutoIndentation = false;
3153
3154 langDef.mName = "Lua";
3155
3156 inited = true;
3157 }
3158 return langDef;
3159}

References TextEditor::Identifier, mAutoIndentation, mCaseSensitive, mCommentEnd, mCommentStart, TextEditor::Identifier::mDeclaration, mIdentifiers, mKeywords, mName, mSingleLineComment, mTokenRegexStrings, TextEditor::Number, TextEditor::Punctuation, and TextEditor::String.

◆ SQL()

const TextEditor::LanguageDefinition & TextEditor::LanguageDefinition::SQL ( )
static

Definition at line 2993 of file TextEditor.cpp.

2994{
2995 static bool inited = false;
2996 static LanguageDefinition langDef;
2997 if (!inited)
2998 {
2999 static const char* const keywords[] = {
3000 "ADD", "EXCEPT", "PERCENT", "ALL", "EXEC", "PLAN", "ALTER", "EXECUTE", "PRECISION", "AND", "EXISTS", "PRIMARY", "ANY", "EXIT", "PRINT", "AS", "FETCH", "PROC", "ASC", "FILE", "PROCEDURE",
3001 "AUTHORIZATION", "FILLFACTOR", "PUBLIC", "BACKUP", "FOR", "RAISERROR", "BEGIN", "FOREIGN", "READ", "BETWEEN", "FREETEXT", "READTEXT", "BREAK", "FREETEXTTABLE", "RECONFIGURE",
3002 "BROWSE", "FROM", "REFERENCES", "BULK", "FULL", "REPLICATION", "BY", "FUNCTION", "RESTORE", "CASCADE", "GOTO", "RESTRICT", "CASE", "GRANT", "RETURN", "CHECK", "GROUP", "REVOKE",
3003 "CHECKPOINT", "HAVING", "RIGHT", "CLOSE", "HOLDLOCK", "ROLLBACK", "CLUSTERED", "IDENTITY", "ROWCOUNT", "COALESCE", "IDENTITY_INSERT", "ROWGUIDCOL", "COLLATE", "IDENTITYCOL", "RULE",
3004 "COLUMN", "IF", "SAVE", "COMMIT", "IN", "SCHEMA", "COMPUTE", "INDEX", "SELECT", "CONSTRAINT", "INNER", "SESSION_USER", "CONTAINS", "INSERT", "SET", "CONTAINSTABLE", "INTERSECT", "SETUSER",
3005 "CONTINUE", "INTO", "SHUTDOWN", "CONVERT", "IS", "SOME", "CREATE", "JOIN", "STATISTICS", "CROSS", "KEY", "SYSTEM_USER", "CURRENT", "KILL", "TABLE", "CURRENT_DATE", "LEFT", "TEXTSIZE",
3006 "CURRENT_TIME", "LIKE", "THEN", "CURRENT_TIMESTAMP", "LINENO", "TO", "CURRENT_USER", "LOAD", "TOP", "CURSOR", "NATIONAL", "TRAN", "DATABASE", "NOCHECK", "TRANSACTION",
3007 "DBCC", "NONCLUSTERED", "TRIGGER", "DEALLOCATE", "NOT", "TRUNCATE", "DECLARE", "NULL", "TSEQUAL", "DEFAULT", "NULLIF", "UNION", "DELETE", "OF", "UNIQUE", "DENY", "OFF", "UPDATE",
3008 "DESC", "OFFSETS", "UPDATETEXT", "DISK", "ON", "USE", "DISTINCT", "OPEN", "USER", "DISTRIBUTED", "OPENDATASOURCE", "VALUES", "DOUBLE", "OPENQUERY", "VARYING","DROP", "OPENROWSET", "VIEW",
3009 "DUMMY", "OPENXML", "WAITFOR", "DUMP", "OPTION", "WHEN", "ELSE", "OR", "WHERE", "END", "ORDER", "WHILE", "ERRLVL", "OUTER", "WITH", "ESCAPE", "OVER", "WRITETEXT"
3010 };
3011
3012 for (auto& k : keywords)
3013 langDef.mKeywords.insert(k);
3014
3015 static const char* const identifiers[] = {
3016 "ABS", "ACOS", "ADD_MONTHS", "ASCII", "ASCIISTR", "ASIN", "ATAN", "ATAN2", "AVG", "BFILENAME", "BIN_TO_NUM", "BITAND", "CARDINALITY", "CASE", "CAST", "CEIL",
3017 "CHARTOROWID", "CHR", "COALESCE", "COMPOSE", "CONCAT", "CONVERT", "CORR", "COS", "COSH", "COUNT", "COVAR_POP", "COVAR_SAMP", "CUME_DIST", "CURRENT_DATE",
3018 "CURRENT_TIMESTAMP", "DBTIMEZONE", "DECODE", "DECOMPOSE", "DENSE_RANK", "DUMP", "EMPTY_BLOB", "EMPTY_CLOB", "EXP", "EXTRACT", "FIRST_VALUE", "FLOOR", "FROM_TZ", "GREATEST",
3019 "GROUP_ID", "HEXTORAW", "INITCAP", "INSTR", "INSTR2", "INSTR4", "INSTRB", "INSTRC", "LAG", "LAST_DAY", "LAST_VALUE", "LEAD", "LEAST", "LENGTH", "LENGTH2", "LENGTH4",
3020 "LENGTHB", "LENGTHC", "LISTAGG", "LN", "LNNVL", "LOCALTIMESTAMP", "LOG", "LOWER", "LPAD", "LTRIM", "MAX", "MEDIAN", "MIN", "MOD", "MONTHS_BETWEEN", "NANVL", "NCHR",
3021 "NEW_TIME", "NEXT_DAY", "NTH_VALUE", "NULLIF", "NUMTODSINTERVAL", "NUMTOYMINTERVAL", "NVL", "NVL2", "POWER", "RANK", "RAWTOHEX", "REGEXP_COUNT", "REGEXP_INSTR",
3022 "REGEXP_REPLACE", "REGEXP_SUBSTR", "REMAINDER", "REPLACE", "ROUND", "ROWNUM", "RPAD", "RTRIM", "SESSIONTIMEZONE", "SIGN", "SIN", "SINH",
3023 "SOUNDEX", "SQRT", "STDDEV", "SUBSTR", "SUM", "SYS_CONTEXT", "SYSDATE", "SYSTIMESTAMP", "TAN", "TANH", "TO_CHAR", "TO_CLOB", "TO_DATE", "TO_DSINTERVAL", "TO_LOB",
3024 "TO_MULTI_BYTE", "TO_NCLOB", "TO_NUMBER", "TO_SINGLE_BYTE", "TO_TIMESTAMP", "TO_TIMESTAMP_TZ", "TO_YMINTERVAL", "TRANSLATE", "TRIM", "TRUNC", "TZ_OFFSET", "UID", "UPPER",
3025 "USER", "USERENV", "VAR_POP", "VAR_SAMP", "VARIANCE", "VSIZE "
3026 };
3027 for (auto& k : identifiers)
3028 {
3029 Identifier id;
3030 id.mDeclaration = "Built-in function";
3031 langDef.mIdentifiers.insert(std::make_pair(std::string(k), id));
3032 }
3033
3034 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("L?\\\"(\\\\.|[^\\\"])*\\\"", PaletteIndex::String));
3035 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("\\\'[^\\\']*\\\'", PaletteIndex::String));
3036 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?", PaletteIndex::Number));
3037 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[+-]?[0-9]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
3038 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[0-7]+[Uu]?[lL]?[lL]?", PaletteIndex::Number));
3039 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?", PaletteIndex::Number));
3040 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[a-zA-Z_][a-zA-Z0-9_]*", PaletteIndex::Identifier));
3041 langDef.mTokenRegexStrings.push_back(std::make_pair<std::string, PaletteIndex>("[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/\\;\\,\\.]", PaletteIndex::Punctuation));
3042
3043 langDef.mCommentStart = "/*";
3044 langDef.mCommentEnd = "*/";
3045 langDef.mSingleLineComment = "//";
3046
3047 langDef.mCaseSensitive = false;
3048 langDef.mAutoIndentation = false;
3049
3050 langDef.mName = "SQL";
3051
3052 inited = true;
3053 }
3054 return langDef;
3055}

References TextEditor::Identifier, mAutoIndentation, mCaseSensitive, mCommentEnd, mCommentStart, TextEditor::Identifier::mDeclaration, mIdentifiers, mKeywords, mName, mSingleLineComment, mTokenRegexStrings, TextEditor::Number, TextEditor::Punctuation, and TextEditor::String.

Member Data Documentation

◆ mAutoIndentation

bool TextEditor::LanguageDefinition::mAutoIndentation

Definition at line 163 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mCaseSensitive

bool TextEditor::LanguageDefinition::mCaseSensitive

Definition at line 169 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mCommentEnd

std::string TextEditor::LanguageDefinition::mCommentEnd

Definition at line 161 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mCommentStart

std::string TextEditor::LanguageDefinition::mCommentStart

Definition at line 161 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mIdentifiers

Identifiers TextEditor::LanguageDefinition::mIdentifiers

Definition at line 159 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mKeywords

Keywords TextEditor::LanguageDefinition::mKeywords

Definition at line 158 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mName

std::string TextEditor::LanguageDefinition::mName

Definition at line 157 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mPreprocChar

char TextEditor::LanguageDefinition::mPreprocChar

Definition at line 162 of file TextEditor.h.

◆ mPreprocIdentifiers

Identifiers TextEditor::LanguageDefinition::mPreprocIdentifiers

Definition at line 160 of file TextEditor.h.

◆ mSingleLineComment

std::string TextEditor::LanguageDefinition::mSingleLineComment

Definition at line 161 of file TextEditor.h.

Referenced by AngelScript(), C(), CPlusPlus(), GLSL(), HLSL(), Lua(), and SQL().

◆ mTokenize

TokenizeCallback TextEditor::LanguageDefinition::mTokenize

Definition at line 165 of file TextEditor.h.

Referenced by C(), and CPlusPlus().

◆ mTokenRegexStrings

TokenRegexStrings TextEditor::LanguageDefinition::mTokenRegexStrings

Definition at line 167 of file TextEditor.h.

Referenced by AngelScript(), GLSL(), HLSL(), Lua(), TextEditor::SetLanguageDefinition(), and SQL().


The documentation for this struct was generated from the following files: