changed semantic of [def] statements:
- [def] is used to define a variable (like before) but if we assign a string such as [def var "string"] the string is evaluated to bool in a different way: empty string is false, not empty string is true - added [def?] statement - similar like [def] but define a variable only if such a variable is not already defined - added [let] statement - similar like [def] but with lazy evaluation (it is an alias to a function) if it is called to assign a string e.g. [let var "string"] then this has the same meaning like [def] - an alias is only created when we assign a function e.g. [let var my_function] both [def] and [let] are using the same Vars object - added [let?] - make an alias but only if such a variable is not already defined - a std::map of variables moved outside of Generator added method void SetVariables(Vars & variables); - fixed: a result status was not correctly propagated when evaluating [def] statements, this was in Call(...) function: last_res from variables was set in Find() but later was overwritten by Call(...) called for parameters (recursively)
This commit is contained in:
+4
-1
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007-2018, Tomasz Sowa
|
||||
* Copyright (c) 2007-2021, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -175,6 +175,9 @@ private:
|
||||
void ReadDirectiveComment(Item & item);
|
||||
void ReadDirectiveInclude(Item & item);
|
||||
void ReadDirectiveDef(Item & item);
|
||||
void ReadDirectiveDefIfNotSet(Item & item);
|
||||
void ReadDirectiveLet(Item & item);
|
||||
void ReadDirectiveLetIfNotSet(Item & item);
|
||||
void ReadDirectiveFilter(Item & item);
|
||||
void ReadDirectiveEzc(Item & item);
|
||||
void ReadDirectiveOut(Item & item);
|
||||
|
||||
Reference in New Issue
Block a user