jeffkararo wrote:
I can wait but out of curiosity what is the code fix that i can implement myself
Thanks
Not that hard
- in TDLParser, EnumsConstants.cs, to the Token enum, add HasTypedList, right above HasTypedView, and to the NonTerminalType enum, you add IfHasTypedListStart right above IfHasTypedViewStart.
- in TDLParser, Parser.cs, first create the regex for the token: scroll down and add this line right above the HasTypedView line:
// 'HasTypedList'
_tokenDefinitions.Add(new TDLTokenDefinition((int)Token.HasTypedList, @"HasTypedList", RegexOptions.Compiled | RegexOptions.IgnoreCase));
- in TDLParser, Parser.cs, go to the routine HandleIfStart(), and to the switch case statement, add:
case Token.HasTypedList:
// pop it
tokensInStatement.Add(_tokenStream.Dequeue());
toReturn = new NonTerminal(NonTerminalType.IfHasTypedListStart);
break;
The parser now recogizes the statement. We now have to add some code to the interpreter to get things done.
- in TDLInterpreter, Interpreter.cs: go to InnerIfHandler, and add:
case NonTerminalType.IfHasTypedListStart:
to the switch/case statement
- in TDLInterpreter, Interpreter.cs, go to HandleNonTerminal. Add to the if statements section of the switch/case statement:
case NonTerminalType.IfHasTypedListStart:
HandleIfHasTypedListStart();
break;
- in TDLInterpreter, Interpreter.cs, go to HandleIfHasTypedViewStart and place below it a copy of that routine and alter it so it handles typed lists. I've altered it for you below:
/// <summary>
/// Handles an if start of type 'IfHasTypedListStart'. Will walk the statements between the start and IfEnd statement, if
/// the expression resolves to true, otherwise all statements are skipped. Will keep track of nested ifs when skipping the
/// inner if body.
/// </summary>
private void HandleIfHasTypedListStart()
{
NonTerminal current = (NonTerminal)_parseTree[_nonTerminalIndex];
// negate the expression if a NOT is present.
bool negate = (((Token)((IToken)current.Tokens[2]).TokenID)==Token.Not);
bool executeIfBody = ((_typedLists.Count > 0)^negate);
if(executeIfBody)
{
// execute if statement
_nonTerminalIndex++;
InnerIfHandler();
}
else
{
// move current index to corresponding EndIf statement.
_nonTerminalIndex = current.CorrespondingEndNTIndex;
}
}
That's it Recompile the parser and interpreter, then place the compiled versions in the taskperformers folder of LLBLGen Pro (backup the originals first), and restart llblgen pro to use your new parser/interpreter