21 StringBuilder sb =
new StringBuilder();
25 sb.AppendLine(
"Validation failed:");
29 sb.AppendLine(
"Validation succeeded with warnings:");
33 sb.AppendLine(
"Validation succeeded.");
48 private readonly List<BadExpressionValidatorMessage>
m_Messages =
new List<BadExpressionValidatorMessage>();
64 private readonly List<BadExpressionValidator>
m_Validators =
new List<BadExpressionValidator>
Base Implementation for all Expressions used inside the Script.
IEnumerable< BadExpression > GetDescendantsAndSelf()
Returns all Descendants of the Expression and the Expression itself.
Base class for all expression validators.
void Validate(BadExpressionValidatorContext context, BadExpression expr)
Validates the given expression.
Checks if there are any constant expressions in the if branches conditions.
Checks for duplicate parameter names in function definitions.
Checks if there are any expressions in the for block.
Checks if there are any expressions in the foreach block.
Checks if there are any expressions in the if branches block.
Checks if there are any expressions in the lock block.
Checks if there are any expressions in the if branches block.
Checks if there are any expressions in the using block.
Checks if the function name is a reserved keyword.
Checks if the function parameter name is a reserved keyword.
Checks if the function has a return type but not all paths have a return statement.
Checks if the function has a return type but the return statement does not have an expression.
Checks if the function has no return type but returns a value.
Gets thrown by the runtime.
Contains the Function Expressions for the BadScript2 Language.
Contains the Expressions for the BadScript2 Language.
Contains the Expression Validators for the BadScript2 Language.
Contains the Comparison Operators for the BadScript2 Language.
BadExpressionValidatorMessageType
Defines the type of a BadExpressionValidatorMessage.
Contains the Error Objects for the BadScript2 Language.
Implements a context for expression validation.
readonly List< BadExpressionValidatorMessage > m_Messages
The messages generated by the validators.
BadExpressionValidatorContext()
Creates a new context.
readonly List< BadExpressionValidator > m_Validators
The validators used by this context.
BadExpressionValidatorContext ValidateExpressions(BadExpression expression)
Validates the given expression.
void AddWarning(string message, BadExpression parentExpression, BadExpression expression, BadExpressionValidator validator)
Adds a warning message to the context.
void AddError(string message, BadExpression parentExpression, BadExpression expression, BadExpressionValidator validator)
Adds an error message to the context.
BadExpressionValidatorContext ValidateExpressions(IEnumerable< BadExpression > expressions)
Validates the given expressions.
static void ValidateOrThrow(IEnumerable< BadExpression > expressions)
Validates the given expressions and throws an exception if there are any errors.
bool IsError
Indicates whether there are any messages of type Error.
static BadExpressionValidatorContext Validate(IEnumerable< BadExpression > expressions)
Validates the given expressions.
override string ToString()
Returns a string representation of the validation results.
void AddValidator(BadExpressionValidator validator)
Adds a validator to the context.
IReadOnlyList< BadExpressionValidatorMessage > Messages
The messages generated by the validators.
void AddInfo(string message, BadExpression parentExpression, BadExpression expression, BadExpressionValidator validator)
Adds an info message to the context.
Models a message from a BadExpressionValidator.
override string ToString()