v1.0.0
This commit is contained in:
@@ -73,38 +73,38 @@ public class TemplateInterpreter
|
||||
|
||||
// Styled text - flush buffer, emit styled content, continue accumulating
|
||||
case StyledTextNode styledNode:
|
||||
FlushLineBuffer();
|
||||
|
||||
InterpretStyledText(styledNode, context, commands, style);
|
||||
break;
|
||||
|
||||
// Block nodes - flush buffer first, then process
|
||||
case SeparatorNode separatorNode:
|
||||
FlushLineBuffer();
|
||||
|
||||
InterpretSeparator(separatorNode, commands, style);
|
||||
break;
|
||||
|
||||
case EmptyLineNode:
|
||||
case NewLineNode:
|
||||
FlushLineBuffer();
|
||||
commands.Add(CreateCommand(string.Empty, style));
|
||||
break;
|
||||
|
||||
case IfNode ifNode:
|
||||
FlushLineBuffer();
|
||||
|
||||
InterpretIf(ifNode, context, commands, style);
|
||||
break;
|
||||
|
||||
case ForeachNode foreachNode:
|
||||
FlushLineBuffer();
|
||||
|
||||
InterpretForeach(foreachNode, context, commands, style);
|
||||
break;
|
||||
|
||||
case RowNode rowNode:
|
||||
FlushLineBuffer();
|
||||
|
||||
InterpretRow(rowNode, context, commands, style);
|
||||
break;
|
||||
|
||||
case ColumnNode columnNode:
|
||||
FlushLineBuffer();
|
||||
|
||||
InterpretColumn(columnNode, context, commands, style);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Inspectron.Epson.Templates.Language.Nodes;
|
||||
|
||||
public record EmptyLineNode(SourcePosition Position) : ITemplateNode
|
||||
public record NewLineNode(SourcePosition Position) : ITemplateNode
|
||||
{
|
||||
public IReadOnlyList<ITemplateNode> Children => Array.Empty<ITemplateNode>();
|
||||
}
|
||||
@@ -46,12 +46,10 @@ public class Parser
|
||||
{
|
||||
case TokenType.NewLine:
|
||||
Advance();
|
||||
// Check if this was an empty line (previous was also newline or start)
|
||||
if (_position >= 2 && _tokens[_position - 2].Type == TokenType.NewLine)
|
||||
{
|
||||
return new EmptyLineNode(token.Position);
|
||||
}
|
||||
return null;
|
||||
if(token.Position.Column==1)
|
||||
return new NewLineNode(token.Position);
|
||||
else
|
||||
return null;
|
||||
|
||||
case TokenType.Text:
|
||||
return ParseText();
|
||||
|
||||
@@ -139,7 +139,7 @@ public class TemplateValidator
|
||||
|
||||
case TextNode:
|
||||
case SeparatorNode:
|
||||
case EmptyLineNode:
|
||||
case NewLineNode:
|
||||
// No additional validation needed
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user