added basic support for calling variables and functions from morm::Model objects

This commit is contained in:
2021-05-31 18:37:09 +02:00
parent 052f803eac
commit e6fd9aad37
8 changed files with 384 additions and 23 deletions

View File

@@ -486,7 +486,7 @@ bool PatternParser::IsNameChar(wchar_t c)
return ((c>='a' && c<='z') ||
(c>='A' && c<='Z') ||
(c>='0' && c<='9') ||
c=='_' || c=='-' || c=='.' || c=='#' || c=='?');
c=='_' || c=='-' || c=='#' || c=='?');
}
@@ -622,7 +622,28 @@ return res;
}
void PatternParser::ReadFunctionFields(Item::Function & function)
{
std::wstring field;
bool read_next_field = true;
while( *itext == '.' && read_next_field )
{
itext += 1;
read_next_field = ReadName(field);
if( read_next_field )
{
function.fields.emplace_back(field);
}
}
if( *itext == ':' )
{
itext += 1;
ReadName(function.postfix); // we allow the postfix to be empty
}
}
bool PatternParser::ReadFunction(Item::Function & function, bool with_params)
@@ -654,14 +675,12 @@ bool PatternParser::ReadFunction(Item::Function & function, bool with_params)
if( res )
{
if( *itext == ':' )
{
itext += 1;
ReadName(function.postfix); // we allow the postfix to be empty
}
ReadFunctionFields(function);
if( with_params )
{
res = ReadParams(function);
}
}
}