private static void HandleEachOverExpression(SuperSimpleTemplateParserState state) { var each = SyntaxTree.Iterate( state.ParseCurrentTokenExpression(), SyntaxTree.Block() ); state.AddNodeToCurrentBlock(each); state.PushNewScope(each.Body, each.ItemType); }
private static void HandlePositiveConditional(SuperSimpleTemplateParserState state) { var condition = SyntaxTree.Conditional( state.ParseCurrentTokenExpression(), SyntaxTree.Block() ); state.AddNodeToCurrentBlock(condition); state.PushNewScope(condition.TrueBlock); }
private static void HandlePartial(SuperSimpleTemplateParserState state) { var details = state.ParseCurrentTokenNameAndModelExpression(); ExpressionNode expression = Expression.Self(state.CurrentTypeInScope()); if (!String.IsNullOrEmpty(details.Model)) { expression = state.ParseExpression(details.Model); } state.AddNodeToCurrentBlock(SyntaxTree.Include(details.Name, expression)); }
private static void HandleWriteLiteral(SuperSimpleTemplateParserState state) { var expression = state.CurrentToken.Content; var htmlEncode = false; if (expression.StartsWith("!")) { htmlEncode = true; expression = expression.Substring(1); } state.AddNodeToCurrentBlock(SyntaxTree.WriteExpression(state.ParseExpression(expression), htmlEncode)); }
private static void HandleStringLiteral(SuperSimpleTemplateParserState state) { state.AddNodeToCurrentBlock(SyntaxTree.WriteString(state.CurrentToken.Content)); }
private static void HandleFlush(SuperSimpleTemplateParserState state) { state.AddNodeToCurrentBlock(SyntaxTree.Flush()); }
private static void HandleSection(SuperSimpleTemplateParserState state) { var details = state.ParseCurrentTokenNameAndModelExpression(); state.AddNodeToCurrentBlock(SyntaxTree.Override(details.Name)); }
private static void HandlePartial(SuperSimpleTemplateParserState state) { var details = state.ParseCurrentTokenNameAndModelExpression(); ExpressionNode expression = SyntaxTreeExpression.Self(state.CurrentTypeInScope()); if (!String.IsNullOrEmpty(details.Model)) { expression = state.ParseExpression(details.Model); } state.AddNodeToCurrentBlock(SyntaxTree.Include(details.Name, expression)); }