1using System.Collections;
20 return context.InputNode.Name ==
"bs:each";
41 foreach (HtmlNode? child
in context.InputNode.ChildNodes)
52 HtmlAttribute? enumerationAttribute = context.
InputNode.Attributes[
"on"];
53 HtmlAttribute? itemAttribute = context.
InputNode.Attributes[
"as"];
55 if (enumerationAttribute ==
null)
59 "Missing 'on' attribute in 'bs:each' node",
64 if (itemAttribute ==
null)
68 "Missing 'as' attribute in 'bs:each' node",
73 if (
string.IsNullOrEmpty(enumerationAttribute.Value))
77 "Empty 'on' attribute in 'bs:each' node",
82 if (
string.IsNullOrEmpty(itemAttribute.Value))
86 "Empty 'as' attribute in 'bs:each' node",
92 enumerationAttribute.Value,
109 while (badEnumerator.MoveNext())
114 badEnumerator.Current ??
117 "Enumerator returned null",
125 case IEnumerable enumerable:
127 foreach (
object? o
in enumerable)
134 case IEnumerator enumerator:
136 while (enumerator.MoveNext())
150 "Result of 'on' attribute in 'bs:each' node is not enumerable",
Implements the Html Context for the Transformation Process.
BadSourcePosition CreateAttributePosition(HtmlAttribute attribute)
Creates the Source Position of the specified Attribute.
BadSourcePosition CreateOuterPosition()
Creates the Source Position of the current Input Nodes Outer Content.
BadHtmlContext CreateChild(HtmlNode inputNode, HtmlNode outputNode, BadExecutionContext? executionContext=null)
Creates a child context with the specified input, output node and optional execution context.
readonly HtmlNode InputNode
The Current Input Node.
readonly BadExecutionContext ExecutionContext
The Execution Context that is used to evaluate badscript code.
BadObject ParseAndExecuteSingle(string code, BadSourcePosition pos)
Parses and executes the specified code and returns the result of the last expression.
The Execution Context. Every execution of a script needs a context the script is running in....
BadScope Scope
The Root Scope of the Context.
BadScope CreateChild(string name, BadScope? caller, bool? useVisibility, BadScopeFlags flags=BadScopeFlags.RootScope)
Creates a subscope of the current scope.
Gets thrown by the runtime.
static BadRuntimeException Create(BadScope? scope, string message)
Creates a new BadScriptException.
The Base Class for all BadScript Objects.
Defines a BadScript Enumerable.
Defines a BadScript Enumerator.
Contains the Error Objects for the BadScript2 Language.
Contains the Interop Abstractions and Implementations for the BadScript2 Language.
Contains the Runtime Objects.
Contains the Runtime Implementation.
BadScopeFlags
Defines Different Behaviours for the Current Scope.