Partially working with nested conditionals.

Some of the conditional-skip code is a bit wrong...
This commit is contained in:
2025-09-16 04:52:29 -04:00
parent a96dbe2953
commit 245099c07a
4 changed files with 163 additions and 11 deletions

View File

@ -42,14 +42,20 @@ namespace Dillo::Hydrogen::JavaScriptForge ::detail:: StackMachine_m
using Float= long double;
std::map< std::string, std::string > words;
std::map< std::string, std::vector< std::string > > words;
// Which side of the current conditional to take.
enum ConditionalState { If, Else };
enum ConditionalState { If, Else, Skipped };
std::vector< ConditionalState > conditionals;
std::vector< ConditionalState > resumeConditionals;
ConditionalState currentState;
std::optional< std::string > definition;
std::ostream &output;
void runWord( std::string_view word );
std::string pop();
@ -63,7 +69,7 @@ namespace Dillo::Hydrogen::JavaScriptForge ::detail:: StackMachine_m
template< typename T >
void push( const T &t );
std::ostream &output;
std::string next();
public:
StackMachine( std::ostream &output= std::cout );