Skip to content

Commit

Permalink
Merge branch 'fix/lua-templateparser'
Browse files Browse the repository at this point in the history
Improve the processing of the template macros `#utbl` and `#wxparent`
in the Lua code generator.
  • Loading branch information
sodevel committed Jul 17, 2024
2 parents 1146e49 + cc923b7 commit c2564cb
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 90 deletions.
12 changes: 11 additions & 1 deletion src/codegen/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ bool TemplateParser::ParseMacro()

ident = ParseIdent();
switch (ident) {
case ID_NOP:
return ParseNop();
case ID_WXPARENT:
return ParseWxParent();
break;
Expand Down Expand Up @@ -307,6 +309,12 @@ bool TemplateParser::ParseText()
return true;
}

bool TemplateParser::ParseNop()
{
ignore_whitespaces();
return true;
}

bool TemplateParser::ParseInnerTemplate()
{
return true;
Expand Down Expand Up @@ -860,7 +868,9 @@ TemplateParser::Ident TemplateParser::SearchIdent(wxString ident)
{
// LogDebug("Parsing command %s",ident);

if (ident == wxT("wxparent"))
if (ident == "nop")
return ID_NOP;
else if (ident == wxT("wxparent"))
return ID_WXPARENT;
else if (ident == wxT("ifnotnull"))
return ID_IFNOTNULL;
Expand Down
2 changes: 2 additions & 0 deletions src/codegen/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ class TemplateParser

typedef enum {
ID_ERROR,
ID_NOP,
ID_WXPARENT,
ID_PARENT,
ID_FORM,
Expand Down Expand Up @@ -201,6 +202,7 @@ class TemplateParser
Token GetNextToken();


bool ParseNop();
bool ParseInnerTemplate();
bool ParseWxParent();
bool ParseParent();
Expand Down
Loading

0 comments on commit c2564cb

Please sign in to comment.