mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-07 08:08:48 +00:00
Switch to map_proposal.
This commit is contained in:
@@ -516,11 +516,11 @@ GeneratePageContent(MD_NodeTable *index_table, SiteInfo *site_info, PageInfo *pa
|
|||||||
for(MD_NodeTableSlot *slot = MD_NodeTable_Lookup(index_table, index_string->string);
|
for(MD_NodeTableSlot *slot = MD_NodeTable_Lookup(index_table, index_string->string);
|
||||||
slot; slot = slot->next)
|
slot; slot = slot->next)
|
||||||
{
|
{
|
||||||
if(slot->node)
|
if(slot->value)
|
||||||
{
|
{
|
||||||
PageInfo info = ParsePageInfo(slot->node);
|
PageInfo info = ParsePageInfo((MD_Node *)slot->value);
|
||||||
|
|
||||||
MD_String8 filename = slot->node->filename;
|
MD_String8 filename = ((MD_Node *)slot->value)->filename;
|
||||||
MD_String8 filename_no_ext = MD_ChopExtension(MD_SkipFolder(filename));
|
MD_String8 filename_no_ext = MD_ChopExtension(MD_SkipFolder(filename));
|
||||||
MD_String8 link = MD_PushStringF("%.*s.html", MD_StringExpand(filename_no_ext));
|
MD_String8 link = MD_PushStringF("%.*s.html", MD_StringExpand(filename_no_ext));
|
||||||
MD_String8 name = info.title->string;
|
MD_String8 name = info.title->string;
|
||||||
|
|||||||
+4
-1
@@ -385,7 +385,7 @@ typedef enum MD_MessageKind
|
|||||||
MD_MessageKind;
|
MD_MessageKind;
|
||||||
|
|
||||||
//~ String-To-Node table
|
//~ String-To-Node table
|
||||||
|
#if 0
|
||||||
typedef enum MD_NodeTableCollisionRule
|
typedef enum MD_NodeTableCollisionRule
|
||||||
{
|
{
|
||||||
MD_NodeTableCollisionRule_Chain,
|
MD_NodeTableCollisionRule_Chain,
|
||||||
@@ -407,6 +407,9 @@ struct MD_NodeTable
|
|||||||
MD_u64 table_size;
|
MD_u64 table_size;
|
||||||
MD_NodeTableSlot **table;
|
MD_NodeTableSlot **table;
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
#include "map_proposal.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
//~ Token kinds.
|
//~ Token kinds.
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -947,7 +947,7 @@ MD_S32FromS8(MD_String8 in)
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
MD_PRIVATE_FUNCTION_IMPL void
|
MD_PRIVATE_FUNCTION_IMPL void
|
||||||
_MD_NodeTable_Initialize(MD_NodeTable *table)
|
_MD_NodeTable_Initialize(MD_NodeTable *table)
|
||||||
{
|
{
|
||||||
@@ -1027,6 +1027,9 @@ MD_NodeTable_Insert(MD_NodeTable *table, MD_NodeTableCollisionRule collision_rul
|
|||||||
|
|
||||||
return !!slot;
|
return !!slot;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#include "map_proposal.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
MD_FUNCTION_IMPL MD_b32
|
MD_FUNCTION_IMPL MD_b32
|
||||||
MD_TokenKindIsWhitespace(MD_TokenKind kind)
|
MD_TokenKindIsWhitespace(MD_TokenKind kind)
|
||||||
@@ -1990,7 +1993,7 @@ MD_ParseWholeString(MD_String8 filename, MD_String8 contents)
|
|||||||
MD_NodeTable_Insert(&ctx.namespace_table, MD_NodeTableCollisionRule_Overwrite, token.string, ns);
|
MD_NodeTable_Insert(&ctx.namespace_table, MD_NodeTableCollisionRule_Overwrite, token.string, ns);
|
||||||
existing_namespace_slot = MD_NodeTable_Lookup(&ctx.namespace_table, token.string);
|
existing_namespace_slot = MD_NodeTable_Lookup(&ctx.namespace_table, token.string);
|
||||||
}
|
}
|
||||||
ctx.selected_namespace = existing_namespace_slot->node;
|
ctx.selected_namespace = (MD_Node *)existing_namespace_slot->value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+6
-6
@@ -251,7 +251,7 @@ static void ExpandRule(MD_Node *rule, MD_String8List *out_strings, MD_Node *cur_
|
|||||||
}
|
}
|
||||||
else // NOTE(mal): Non-terminal production
|
else // NOTE(mal): Non-terminal production
|
||||||
{
|
{
|
||||||
MD_Node * production = MD_NodeTable_Lookup(globals.production_table, rule_element->string)->node;
|
MD_Node * production = MD_NodeTable_Lookup(globals.production_table, rule_element->string)->value;
|
||||||
MD_Assert(production);
|
MD_Assert(production);
|
||||||
ExpandProduction(production, out_strings, cur_node, op_flags, max_depth, depth+1);
|
ExpandProduction(production, out_strings, cur_node, op_flags, max_depth, depth+1);
|
||||||
}
|
}
|
||||||
@@ -314,7 +314,7 @@ static MD_Node * FindNonTerminalProduction(MD_Node *node, MD_NodeTable *visited)
|
|||||||
MD_NodeTableSlot *slot = MD_NodeTable_Lookup(globals.production_table, node->string);
|
MD_NodeTableSlot *slot = MD_NodeTable_Lookup(globals.production_table, node->string);
|
||||||
if(slot)
|
if(slot)
|
||||||
{
|
{
|
||||||
MD_Node *production = slot->node;
|
MD_Node *production = slot->value;
|
||||||
result = FindNonTerminalProduction(production, visited);
|
result = FindNonTerminalProduction(production, visited);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -429,7 +429,7 @@ static void ComputeElementDepth(MD_Node *re)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MD_Node * production = MD_NodeTable_Lookup(globals.production_table, re->string)->node;
|
MD_Node * production = MD_NodeTable_Lookup(globals.production_table, re->string)->value;
|
||||||
result = GET_DEPTH(production)+1;
|
result = GET_DEPTH(production)+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,7 +592,7 @@ int main(int argument_count, char **arguments)
|
|||||||
fprintf(stderr, "Error: Grammar file does not specify \"file\" production\n");
|
fprintf(stderr, "Error: Grammar file does not specify \"file\" production\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
file_production = file_production_slot->node;
|
file_production = file_production_slot->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE(mal): Check that all branches lead to terminal nodes
|
// NOTE(mal): Check that all branches lead to terminal nodes
|
||||||
@@ -641,7 +641,7 @@ int main(int argument_count, char **arguments)
|
|||||||
MD_Assert(MD_NodeIsNil(rule_element->first_child));
|
MD_Assert(MD_NodeIsNil(rule_element->first_child));
|
||||||
if(!(rule_element->flags & MD_NodeFlag_CharLiteral))
|
if(!(rule_element->flags & MD_NodeFlag_CharLiteral))
|
||||||
{
|
{
|
||||||
MD_Node * production = MD_NodeTable_Lookup(globals.production_table, rule_element->string)->node;
|
MD_Node * production = MD_NodeTable_Lookup(globals.production_table, rule_element->string)->value;
|
||||||
depth = GET_DEPTH(production);
|
depth = GET_DEPTH(production);
|
||||||
}
|
}
|
||||||
depth += 1;
|
depth += 1;
|
||||||
@@ -694,7 +694,7 @@ int main(int argument_count, char **arguments)
|
|||||||
|
|
||||||
RandomSeries random_series = rand_seed(0, 0); // NOTE(mal): Reproduceable
|
RandomSeries random_series = rand_seed(0, 0); // NOTE(mal): Reproduceable
|
||||||
globals.random_series = &random_series;
|
globals.random_series = &random_series;
|
||||||
MD_Node* file_production_node = MD_NodeTable_Lookup(globals.production_table, MD_S8Lit("file"))->node;
|
MD_Node* file_production_node = MD_NodeTable_Lookup(globals.production_table, MD_S8Lit("file"))->value;
|
||||||
|
|
||||||
// NOTE(mal): Generate test_count unique tests, sorted by complexity
|
// NOTE(mal): Generate test_count unique tests, sorted by complexity
|
||||||
MD_u32 test_count = 1000;
|
MD_u32 test_count = 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user