/// <summary> /// Returns a version of this node type that represents its error state; in case of a syntax error /// in the node that prevents the node from being even partially built. /// </summary> /// <param name="sourceCodeRange">The source code range of the error.</param> /// <returns>A version of this node type in its undefined/error state.</returns> public static LSLFunctionCallNode GetError(LSLSourceCodeRange sourceCodeRange) { return(new LSLFunctionCallNode(sourceCodeRange, Err.Err)); }
LSLReturnStatementNode GetError(LSLSourceCodeRange sourceRange) { return(new LSLReturnStatementNode(sourceRange, Err.Err)); }
private LSLReturnStatementNode(LSLSourceCodeRange sourceRange, Err err) // ReSharper restore UnusedParameter.Local { SourceRange = sourceRange; HasErrors = true; }
/// <summary> /// Returns a version of this node type that represents its error state; in case of a syntax error /// in the node that prevents the node from being even partially built. /// </summary> /// <param name="sourceRange">The source code range of the error.</param> /// <returns>A version of this node type in its undefined/error state.</returns> public static LSLStringLiteralNode GetError(LSLSourceCodeRange sourceRange) { return(new LSLStringLiteralNode(sourceRange, Err.Err)); }
private LSLStringLiteralNode(LSLSourceCodeRange sourceRange, Err err) : base(sourceRange, Err.Err) // ReSharper restore UnusedParameter.Local { }
/// <summary> /// Construct an <see cref="LSLVariableNode" /> that references a library constant. /// </summary> /// <param name="type">The constants type.</param> /// <param name="constantName">The constants name.</param> /// <param name="sourceRange">Optional source range for the area the reference exists in.</param> /// <exception cref="ArgumentNullException"><paramref name="constantName" /> is <c>null</c>.</exception> /// <exception cref="ArgumentException"> /// <paramref name="type" /> is <see cref="LSLType.Void" />. /// </exception> /// <exception cref="LSLInvalidSymbolNameException"><paramref name="constantName" /> is contains characters that are invalid in an LSL ID token.</exception> internal static LSLVariableNode CreateLibraryConstantReference(LSLType type, string constantName, LSLSourceCodeRange sourceRange = null) { if (constantName == null) { throw new ArgumentNullException("constantName"); } if (type == LSLType.Void) { throw new ArgumentException( typeof(LSLVariableNode).Name + ".CreateLibraryConstant: type cannot be LSLType.Void.", "type"); } if (!LSLTokenTools.IDRegexAnchored.IsMatch(constantName)) { throw new LSLInvalidSymbolNameException( typeof(LSLVariableNode).Name + ".CreateLibraryConstant: name contains invalid ID characters."); } return(new LSLVariableNode { Name = constantName, TypeName = type.ToLSLTypeName(), Type = type, ExpressionType = LSLExpressionType.LibraryConstant, IsConstant = true, SourceRange = sourceRange }); }
private LSLVariableNode(LSLSourceCodeRange sourceRange, Err err) // ReSharper restore UnusedParameter.Local { SourceRange = sourceRange; HasErrors = true; }
/// <summary> /// Construct an <see cref="LSLVariableNode" /> that references a local parameter node. /// </summary> /// <param name="declarationNode">A parameter node that declares the parameter variable.</param> /// <param name="sourceRange">Optional source range for the area the reference exists in.</param> internal static LSLVariableNode CreateParameterReference(ILSLParameterNode declarationNode, LSLSourceCodeRange sourceRange = null) { return(new LSLVariableNode { Name = declarationNode.Name, TypeName = declarationNode.Type.ToLSLTypeName(), Type = declarationNode.Type, ExpressionType = LSLExpressionType.ParameterVariable, IsConstant = false, SourceRange = sourceRange }); }
/// <summary> /// Construct an <see cref="LSLVariableNode" /> that references a local variable declaration node. /// </summary> /// <param name="declarationNode">A variable declaration node.</param> /// <param name="variableName">The name of the local variable.</param> /// <param name="type">The type of the local variable.</param> /// <param name="sourceRange">Optional source range for the area the reference exists in.</param> /// <returns>A new variable node representing a reference to <paramref name="declarationNode" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="declarationNode" /> is <c>null</c>.</exception> /// <exception cref="ArgumentException"> /// <paramref name="type" /> is <see cref="LSLType.Void" /> or /// </exception> /// <exception cref="LSLInvalidSymbolNameException"><paramref name="variableName" /> contains characters that are not valid in an LSL ID token.</exception> internal static LSLVariableNode CreateLocalVarReference(LSLType type, string variableName, ILSLVariableDeclarationNode declarationNode, LSLSourceCodeRange sourceRange = null) { if (declarationNode == null) { throw new ArgumentNullException("declarationNode"); } if (type == LSLType.Void) { throw new ArgumentException("local variable type cannot be LSLType.Void", "type"); } if (!LSLTokenTools.IDRegexAnchored.IsMatch(variableName)) { throw new LSLInvalidSymbolNameException( "variableName provided contained characters not allowed in an LSL ID token."); } return(new LSLVariableNode { Name = variableName, TypeName = type.ToLSLTypeName(), Type = type, IsConstant = false, Declaration = declarationNode, ExpressionType = LSLExpressionType.LocalVariable, SourceRange = sourceRange }); }
LSLVariableNode GetError(LSLSourceCodeRange sourceRange) { return(new LSLVariableNode(sourceRange, Err.Err)); }
/// <summary> /// Add an <see cref="LSLSourceCodeRange" /> for a comma in the expression list. /// This method does NOT clone <paramref name="sourceRange" /> for you. /// </summary> /// <param name="sourceRange"></param> internal void AddCommaSourceRange(LSLSourceCodeRange sourceRange) { _sourceRangeCommaList.Add(sourceRange); }
/// <summary> /// Returns a version of this node type that represents its error state; in case of a syntax error /// in the node that prevents the node from being even partially built. /// </summary> /// <param name="sourceRange">The source code range of the error.</param> /// <returns>A version of this node type in its undefined/error state.</returns> public static LSLExpressionListNode GetError(LSLSourceCodeRange sourceRange) { return(new LSLExpressionListNode(sourceRange, Err.Err)); }