Full token type disambiguation of keywords
parent
74405dd8fe
commit
4e60d34016
|
@ -127,6 +127,18 @@ config_parser__recognize_token(Config_Parser *ctx, Cpp_Token_Type type){
|
|||
return(result);
|
||||
}
|
||||
|
||||
static bool32
|
||||
config_parser__recognize_token_category(Config_Parser *ctx, Cpp_Token_Category category){
|
||||
bool32 result = false;
|
||||
if (ctx->start <= ctx->token && ctx->token < ctx->end){
|
||||
result = (cpp_token_category_from_type(ctx->token->type) == category);
|
||||
}
|
||||
else if (category == CPP_TOKEN_CAT_EOF){
|
||||
result = true;
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
static String
|
||||
config_parser__get_lexeme(Config_Parser *ctx){
|
||||
String lexeme = {};
|
||||
|
@ -410,7 +422,7 @@ config_parser__rvalue(Config_Parser *ctx){
|
|||
rvalue->compound = compound;
|
||||
return(rvalue);
|
||||
}
|
||||
else if (config_parser__recognize_token(ctx, CPP_TOKEN_BOOLEAN_CONSTANT)){
|
||||
else if (config_parser__recognize_token_category(ctx, CPP_TOKEN_CAT_BOOLEAN_CONSTANT)){
|
||||
bool32 b = config_parser__get_boolean(ctx);
|
||||
config_parser__advance_to_next(ctx);
|
||||
Config_RValue *rvalue = push_array(ctx->arena, Config_RValue, 1);
|
||||
|
|
|
@ -395,7 +395,7 @@ static Command_Metadata fcoder_metacmd_table[220] = {
|
|||
{ PROC_LINKS(save, 0), "save", 4, "Saves the current buffer.", 25, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1564 },
|
||||
{ PROC_LINKS(save_all_dirty_buffers, 0), "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1105 },
|
||||
{ PROC_LINKS(save_to_query, 0), "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 1161 },
|
||||
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 751 },
|
||||
{ PROC_LINKS(scope_absorb_down, 0), "scope_absorb_down", 17, "If a scope is currently selected, and a statement or block statement is present below the current scope, the statement is moved into the scope.", 143, "w:\\4ed\\code\\4coder_scope_commands.cpp", 37, 747 },
|
||||
{ PROC_LINKS(search, 0), "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 864 },
|
||||
{ PROC_LINKS(search_identifier, 0), "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "w:\\4ed\\code\\4coder_base_commands.cpp", 36, 878 },
|
||||
{ PROC_LINKS(seek_alphanumeric_left, 0), "seek_alphanumeric_left", 22, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "w:\\4ed\\code\\4coder_seek.cpp", 27, 1238 },
|
||||
|
|
|
@ -58,9 +58,11 @@ static String_And_Flag default_preprops[] = {
|
|||
static i32_4tech default_preprops_count = sizeof(default_preprops)/sizeof(default_preprops[0]);
|
||||
|
||||
static String_And_Flag default_keywords[] = {
|
||||
{make_stafl("true" , CPP_TOKEN_BOOLEAN_CONSTANT)},
|
||||
{make_stafl("false" , CPP_TOKEN_BOOLEAN_CONSTANT)},
|
||||
// CPP_TOKEN_BOOLEAN_CONSTANT
|
||||
{make_stafl("true" , CPP_TOKEN_TRUE)},
|
||||
{make_stafl("false" , CPP_TOKEN_FALSE)},
|
||||
|
||||
// CPP_TOKEN_KEY_OPERATOR
|
||||
{make_stafl("and" , CPP_TOKEN_AND)},
|
||||
{make_stafl("and_eq" , CPP_TOKEN_ANDEQ)},
|
||||
{make_stafl("bitand" , CPP_TOKEN_BIT_AND)},
|
||||
|
@ -80,71 +82,81 @@ static String_And_Flag default_keywords[] = {
|
|||
{make_stafl("typeid" , CPP_TOKEN_TYPEID)},
|
||||
{make_stafl("compl" , CPP_TOKEN_BIT_NOT)},
|
||||
|
||||
{make_stafl("void" , CPP_TOKEN_KEY_TYPE)},
|
||||
{make_stafl("bool" , CPP_TOKEN_KEY_TYPE)},
|
||||
{make_stafl("char" , CPP_TOKEN_KEY_TYPE)},
|
||||
{make_stafl("int" , CPP_TOKEN_KEY_TYPE)},
|
||||
{make_stafl("float" , CPP_TOKEN_KEY_TYPE)},
|
||||
{make_stafl("double" , CPP_TOKEN_KEY_TYPE)},
|
||||
// CPP_TOKEN_KEY_TYPE
|
||||
{make_stafl("void" , CPP_TOKEN_VOID)},
|
||||
{make_stafl("bool" , CPP_TOKEN_BOOL)},
|
||||
{make_stafl("char" , CPP_TOKEN_CHAR)},
|
||||
{make_stafl("int" , CPP_TOKEN_INT)},
|
||||
{make_stafl("float" , CPP_TOKEN_FLOAT)},
|
||||
{make_stafl("double" , CPP_TOKEN_DOUBLE)},
|
||||
|
||||
{make_stafl("long" , CPP_TOKEN_KEY_MODIFIER)},
|
||||
{make_stafl("short" , CPP_TOKEN_KEY_MODIFIER)},
|
||||
{make_stafl("unsigned" , CPP_TOKEN_KEY_MODIFIER)},
|
||||
// CPP_TOKEN_KEY_MODIFIER
|
||||
{make_stafl("long" , CPP_TOKEN_LONG)},
|
||||
{make_stafl("short" , CPP_TOKEN_SHORT)},
|
||||
{make_stafl("unsigned" , CPP_TOKEN_UNSIGNED)},
|
||||
{make_stafl("signed" , CPP_TOKEN_SIGNED)},
|
||||
|
||||
{make_stafl("const" , CPP_TOKEN_KEY_QUALIFIER)},
|
||||
{make_stafl("volatile" , CPP_TOKEN_KEY_QUALIFIER)},
|
||||
// CPP_TOKEN_KEY_QUALIFIER
|
||||
{make_stafl("const" , CPP_TOKEN_CONST)},
|
||||
{make_stafl("volatile" , CPP_TOKEN_VOLATILE)},
|
||||
|
||||
{make_stafl("asm" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("break" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("case" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("catch" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("continue" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("default" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("do" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("else" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("for" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("goto" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("if" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("return" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("switch" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("try" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("while" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
{make_stafl("static_assert" , CPP_TOKEN_KEY_CONTROL_FLOW)},
|
||||
// CPP_TOKEN_KEY_CONTROL_FLOW
|
||||
{make_stafl("asm" , CPP_TOKEN_ASM)},
|
||||
{make_stafl("break" , CPP_TOKEN_BREAK)},
|
||||
{make_stafl("case" , CPP_TOKEN_CASE)},
|
||||
{make_stafl("catch" , CPP_TOKEN_CATCH)},
|
||||
{make_stafl("continue" , CPP_TOKEN_CONTINUE)},
|
||||
{make_stafl("default" , CPP_TOKEN_DEFAULT)},
|
||||
{make_stafl("do" , CPP_TOKEN_DO)},
|
||||
{make_stafl("else" , CPP_TOKEN_ELSE)},
|
||||
{make_stafl("for" , CPP_TOKEN_FOR)},
|
||||
{make_stafl("goto" , CPP_TOKEN_GOTO)},
|
||||
{make_stafl("if" , CPP_TOKEN_IF)},
|
||||
{make_stafl("return" , CPP_TOKEN_RETURN)},
|
||||
{make_stafl("switch" , CPP_TOKEN_SWITCH)},
|
||||
{make_stafl("try" , CPP_TOKEN_TRY)},
|
||||
{make_stafl("while" , CPP_TOKEN_WHILE)},
|
||||
{make_stafl("static_assert" , CPP_TOKEN_STATIC_ASSERT)},
|
||||
|
||||
{make_stafl("const_cast" , CPP_TOKEN_KEY_CAST)},
|
||||
{make_stafl("dynamic_cast" , CPP_TOKEN_KEY_CAST)},
|
||||
{make_stafl("reinterpret_cast" , CPP_TOKEN_KEY_CAST)},
|
||||
{make_stafl("static_cast" , CPP_TOKEN_KEY_CAST)},
|
||||
// CPP_TOKEN_KEY_CAST
|
||||
{make_stafl("const_cast" , CPP_TOKEN_CONST_CAST)},
|
||||
{make_stafl("dynamic_cast" , CPP_TOKEN_DYNAMIC_CAST)},
|
||||
{make_stafl("reinterpret_cast" , CPP_TOKEN_REINTERPRET_CAST)},
|
||||
{make_stafl("static_cast" , CPP_TOKEN_STATIC_CAST)},
|
||||
|
||||
{make_stafl("class" , CPP_TOKEN_KEY_TYPE_DECLARATION)},
|
||||
{make_stafl("enum" , CPP_TOKEN_KEY_TYPE_DECLARATION)},
|
||||
{make_stafl("struct" , CPP_TOKEN_KEY_TYPE_DECLARATION)},
|
||||
{make_stafl("typedef" , CPP_TOKEN_KEY_TYPE_DECLARATION)},
|
||||
{make_stafl("union" , CPP_TOKEN_KEY_TYPE_DECLARATION)},
|
||||
{make_stafl("template" , CPP_TOKEN_KEY_TYPE_DECLARATION)},
|
||||
{make_stafl("typename" , CPP_TOKEN_KEY_TYPE_DECLARATION)},
|
||||
// CPP_TOKEN_KEY_TYPE_DECLARATION
|
||||
{make_stafl("class" , CPP_TOKEN_CLASS)},
|
||||
{make_stafl("enum" , CPP_TOKEN_ENUM)},
|
||||
{make_stafl("struct" , CPP_TOKEN_STRUCT)},
|
||||
{make_stafl("typedef" , CPP_TOKEN_TYPEDEF)},
|
||||
{make_stafl("union" , CPP_TOKEN_UNION)},
|
||||
{make_stafl("template" , CPP_TOKEN_TEMPLATE)},
|
||||
{make_stafl("typename" , CPP_TOKEN_TYPENAME)},
|
||||
|
||||
{make_stafl("friend" , CPP_TOKEN_KEY_ACCESS)},
|
||||
{make_stafl("namespace" , CPP_TOKEN_KEY_ACCESS)},
|
||||
{make_stafl("private" , CPP_TOKEN_KEY_ACCESS)},
|
||||
{make_stafl("protected" , CPP_TOKEN_KEY_ACCESS)},
|
||||
{make_stafl("public" , CPP_TOKEN_KEY_ACCESS)},
|
||||
{make_stafl("using" , CPP_TOKEN_KEY_ACCESS)},
|
||||
// CPP_TOKEN_KEY_ACCESS
|
||||
{make_stafl("friend" , CPP_TOKEN_FRIEND)},
|
||||
{make_stafl("namespace" , CPP_TOKEN_NAMESPACE)},
|
||||
{make_stafl("private" , CPP_TOKEN_PRIVATE)},
|
||||
{make_stafl("protected" , CPP_TOKEN_PROTECTED)},
|
||||
{make_stafl("public" , CPP_TOKEN_PUBLIC)},
|
||||
{make_stafl("using" , CPP_TOKEN_USING)},
|
||||
|
||||
{make_stafl("extern" , CPP_TOKEN_KEY_LINKAGE)},
|
||||
{make_stafl("export" , CPP_TOKEN_KEY_LINKAGE)},
|
||||
{make_stafl("internal" , CPP_TOKEN_KEY_LINKAGE)},
|
||||
{make_stafl("static" , CPP_TOKEN_KEY_LINKAGE)},
|
||||
{make_stafl("virtual" , CPP_TOKEN_KEY_LINKAGE)},
|
||||
// CPP_TOKEN_KEY_LINKAGE
|
||||
{make_stafl("extern" , CPP_TOKEN_EXTERN)},
|
||||
{make_stafl("export" , CPP_TOKEN_EXPORT)},
|
||||
{make_stafl("inline" , CPP_TOKEN_INLINE)},
|
||||
{make_stafl("static" , CPP_TOKEN_STATIC)},
|
||||
{make_stafl("virtual" , CPP_TOKEN_VIRTUAL)},
|
||||
|
||||
{make_stafl("alignas" , CPP_TOKEN_KEY_OTHER)},
|
||||
{make_stafl("explicit" , CPP_TOKEN_KEY_OTHER)},
|
||||
{make_stafl("noexcept" , CPP_TOKEN_KEY_OTHER)},
|
||||
{make_stafl("nullptr" , CPP_TOKEN_KEY_OTHER)},
|
||||
{make_stafl("operator" , CPP_TOKEN_KEY_OTHER)},
|
||||
{make_stafl("register" , CPP_TOKEN_KEY_OTHER)},
|
||||
{make_stafl("this" , CPP_TOKEN_KEY_OTHER)},
|
||||
{make_stafl("thread_local" , CPP_TOKEN_KEY_OTHER)},
|
||||
// CPP_TOKEN_KEY_OTHER
|
||||
{make_stafl("alignas" , CPP_TOKEN_ALIGNAS)},
|
||||
{make_stafl("explicit" , CPP_TOKEN_EXPLICIT)},
|
||||
{make_stafl("noexcept" , CPP_TOKEN_NOEXCEPT)},
|
||||
{make_stafl("nullptr" , CPP_TOKEN_NULLPTR)},
|
||||
{make_stafl("operator" , CPP_TOKEN_OPERATOR)},
|
||||
{make_stafl("register" , CPP_TOKEN_REGISTER)},
|
||||
{make_stafl("this" , CPP_TOKEN_THIS)},
|
||||
{make_stafl("thread_local" , CPP_TOKEN_THREAD_LOCAL)},
|
||||
|
||||
#if defined(FCPP_LEXER_EXTRA_KEYWORDS)
|
||||
#include FCPP_LEXER_EXTRA_KEYWORDS
|
||||
|
|
|
@ -386,6 +386,142 @@ DOC_SEE(cpp_make_table)
|
|||
|
||||
////////////////
|
||||
|
||||
API_EXPORT FCPP_LINK Cpp_Token_Category
|
||||
cpp_token_category_from_type(Cpp_Token_Type type){
|
||||
Cpp_Token_Category cat = 0;
|
||||
switch (type){
|
||||
case CPP_TOKEN_TRUE:
|
||||
case CPP_TOKEN_FALSE:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_BOOLEAN_CONSTANT;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_AND:
|
||||
case CPP_TOKEN_ANDEQ:
|
||||
case CPP_TOKEN_BIT_AND:
|
||||
case CPP_TOKEN_BIT_OR:
|
||||
case CPP_TOKEN_OR:
|
||||
case CPP_TOKEN_OREQ:
|
||||
case CPP_TOKEN_SIZEOF:
|
||||
case CPP_TOKEN_ALIGNOF:
|
||||
case CPP_TOKEN_DECLTYPE:
|
||||
case CPP_TOKEN_THROW:
|
||||
case CPP_TOKEN_NEW:
|
||||
case CPP_TOKEN_DELETE:
|
||||
case CPP_TOKEN_BIT_XOR:
|
||||
case CPP_TOKEN_XOREQ:
|
||||
case CPP_TOKEN_NOT:
|
||||
case CPP_TOKEN_NOTEQ:
|
||||
case CPP_TOKEN_TYPEID:
|
||||
case CPP_TOKEN_BIT_NOT:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_OPERATOR;
|
||||
}break;
|
||||
|
||||
|
||||
case CPP_TOKEN_VOID:
|
||||
case CPP_TOKEN_BOOL:
|
||||
case CPP_TOKEN_CHAR:
|
||||
case CPP_TOKEN_INT:
|
||||
case CPP_TOKEN_FLOAT:
|
||||
case CPP_TOKEN_DOUBLE:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_TYPE;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_LONG:
|
||||
case CPP_TOKEN_SHORT:
|
||||
case CPP_TOKEN_UNSIGNED:
|
||||
case CPP_TOKEN_SIGNED:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_MODIFIER;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_CONST:
|
||||
case CPP_TOKEN_VOLATILE:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_QUALIFIER;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_ASM:
|
||||
case CPP_TOKEN_BREAK:
|
||||
case CPP_TOKEN_CASE:
|
||||
case CPP_TOKEN_CATCH:
|
||||
case CPP_TOKEN_CONTINUE:
|
||||
case CPP_TOKEN_DEFAULT:
|
||||
case CPP_TOKEN_DO:
|
||||
case CPP_TOKEN_ELSE:
|
||||
case CPP_TOKEN_FOR:
|
||||
case CPP_TOKEN_GOTO:
|
||||
case CPP_TOKEN_IF:
|
||||
case CPP_TOKEN_RETURN:
|
||||
case CPP_TOKEN_SWITCH:
|
||||
case CPP_TOKEN_TRY:
|
||||
case CPP_TOKEN_WHILE:
|
||||
case CPP_TOKEN_STATIC_ASSERT:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_CONTROL_FLOW;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_CONST_CAST:
|
||||
case CPP_TOKEN_DYNAMIC_CAST:
|
||||
case CPP_TOKEN_REINTERPRET_CAST:
|
||||
case CPP_TOKEN_STATIC_CAST:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_CAST;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_CLASS:
|
||||
case CPP_TOKEN_ENUM:
|
||||
case CPP_TOKEN_STRUCT:
|
||||
case CPP_TOKEN_TYPEDEF:
|
||||
case CPP_TOKEN_UNION:
|
||||
case CPP_TOKEN_TEMPLATE:
|
||||
case CPP_TOKEN_TYPENAME:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_TYPE_DECLARATION;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_FRIEND:
|
||||
case CPP_TOKEN_NAMESPACE:
|
||||
case CPP_TOKEN_PRIVATE:
|
||||
case CPP_TOKEN_PROTECTED:
|
||||
case CPP_TOKEN_PUBLIC:
|
||||
case CPP_TOKEN_USING:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_ACCESS;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_EXTERN:
|
||||
case CPP_TOKEN_EXPORT:
|
||||
case CPP_TOKEN_INLINE:
|
||||
case CPP_TOKEN_STATIC:
|
||||
case CPP_TOKEN_VIRTUAL:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_LINKAGE;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_ALIGNAS:
|
||||
case CPP_TOKEN_EXPLICIT:
|
||||
case CPP_TOKEN_NOEXCEPT:
|
||||
case CPP_TOKEN_NULLPTR:
|
||||
case CPP_TOKEN_OPERATOR:
|
||||
case CPP_TOKEN_REGISTER:
|
||||
case CPP_TOKEN_THIS:
|
||||
case CPP_TOKEN_THREAD_LOCAL:
|
||||
case CPP_TOKEN_KEY_OTHER:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_OTHER;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_EOF:
|
||||
{
|
||||
cat = CPP_TOKEN_CAT_EOF;
|
||||
}break;
|
||||
}
|
||||
return(cat);
|
||||
}
|
||||
|
||||
API_EXPORT FCPP_LINK Cpp_Get_Token_Result
|
||||
cpp_get_token(Cpp_Token_Array array, i32_4tech pos)/*
|
||||
DOC_PARAM(array, The array of tokens from which to get a token.)
|
||||
|
|
|
@ -51,183 +51,238 @@ ENUM(uint32_t, Cpp_Token_Type){
|
|||
CPP_PP_INCLUDE_FILE = 21,
|
||||
CPP_PP_ERROR_MESSAGE = 22,
|
||||
|
||||
CPP_TOKEN_KEY_TYPE = 23,
|
||||
CPP_TOKEN_KEY_MODIFIER = 24,
|
||||
CPP_TOKEN_KEY_QUALIFIER = 25,
|
||||
/* DOC(This type is not stored in token output from the lexer.) */
|
||||
CPP_TOKEN_KEY_OPERATOR = 26,
|
||||
CPP_TOKEN_KEY_CONTROL_FLOW = 27,
|
||||
CPP_TOKEN_KEY_CAST = 28,
|
||||
CPP_TOKEN_KEY_TYPE_DECLARATION = 29,
|
||||
CPP_TOKEN_KEY_ACCESS = 30,
|
||||
CPP_TOKEN_KEY_LINKAGE = 31,
|
||||
CPP_TOKEN_KEY_OTHER = 32,
|
||||
CPP_TOKEN_VOID = 23,
|
||||
CPP_TOKEN_BOOL = 24,
|
||||
CPP_TOKEN_CHAR = 25,
|
||||
CPP_TOKEN_INT = 26,
|
||||
CPP_TOKEN_FLOAT = 27,
|
||||
CPP_TOKEN_DOUBLE = 28,
|
||||
CPP_TOKEN_LONG = 29,
|
||||
CPP_TOKEN_SHORT = 30,
|
||||
CPP_TOKEN_UNSIGNED = 31,
|
||||
CPP_TOKEN_SIGNED = 32,
|
||||
|
||||
CPP_TOKEN_IDENTIFIER = 33,
|
||||
CPP_TOKEN_INTEGER_CONSTANT = 34,
|
||||
CPP_TOKEN_CHARACTER_CONSTANT = 35,
|
||||
CPP_TOKEN_FLOATING_CONSTANT = 36,
|
||||
CPP_TOKEN_STRING_CONSTANT = 37,
|
||||
CPP_TOKEN_BOOLEAN_CONSTANT = 38,
|
||||
CPP_TOKEN_CONST = 33,
|
||||
CPP_TOKEN_VOLATILE = 34,
|
||||
|
||||
CPP_TOKEN_STATIC_ASSERT = 39,
|
||||
CPP_TOKEN_ASM = 35,
|
||||
CPP_TOKEN_BREAK = 36,
|
||||
CPP_TOKEN_CASE = 37,
|
||||
CPP_TOKEN_CATCH = 38,
|
||||
CPP_TOKEN_CONTINUE = 39,
|
||||
CPP_TOKEN_DEFAULT = 40,
|
||||
CPP_TOKEN_DO = 41,
|
||||
CPP_TOKEN_ELSE = 42,
|
||||
CPP_TOKEN_FOR = 43,
|
||||
CPP_TOKEN_GOTO = 44,
|
||||
CPP_TOKEN_IF = 45,
|
||||
CPP_TOKEN_RETURN = 46,
|
||||
CPP_TOKEN_SWITCH = 47,
|
||||
CPP_TOKEN_TRY = 48,
|
||||
CPP_TOKEN_WHILE = 49,
|
||||
CPP_TOKEN_STATIC_ASSERT = 50,
|
||||
|
||||
CPP_TOKEN_BRACKET_OPEN = 40,
|
||||
CPP_TOKEN_BRACKET_CLOSE = 41,
|
||||
CPP_TOKEN_PARENTHESE_OPEN = 42,
|
||||
CPP_TOKEN_PARENTHESE_CLOSE = 43,
|
||||
CPP_TOKEN_BRACE_OPEN = 44,
|
||||
CPP_TOKEN_BRACE_CLOSE = 45,
|
||||
CPP_TOKEN_SEMICOLON = 46,
|
||||
CPP_TOKEN_ELLIPSIS = 47,
|
||||
CPP_TOKEN_CONST_CAST = 51,
|
||||
CPP_TOKEN_DYNAMIC_CAST = 52,
|
||||
CPP_TOKEN_REINTERPRET_CAST = 53,
|
||||
CPP_TOKEN_STATIC_CAST = 54,
|
||||
|
||||
CPP_TOKEN_CLASS = 55,
|
||||
CPP_TOKEN_ENUM = 56,
|
||||
CPP_TOKEN_STRUCT = 57,
|
||||
CPP_TOKEN_TYPEDEF = 58,
|
||||
CPP_TOKEN_UNION = 59,
|
||||
CPP_TOKEN_TEMPLATE = 60,
|
||||
CPP_TOKEN_TYPENAME = 61,
|
||||
|
||||
CPP_TOKEN_FRIEND = 62,
|
||||
CPP_TOKEN_NAMESPACE = 63,
|
||||
CPP_TOKEN_PRIVATE = 64,
|
||||
CPP_TOKEN_PROTECTED = 65,
|
||||
CPP_TOKEN_PUBLIC = 66,
|
||||
CPP_TOKEN_USING = 67,
|
||||
|
||||
CPP_TOKEN_EXTERN = 68,
|
||||
CPP_TOKEN_EXPORT = 69,
|
||||
CPP_TOKEN_INLINE = 70,
|
||||
CPP_TOKEN_STATIC = 71,
|
||||
CPP_TOKEN_VIRTUAL = 72,
|
||||
|
||||
CPP_TOKEN_ALIGNAS = 73,
|
||||
CPP_TOKEN_EXPLICIT = 74,
|
||||
CPP_TOKEN_NOEXCEPT = 75,
|
||||
CPP_TOKEN_NULLPTR = 76,
|
||||
CPP_TOKEN_OPERATOR = 77,
|
||||
CPP_TOKEN_REGISTER = 78,
|
||||
CPP_TOKEN_THIS = 79,
|
||||
CPP_TOKEN_THREAD_LOCAL = 80,
|
||||
|
||||
CPP_TOKEN_KEY_OTHER = 81,
|
||||
|
||||
CPP_TOKEN_IDENTIFIER = 82,
|
||||
CPP_TOKEN_INTEGER_CONSTANT = 83,
|
||||
CPP_TOKEN_CHARACTER_CONSTANT = 84,
|
||||
CPP_TOKEN_FLOATING_CONSTANT = 85,
|
||||
CPP_TOKEN_STRING_CONSTANT = 86,
|
||||
CPP_TOKEN_TRUE = 87,
|
||||
CPP_TOKEN_FALSE = 88,
|
||||
|
||||
CPP_TOKEN_BRACKET_OPEN = 89,
|
||||
CPP_TOKEN_BRACKET_CLOSE = 90,
|
||||
CPP_TOKEN_PARENTHESE_OPEN = 91,
|
||||
CPP_TOKEN_PARENTHESE_CLOSE = 92,
|
||||
CPP_TOKEN_BRACE_OPEN = 93,
|
||||
CPP_TOKEN_BRACE_CLOSE = 94,
|
||||
CPP_TOKEN_SEMICOLON = 95,
|
||||
CPP_TOKEN_ELLIPSIS = 96,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_STAR = 48,
|
||||
CPP_TOKEN_STAR = 97,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_AMPERSAND = 49,
|
||||
CPP_TOKEN_AMPERSAND = 98,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_TILDE = 50,
|
||||
CPP_TOKEN_TILDE = 99,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_PLUS = 51,
|
||||
CPP_TOKEN_PLUS = 100,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_MINUS = 52,
|
||||
CPP_TOKEN_MINUS = 101,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_INCREMENT = 53,
|
||||
CPP_TOKEN_INCREMENT = 102,
|
||||
|
||||
/* DOC(This is an 'ambiguous' token type because it requires parsing to determine the full nature of the token.) */
|
||||
CPP_TOKEN_DECREMENT = 54,
|
||||
CPP_TOKEN_DECREMENT = 103,
|
||||
|
||||
// NOTE(allen): Precedence 1, LtoR
|
||||
CPP_TOKEN_SCOPE = 55,
|
||||
CPP_TOKEN_SCOPE = 104,
|
||||
|
||||
// NOTE(allen): Precedence 2, LtoR
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_POSTINC = 56,
|
||||
CPP_TOKEN_POSTINC = 105,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_POSTDEC = 57,
|
||||
CPP_TOKEN_POSTDEC = 106,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_FUNC_STYLE_CAST = 58,
|
||||
CPP_TOKEN_CPP_STYLE_CAST = 59,
|
||||
CPP_TOKEN_FUNC_STYLE_CAST = 107,
|
||||
CPP_TOKEN_CPP_STYLE_CAST = 108,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_CALL = 60,
|
||||
CPP_TOKEN_CALL = 109,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_INDEX = 61,
|
||||
CPP_TOKEN_DOT = 62,
|
||||
CPP_TOKEN_ARROW = 63,
|
||||
CPP_TOKEN_INDEX = 110,
|
||||
CPP_TOKEN_DOT = 111,
|
||||
CPP_TOKEN_ARROW = 112,
|
||||
|
||||
// NOTE(allen): Precedence 3, RtoL
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_PREINC = 64,
|
||||
CPP_TOKEN_PREINC = 113,
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_PREDEC = 65,
|
||||
CPP_TOKEN_PREDEC = 114,
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_POSITIVE = 66,
|
||||
CPP_TOKEN_POSITIVE = 115,
|
||||
/* DOC(This token is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_NEGAITVE = 67,
|
||||
CPP_TOKEN_NOT = 68,
|
||||
CPP_TOKEN_NEGAITVE = 116,
|
||||
CPP_TOKEN_NOT = 117,
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_BIT_NOT = 69,
|
||||
CPP_TOKEN_BIT_NOT = 118,
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_CAST = 70,
|
||||
CPP_TOKEN_CAST = 119,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_DEREF = 71,
|
||||
CPP_TOKEN_DEREF = 120,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_TYPE_PTR = 72,
|
||||
CPP_TOKEN_TYPE_PTR = 121,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_ADDRESS = 73,
|
||||
CPP_TOKEN_ADDRESS = 122,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_TYPE_REF = 74,
|
||||
CPP_TOKEN_SIZEOF = 75,
|
||||
CPP_TOKEN_ALIGNOF = 76,
|
||||
CPP_TOKEN_DECLTYPE = 77,
|
||||
CPP_TOKEN_TYPEID = 78,
|
||||
CPP_TOKEN_NEW = 79,
|
||||
CPP_TOKEN_DELETE = 80,
|
||||
CPP_TOKEN_TYPE_REF = 123,
|
||||
CPP_TOKEN_SIZEOF = 124,
|
||||
CPP_TOKEN_ALIGNOF = 125,
|
||||
CPP_TOKEN_DECLTYPE = 126,
|
||||
CPP_TOKEN_TYPEID = 127,
|
||||
CPP_TOKEN_NEW = 128,
|
||||
CPP_TOKEN_DELETE = 129,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_NEW_ARRAY = 81,
|
||||
CPP_TOKEN_NEW_ARRAY = 130,
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_DELETE_ARRAY = 82,
|
||||
CPP_TOKEN_DELETE_ARRAY = 131,
|
||||
|
||||
// NOTE(allen): Precedence 4, LtoR
|
||||
CPP_TOKEN_PTRDOT = 83,
|
||||
CPP_TOKEN_PTRARROW = 84,
|
||||
CPP_TOKEN_PTRDOT = 132,
|
||||
CPP_TOKEN_PTRARROW = 133,
|
||||
|
||||
// NOTE(allen): Precedence 5, LtoR
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_MUL = 85,
|
||||
CPP_TOKEN_DIV = 86,
|
||||
CPP_TOKEN_MOD = 87,
|
||||
CPP_TOKEN_MUL = 134,
|
||||
CPP_TOKEN_DIV = 135,
|
||||
CPP_TOKEN_MOD = 136,
|
||||
|
||||
// NOTE(allen): Precedence 6, LtoR
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_ADD = 88,
|
||||
CPP_TOKEN_ADD = 137,
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_SUB = 89,
|
||||
CPP_TOKEN_SUB = 138,
|
||||
|
||||
// NOTE(allen): Precedence 7, LtoR
|
||||
CPP_TOKEN_LSHIFT = 90,
|
||||
CPP_TOKEN_RSHIFT = 91,
|
||||
CPP_TOKEN_LSHIFT = 139,
|
||||
CPP_TOKEN_RSHIFT = 140,
|
||||
|
||||
// NOTE(allen): Precedence 8, LtoR
|
||||
CPP_TOKEN_LESS = 92,
|
||||
CPP_TOKEN_GRTR = 93,
|
||||
CPP_TOKEN_GRTREQ = 94,
|
||||
CPP_TOKEN_LESSEQ = 95,
|
||||
CPP_TOKEN_LESS = 141,
|
||||
CPP_TOKEN_GRTR = 142,
|
||||
CPP_TOKEN_GRTREQ = 143,
|
||||
CPP_TOKEN_LESSEQ = 144,
|
||||
|
||||
// NOTE(allen): Precedence 9, LtoR
|
||||
CPP_TOKEN_EQEQ = 96,
|
||||
CPP_TOKEN_NOTEQ = 97,
|
||||
CPP_TOKEN_EQEQ = 145,
|
||||
CPP_TOKEN_NOTEQ = 146,
|
||||
|
||||
// NOTE(allen): Precedence 10, LtoR
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_BIT_AND = 98,
|
||||
CPP_TOKEN_BIT_AND = 147,
|
||||
|
||||
// NOTE(allen): Precedence 11, LtoR
|
||||
CPP_TOKEN_BIT_XOR = 99,
|
||||
CPP_TOKEN_BIT_XOR = 148,
|
||||
|
||||
// NOTE(allen): Precedence 12, LtoR
|
||||
CPP_TOKEN_BIT_OR = 100,
|
||||
CPP_TOKEN_BIT_OR = 149,
|
||||
|
||||
// NOTE(allen): Precedence 13, LtoR
|
||||
CPP_TOKEN_AND = 101,
|
||||
CPP_TOKEN_AND = 150,
|
||||
|
||||
// NOTE(allen): Precedence 14, LtoR
|
||||
CPP_TOKEN_OR = 102,
|
||||
CPP_TOKEN_OR = 151,
|
||||
|
||||
// NOTE(allen): Precedence 15, RtoL
|
||||
CPP_TOKEN_TERNARY_QMARK = 103,
|
||||
CPP_TOKEN_COLON = 104,
|
||||
CPP_TOKEN_THROW = 105,
|
||||
CPP_TOKEN_EQ = 106,
|
||||
CPP_TOKEN_ADDEQ = 107,
|
||||
CPP_TOKEN_SUBEQ = 108,
|
||||
CPP_TOKEN_MULEQ = 109,
|
||||
CPP_TOKEN_DIVEQ = 110,
|
||||
CPP_TOKEN_MODEQ = 111,
|
||||
CPP_TOKEN_LSHIFTEQ = 112,
|
||||
CPP_TOKEN_RSHIFTEQ = 113,
|
||||
CPP_TOKEN_ANDEQ = 114,
|
||||
CPP_TOKEN_OREQ = 115,
|
||||
CPP_TOKEN_XOREQ = 116,
|
||||
CPP_TOKEN_TERNARY_QMARK = 152,
|
||||
CPP_TOKEN_COLON = 153,
|
||||
CPP_TOKEN_THROW = 154,
|
||||
CPP_TOKEN_EQ = 155,
|
||||
CPP_TOKEN_ADDEQ = 156,
|
||||
CPP_TOKEN_SUBEQ = 157,
|
||||
CPP_TOKEN_MULEQ = 158,
|
||||
CPP_TOKEN_DIVEQ = 159,
|
||||
CPP_TOKEN_MODEQ = 160,
|
||||
CPP_TOKEN_LSHIFTEQ = 161,
|
||||
CPP_TOKEN_RSHIFTEQ = 162,
|
||||
CPP_TOKEN_ANDEQ = 163,
|
||||
CPP_TOKEN_OREQ = 164,
|
||||
CPP_TOKEN_XOREQ = 165,
|
||||
|
||||
// NOTE(allen): Precedence 16, LtoR
|
||||
CPP_TOKEN_COMMA = 117,
|
||||
CPP_TOKEN_COMMA = 166,
|
||||
|
||||
/* DOC(This type is for parser use, it is not output by the lexer.) */
|
||||
CPP_TOKEN_EOF = 118,
|
||||
CPP_TOKEN_EOF = 167,
|
||||
|
||||
CPP_TOKEN_TYPE_COUNT = 119
|
||||
CPP_TOKEN_TYPE_COUNT = 168,
|
||||
};
|
||||
|
||||
/* DOC(Cpp_Token represents a single lexed token. It is the primary output of the lexing system.)
|
||||
|
@ -249,6 +304,24 @@ STRUCT Cpp_Token{
|
|||
uint16_t flags;
|
||||
};
|
||||
|
||||
/* DOC(The Cpp_Token_Category enum groups certain Cpp_Token_Type values into greater categories)
|
||||
DOC_SEE(cpp_token_category_from_type) */
|
||||
ENUM(uint32_t, Cpp_Token_Category){
|
||||
CPP_TOKEN_CAT_NONE = 0,
|
||||
CPP_TOKEN_CAT_BOOLEAN_CONSTANT = 1,
|
||||
CPP_TOKEN_CAT_TYPE = 2,
|
||||
CPP_TOKEN_CAT_MODIFIER = 3,
|
||||
CPP_TOKEN_CAT_QUALIFIER = 4,
|
||||
CPP_TOKEN_CAT_OPERATOR = 5,
|
||||
CPP_TOKEN_CAT_CONTROL_FLOW = 6,
|
||||
CPP_TOKEN_CAT_CAST = 7,
|
||||
CPP_TOKEN_CAT_TYPE_DECLARATION = 8,
|
||||
CPP_TOKEN_CAT_ACCESS = 9,
|
||||
CPP_TOKEN_CAT_LINKAGE = 10,
|
||||
CPP_TOKEN_CAT_OTHER = 11,
|
||||
CPP_TOKEN_CAT_EOF = 12,
|
||||
};
|
||||
|
||||
/* DOC(The Cpp_Token_Flags are used to mark up tokens with additional information.) */
|
||||
ENUM(uint16_t, Cpp_Token_Flag){
|
||||
/* DOC(Indicates that the token is a preprocessor directive.) */
|
||||
|
@ -264,7 +337,7 @@ ENUM(uint16_t, Cpp_Token_Flag){
|
|||
CPP_TFLAG_IS_OPERATOR = 0x8,
|
||||
|
||||
/* DOC(Indicates that the token is a keyword.) */
|
||||
CPP_TFLAG_IS_KEYWORD = 0x10
|
||||
CPP_TFLAG_IS_KEYWORD = 0x10,
|
||||
};
|
||||
|
||||
/* DOC(Cpp_Token_Array is used to bundle together the common elements of a growing array of Cpp_Tokens. To initialize it the tokens field should point to a block of memory with a size equal to max_count*sizeof(Cpp_Token) and the count should be initialized to zero.) */
|
||||
|
|
|
@ -600,7 +600,7 @@ parse_if_down(Application_Links *app, Statement_Parser *parser, Cpp_Token *token
|
|||
success = parse_statement_down(app, parser, token_out);
|
||||
if (success){
|
||||
token = parser_next_token(parser);
|
||||
if (token != 0 && token->type == CPP_TOKEN_KEY_CONTROL_FLOW){
|
||||
if (token != 0 && cpp_token_category_from_type(token->type) == CPP_TOKEN_CAT_CONTROL_FLOW){
|
||||
char lexeme[32];
|
||||
token_get_lexeme(app, parser->buffer, token, lexeme, sizeof(lexeme));
|
||||
if (match(lexeme, "else")){
|
||||
|
@ -658,26 +658,22 @@ parse_statement_down(Application_Links *app, Statement_Parser *parser, Cpp_Token
|
|||
goto finished;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_KEY_CONTROL_FLOW:
|
||||
case CPP_TOKEN_FOR:
|
||||
{
|
||||
char lexeme[32];
|
||||
if (sizeof(lexeme)-1 >= token->size){
|
||||
if (buffer_read_range(app, parser->buffer, token->start, token->start + token->size, lexeme)){
|
||||
lexeme[token->size] = 0;
|
||||
if (match(lexeme, "for")){
|
||||
success = parse_for_down(app, parser, token_out);
|
||||
goto finished;
|
||||
}
|
||||
else if (match(lexeme, "if")){
|
||||
success = parse_if_down(app, parser, token_out);
|
||||
goto finished;
|
||||
}
|
||||
else if (match(lexeme, "else")){
|
||||
success = false;
|
||||
goto finished;
|
||||
}
|
||||
}
|
||||
}
|
||||
success = parse_for_down(app, parser, token_out);
|
||||
goto finished;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_IF:
|
||||
{
|
||||
success = parse_if_down(app, parser, token_out);
|
||||
goto finished;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_ELSE:
|
||||
{
|
||||
success = false;
|
||||
goto finished;
|
||||
}break;
|
||||
|
||||
case CPP_TOKEN_BRACE_OPEN:
|
||||
|
|
|
@ -234,12 +234,17 @@ internal i32
|
|||
stickieness_guess(Cpp_Token_Type type, Cpp_Token_Type other_type, u16 flags, u16 other_flags, b32 on_left){
|
||||
i32 guess = 0;
|
||||
|
||||
b32 is_words = 0, other_is_words = 0;
|
||||
if (type == CPP_TOKEN_IDENTIFIER || (type >= CPP_TOKEN_KEY_TYPE && type <= CPP_TOKEN_KEY_OTHER)){
|
||||
is_words = 1;
|
||||
b32 is_words = false;
|
||||
b32 other_is_words = false;
|
||||
|
||||
Cpp_Token_Category cat = cpp_token_category_from_type(type);
|
||||
Cpp_Token_Category other_cat = cpp_token_category_from_type(other_type);
|
||||
|
||||
if (type == CPP_TOKEN_IDENTIFIER || (CPP_TOKEN_CAT_TYPE <= cat && cat <= CPP_TOKEN_CAT_OTHER)){
|
||||
is_words = true;
|
||||
}
|
||||
if (other_type == CPP_TOKEN_IDENTIFIER || (other_type >= CPP_TOKEN_KEY_TYPE && other_type <= CPP_TOKEN_KEY_OTHER)){
|
||||
other_is_words = 1;
|
||||
if (other_type == CPP_TOKEN_IDENTIFIER || (CPP_TOKEN_CAT_TYPE <= other_cat && other_cat <= CPP_TOKEN_CAT_OTHER)){
|
||||
other_is_words = true;
|
||||
}
|
||||
|
||||
b32 is_operator = 0, other_is_operator = 0;
|
||||
|
|
|
@ -732,7 +732,7 @@ internal u32
|
|||
get_token_color(Style *style, Cpp_Token token){
|
||||
u32 result = 0;
|
||||
if ((token.flags & CPP_TFLAG_IS_KEYWORD) != 0){
|
||||
if (token.type == CPP_TOKEN_BOOLEAN_CONSTANT){
|
||||
if (cpp_token_category_from_type(token.type) == CPP_TOKEN_CAT_BOOLEAN_CONSTANT){
|
||||
result = style->theme.colors[Stag_Bool_Constant];
|
||||
}
|
||||
else{
|
||||
|
|
|
@ -15,8 +15,8 @@ init_language_cpp(Application_Links *app){
|
|||
if (parse_context_language_cpp != 0) return;
|
||||
|
||||
Parser_String_And_Type kw[] = {
|
||||
PSAT("true" , CPP_TOKEN_BOOLEAN_CONSTANT),
|
||||
PSAT("false" , CPP_TOKEN_BOOLEAN_CONSTANT),
|
||||
PSAT("true" , CPP_TOKEN_TRUE),
|
||||
PSAT("false" , CPP_TOKEN_FALSE),
|
||||
|
||||
PSAT("and" , CPP_TOKEN_AND),
|
||||
PSAT("and_eq" , CPP_TOKEN_ANDEQ),
|
||||
|
@ -37,72 +37,73 @@ init_language_cpp(Application_Links *app){
|
|||
PSAT("typeid" , CPP_TOKEN_TYPEID),
|
||||
PSAT("compl" , CPP_TOKEN_BIT_NOT),
|
||||
|
||||
PSAT("void" , CPP_TOKEN_KEY_TYPE),
|
||||
PSAT("bool" , CPP_TOKEN_KEY_TYPE),
|
||||
PSAT("char" , CPP_TOKEN_KEY_TYPE),
|
||||
PSAT("int" , CPP_TOKEN_KEY_TYPE),
|
||||
PSAT("float" , CPP_TOKEN_KEY_TYPE),
|
||||
PSAT("double" , CPP_TOKEN_KEY_TYPE),
|
||||
PSAT("void" , CPP_TOKEN_VOID),
|
||||
PSAT("bool" , CPP_TOKEN_BOOL),
|
||||
PSAT("char" , CPP_TOKEN_CHAR),
|
||||
PSAT("int" , CPP_TOKEN_INT),
|
||||
PSAT("float" , CPP_TOKEN_FLOAT),
|
||||
PSAT("double" , CPP_TOKEN_DOUBLE),
|
||||
|
||||
PSAT("long" , CPP_TOKEN_KEY_MODIFIER),
|
||||
PSAT("short" , CPP_TOKEN_KEY_MODIFIER),
|
||||
PSAT("unsigned" , CPP_TOKEN_KEY_MODIFIER),
|
||||
PSAT("signed" , CPP_TOKEN_KEY_MODIFIER),
|
||||
PSAT("long" , CPP_TOKEN_LONG),
|
||||
PSAT("short" , CPP_TOKEN_SHORT),
|
||||
PSAT("unsigned" , CPP_TOKEN_UNSIGNED),
|
||||
PSAT("signed" , CPP_TOKEN_SIGNED),
|
||||
|
||||
PSAT("const" , CPP_TOKEN_KEY_QUALIFIER),
|
||||
PSAT("volatile" , CPP_TOKEN_KEY_QUALIFIER),
|
||||
PSAT("const" , CPP_TOKEN_CONST),
|
||||
PSAT("volatile" , CPP_TOKEN_VOLATILE),
|
||||
|
||||
PSAT("asm" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("break" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("case" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("catch" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("continue" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("default" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("do" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("else" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("for" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("goto" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("if" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("return" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("switch" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("try" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("while" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("static_assert" , CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("asm" , CPP_TOKEN_ASM),
|
||||
PSAT("break" , CPP_TOKEN_BREAK),
|
||||
PSAT("case" , CPP_TOKEN_CASE),
|
||||
PSAT("catch" , CPP_TOKEN_CATCH),
|
||||
PSAT("continue" , CPP_TOKEN_CONTINUE),
|
||||
PSAT("default" , CPP_TOKEN_DEFAULT),
|
||||
PSAT("do" , CPP_TOKEN_DO),
|
||||
PSAT("else" , CPP_TOKEN_ELSE),
|
||||
PSAT("for" , CPP_TOKEN_FOR),
|
||||
PSAT("goto" , CPP_TOKEN_GOTO),
|
||||
PSAT("if" , CPP_TOKEN_IF),
|
||||
PSAT("return" , CPP_TOKEN_RETURN),
|
||||
PSAT("switch" , CPP_TOKEN_SWITCH),
|
||||
PSAT("try" , CPP_TOKEN_TRY),
|
||||
PSAT("while" , CPP_TOKEN_WHILE),
|
||||
PSAT("static_assert" , CPP_TOKEN_STATIC_ASSERT),
|
||||
|
||||
PSAT("const_cast" , CPP_TOKEN_KEY_CAST),
|
||||
PSAT("dynamic_cast" , CPP_TOKEN_KEY_CAST),
|
||||
PSAT("reinterpret_cast" , CPP_TOKEN_KEY_CAST),
|
||||
PSAT("static_cast" , CPP_TOKEN_KEY_CAST),
|
||||
PSAT("const_cast" , CPP_TOKEN_CONST_CAST),
|
||||
PSAT("dynamic_cast" , CPP_TOKEN_DYNAMIC_CAST),
|
||||
PSAT("reinterpret_cast" , CPP_TOKEN_REINTERPRET_CAST),
|
||||
PSAT("static_cast" , CPP_TOKEN_STATIC_CAST),
|
||||
|
||||
PSAT("class" , CPP_TOKEN_KEY_TYPE_DECLARATION),
|
||||
PSAT("enum" , CPP_TOKEN_KEY_TYPE_DECLARATION),
|
||||
PSAT("struct" , CPP_TOKEN_KEY_TYPE_DECLARATION),
|
||||
PSAT("typedef" , CPP_TOKEN_KEY_TYPE_DECLARATION),
|
||||
PSAT("union" , CPP_TOKEN_KEY_TYPE_DECLARATION),
|
||||
PSAT("template" , CPP_TOKEN_KEY_TYPE_DECLARATION),
|
||||
PSAT("typename" , CPP_TOKEN_KEY_TYPE_DECLARATION),
|
||||
PSAT("class" , CPP_TOKEN_CLASS),
|
||||
PSAT("enum" , CPP_TOKEN_ENUM),
|
||||
PSAT("struct" , CPP_TOKEN_STRUCT),
|
||||
PSAT("typedef" , CPP_TOKEN_TYPEDEF),
|
||||
PSAT("union" , CPP_TOKEN_UNION),
|
||||
PSAT("template" , CPP_TOKEN_TEMPLATE),
|
||||
PSAT("typename" , CPP_TOKEN_TYPENAME),
|
||||
|
||||
PSAT("friend" , CPP_TOKEN_KEY_ACCESS),
|
||||
PSAT("namespace" , CPP_TOKEN_KEY_ACCESS),
|
||||
PSAT("private" , CPP_TOKEN_KEY_ACCESS),
|
||||
PSAT("protected" , CPP_TOKEN_KEY_ACCESS),
|
||||
PSAT("public" , CPP_TOKEN_KEY_ACCESS),
|
||||
PSAT("using" , CPP_TOKEN_KEY_ACCESS),
|
||||
PSAT("friend" , CPP_TOKEN_FRIEND),
|
||||
PSAT("namespace" , CPP_TOKEN_NAMESPACE),
|
||||
PSAT("private" , CPP_TOKEN_PRIVATE),
|
||||
PSAT("protected" , CPP_TOKEN_PROTECTED),
|
||||
PSAT("public" , CPP_TOKEN_PUBLIC),
|
||||
PSAT("using" , CPP_TOKEN_USING),
|
||||
|
||||
PSAT("extern" , CPP_TOKEN_KEY_LINKAGE),
|
||||
PSAT("export" , CPP_TOKEN_KEY_LINKAGE),
|
||||
PSAT("internal" , CPP_TOKEN_KEY_LINKAGE),
|
||||
PSAT("static" , CPP_TOKEN_KEY_LINKAGE),
|
||||
PSAT("virtual" , CPP_TOKEN_KEY_LINKAGE),
|
||||
PSAT("extern" , CPP_TOKEN_EXTERN),
|
||||
PSAT("export" , CPP_TOKEN_EXPORT),
|
||||
PSAT("inline" , CPP_TOKEN_INLINE),
|
||||
PSAT("static" , CPP_TOKEN_STATIC),
|
||||
PSAT("internal", CPP_TOKEN_STATIC),
|
||||
PSAT("virtual" , CPP_TOKEN_VIRTUAL),
|
||||
|
||||
PSAT("alignas" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("explicit" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("noexcept" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("nullptr" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("operator" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("register" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("this" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("thread_local" , CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("alignas" , CPP_TOKEN_ALIGNAS),
|
||||
PSAT("explicit" , CPP_TOKEN_EXPLICIT),
|
||||
PSAT("noexcept" , CPP_TOKEN_NOEXCEPT),
|
||||
PSAT("nullptr" , CPP_TOKEN_NULLPTR),
|
||||
PSAT("operator" , CPP_TOKEN_OPERATOR),
|
||||
PSAT("register" , CPP_TOKEN_REGISTER),
|
||||
PSAT("this" , CPP_TOKEN_THIS),
|
||||
PSAT("thread_local" , CPP_TOKEN_THREAD_LOCAL),
|
||||
|
||||
#if defined(EXTRA_KEYWORDS)
|
||||
#include EXTRA_KEYWORDS
|
||||
|
|
|
@ -73,26 +73,26 @@ init_language_cs(Application_Links *app){
|
|||
PSAT("void", CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("volatile", CPP_TOKEN_KEY_OTHER),
|
||||
|
||||
PSAT("if", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("else", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("switch", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("case", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("do", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("for", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("foreach", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("in", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("while", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("break", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("continue", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("default", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("goto", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("return", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("yield", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("throw", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("try", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("catch", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("finally", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("lock", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("if", CPP_TOKEN_IF),
|
||||
PSAT("else", CPP_TOKEN_ELSE),
|
||||
PSAT("switch", CPP_TOKEN_SWITCH),
|
||||
PSAT("case", CPP_TOKEN_CASE),
|
||||
PSAT("do", CPP_TOKEN_DO),
|
||||
PSAT("for", CPP_TOKEN_FOR),
|
||||
PSAT("foreach", CPP_TOKEN_FOR),
|
||||
PSAT("in", CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("while", CPP_TOKEN_WHILE),
|
||||
PSAT("break", CPP_TOKEN_BREAK),
|
||||
PSAT("continue", CPP_TOKEN_CONTINUE),
|
||||
PSAT("default", CPP_TOKEN_DEFAULT),
|
||||
PSAT("goto", CPP_TOKEN_GOTO),
|
||||
PSAT("return", CPP_TOKEN_RETURN),
|
||||
PSAT("yield", CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("throw", CPP_TOKEN_THROW),
|
||||
PSAT("try", CPP_TOKEN_TRY),
|
||||
PSAT("catch", CPP_TOKEN_CATCH),
|
||||
PSAT("finally", CPP_TOKEN_CATCH),
|
||||
PSAT("lock", CPP_TOKEN_KEY_OTHER),
|
||||
};
|
||||
|
||||
Parser_String_And_Type pp[] = {
|
||||
|
|
|
@ -53,21 +53,21 @@ init_language_java(Application_Links *app){
|
|||
PSAT("false", CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("null", CPP_TOKEN_KEY_OTHER),
|
||||
|
||||
PSAT("if", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("else", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("switch", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("case", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("while", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("do", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("for", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("goto", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("break", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("continue", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("throw", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("throws", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("try", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("catch", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("finally", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("if", CPP_TOKEN_IF),
|
||||
PSAT("else", CPP_TOKEN_ELSE),
|
||||
PSAT("switch", CPP_TOKEN_SWITCH),
|
||||
PSAT("case", CPP_TOKEN_CASE),
|
||||
PSAT("while", CPP_TOKEN_WHILE),
|
||||
PSAT("do", CPP_TOKEN_DO),
|
||||
PSAT("for", CPP_TOKEN_FOR),
|
||||
PSAT("goto", CPP_TOKEN_GOTO),
|
||||
PSAT("break", CPP_TOKEN_BREAK),
|
||||
PSAT("continue", CPP_TOKEN_CONTINUE),
|
||||
PSAT("throw", CPP_TOKEN_THROW),
|
||||
PSAT("throws", CPP_TOKEN_THROW),
|
||||
PSAT("try", CPP_TOKEN_TRY),
|
||||
PSAT("catch", CPP_TOKEN_CATCH),
|
||||
PSAT("finally", CPP_TOKEN_CATCH),
|
||||
};
|
||||
|
||||
parse_context_language_java = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
|
||||
|
|
|
@ -60,14 +60,14 @@ init_language_rust(Application_Links *app){
|
|||
PSAT("virtual", CPP_TOKEN_KEY_OTHER),
|
||||
PSAT("where", CPP_TOKEN_KEY_OTHER),
|
||||
|
||||
PSAT("break", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("continue", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("do", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("else", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("for", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("if", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("while", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("yield", CPP_TOKEN_KEY_CONTROL_FLOW),
|
||||
PSAT("break", CPP_TOKEN_BREAK),
|
||||
PSAT("continue", CPP_TOKEN_CONTINUE),
|
||||
PSAT("do", CPP_TOKEN_DO),
|
||||
PSAT("else", CPP_TOKEN_ELSE),
|
||||
PSAT("for", CPP_TOKEN_FOR),
|
||||
PSAT("if", CPP_TOKEN_IF),
|
||||
PSAT("while", CPP_TOKEN_WHILE),
|
||||
PSAT("yield", CPP_TOKEN_KEY_OTHER),
|
||||
};
|
||||
|
||||
parse_context_language_rust = create_parse_context(app, kw, ArrayCount(kw), 0, 0);
|
||||
|
|
Loading…
Reference in New Issue