/// <summary> /// Create and initialize a new variable parse node. /// </summary> /// <param name="token">Identifier token containing the name of the variable.</param> protected VariableNode(IdentifierToken token) { #if DEBUG if (token == null) throw new ArgumentNullException("token"); #endif this.Token = token; }
/// <summary> /// Create a new method argument. /// </summary> /// <param name="parent">Method node that defines the method argument.</param> /// <param name="token">Identifier token containing the name of the argument.</param> protected internal MethodArgumentNode(MethodNode parent, IdentifierToken token) : base(token) { #if DEBUG if (parent == null) throw new ArgumentNullException("parent"); #endif this.Parent = parent; }
/// <summary> /// Create a new block argument. /// </summary> /// <param name="parent">Block closure that defines the argument node.</param> /// <param name="colon">Colon that preceeds the argument name.</param> /// <param name="token">Identifier token containing the name of the argument.</param> protected internal BlockArgumentNode(BlockNode parent, SpecialCharacterToken colon, IdentifierToken token) : base(token) { #if DEBUG if (parent == null) throw new ArgumentNullException("parent"); if (colon == null) throw new ArgumentNullException("colon"); #endif this.Colon = colon; this.Parent = parent; }
/// <summary> /// Create and initialize a new assignment expression. /// </summary> /// <param name="parent">Parent node that defines this expression.</param> /// <param name="identifier">Identifier token of the assignment target.</param> /// <param name="token">Token representing the assignment operator.</param> protected internal AssignmentNode(SemanticNode parent, IdentifierToken identifier, AssignmentOperatorToken token) : base(parent) { #if DEBUG if (identifier == null) throw new ArgumentNullException("identifier"); if (token == null) throw new ArgumentNullException("token"); #endif this.Target = new AssignmentTargetNode(this, identifier); this.AssignmentOperator = token; }
protected virtual PoolConstantDefinitionNode CreatePoolConstantDefinitionNode(IdentifierToken poolName) { return new PoolConstantDefinitionNode(poolName); }
protected virtual GlobalInitializationNode CreateGlobalInitializationNode(IdentifierToken globalName) { return new GlobalInitializationNode(globalName); }
protected virtual InstanceMethodDefinitionNode CreateInstanceMethodDefinitionNode(IdentifierToken className) { return new InstanceMethodDefinitionNode(className); }
public InstanceMethodDefinitionNode(IdentifierToken className) : base(className) { }
protected virtual ClassMethodDefinitionNode CreateClassMethodDefinitionNode(IdentifierToken className) { return new ClassMethodDefinitionNode(className); }
protected virtual GlobalInitializationNode ParseGlobalInitialization(IdentifierToken globalName) { // PARSE: <classInitialization> ::= <className> ’initializer’ <elementSeparator> // <globalValueInitialization> ::= <globalName> ’initializer’ <elementSeparator> // NB: Classes are threated as globals (classes are globals). GlobalInitializationNode result = this.CreateGlobalInitializationNode(globalName); Token token = this.GetNextTokenxx(); if (!(token is EofToken)) this.ReportParserError(result, "Unexpected code found after global or class initializer.", token); return result; }
protected virtual PoolVariableDefinitionNode ParsePoolVariableDefinition(IdentifierToken poolName) { // PARSE: <poolVariableDefinition> ::= <poolName> ’variable:’ <poolVariableNameString> <elementSeparator> PoolVariableDefinitionNode result = this.CreatePoolVariableDefinitionNode(poolName); Token token = this.GetNextTokenxx(); StringToken name = token as StringToken; if (name == null) { this.ReportParserError(result, "Missing pool variable name.", token); return result; } name = this.VerifyIdentifierString(name, "Pool variable name not an identifier."); result.PoolVariableName = name; token = this.GetNextTokenxx(); if (!(token is EofToken)) this.ReportParserError(result, "Unexpected code found after pool variable name.", token); return result; }
public PoolConstantDefinitionNode(IdentifierToken poolName) : base(poolName) { }
public PoolItemDefinitionNode(IdentifierToken poolName) { if (poolName == null) throw new ArgumentNullException(); this.PoolName = poolName; }
/// <summary> /// Create and initialize a new TemporaryVariableNode. /// </summary> /// <param name="parent">The function node that defines this temporary variable.</param> /// <param name="token">Identifier token containing the variable name.</param> protected internal TemporaryVariableNode(FunctionNode parent, IdentifierToken token) : base(token) { #if DEBUG if (parent == null) throw new ArgumentNullException("parent"); #endif this.Parent = parent; }
public PoolVariableDefinitionNode(IdentifierToken poolName) : base(poolName) { }
protected virtual UnaryMessageNode ParseUnaryMessage(MessageSequenceBase parent, IdentifierToken token) { // PARSE: <unary message> ::= unarySelector return new UnaryMessageNode(parent, token); }
// Constant Binding - cannot be changed /// <summary> /// Create a new argument node. /// </summary> /// <param name="token">Identifier token containing the name of the argument.</param> protected ArgumentNode(IdentifierToken token) { this.Token = token; }
public MethodDefinitionNode(IdentifierToken className) { if (className == null) throw new ArgumentNullException(); this.ClassName = className; }
protected virtual PoolValueInitializationNode CreatePoolValueInitializationNode(IdentifierToken poolName) { return new PoolValueInitializationNode(poolName); }
/// <summary> /// Create a new variable reference node. /// </summary> /// <param name="parent">The parent node that defines this node.</param> /// <param name="token">Identifier token containing the name of the variable.</param> protected internal VariableReferenceleNode(IPrimaryParentNode parent, IdentifierToken token) { #if DEBUG if (parent == null) throw new ArgumentNullException("parent"); if (token == null) throw new ArgumentNullException("token"); #endif this.Parent = parent; this.Token = token; }
protected virtual PoolVariableDefinitionNode CreatePoolVariableDefinitionNode(IdentifierToken poolName) { return new PoolVariableDefinitionNode(poolName); }
protected virtual UnaryBinaryMessageSequenceNode ParseUnaryBinaryMessageSequence(IMessageSequenceParentNode parent, IdentifierToken selector) { // PARSE: <unary message>* <binary message>* UnaryBinaryMessageSequenceNode result = new UnaryBinaryMessageSequenceNode(parent); // NB: ParseUnaryMessage() cannot fail, so we don't check result UnaryMessageNode message = this.ParseUnaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); BinaryOrBinaryUnaryMessageSequenceNode nextMessage = null; if (token is IdentifierToken) // <unary message>* nextMessage = this.ParseUnaryBinaryMessageSequence(result, (IdentifierToken)token); else if (token is BinarySelectorToken) // <binary message>* nextMessage = this.ParseBinaryMessageSequence(result, (BinarySelectorToken)token); else this.ResidueToken = token; result.SetContents(message, nextMessage); return result; }
protected virtual InstanceMethodDefinitionNode ParseInstanceMethodDefinition(IdentifierToken className) { // PARSE: <methodDefinition> ::= <className> ’method’ <elementSeparator> InstanceMethodDefinitionNode result = this.CreateInstanceMethodDefinitionNode(className); Token token = this.GetNextTokenxx(); if (!(token is EofToken)) this.ReportParserError(result, "Unexpected code found after method definition.", token); return result; }
protected virtual UnaryBinaryKeywordMessageSequenceNode ParseUnaryBinaryKeywordMessageSequence(IMessageSequenceParentNode parent, IdentifierToken selector) { // PARSE: // <unary message>+ <binary message>* [<keyword message>] UnaryBinaryKeywordMessageSequenceNode result = new UnaryBinaryKeywordMessageSequenceNode(parent); // NB: ParseUnaryMessage() cannot fail, so we don't check result UnaryMessageNode message = this.ParseUnaryMessage(result, selector); Token token = this.GetNextTokenxx(Preference.Default); MessageSequenceNode nextMessage = this.ParseMessages(result, token, MessageType.All); result.SetContents(message, nextMessage); return result; }
/// <summary> /// Create a new assignment target (variable reference) node. /// </summary> /// <param name="parent">The parent node that defines this node.</param> /// <param name="token">Identifier token containing the name of the variable.</param> protected internal AssignmentTargetNode(AssignmentNode parent, IdentifierToken token) { #if DEBUG if (parent == null) throw new ArgumentNullException("parent"); if (token == null) throw new ArgumentNullException("token"); #endif this.Parent = parent; this.Token = token; }
public ClassMethodDefinitionNode(IdentifierToken className) : base(className) { }
public GlobalInitializationNode(IdentifierToken globalName) { if (globalName == null) throw new ArgumentNullException(); this.GlobalName = globalName; }
/// <summary> /// Create and initialize a new unary message node. /// </summary> /// <param name="parent">The parent message sequence node that defines this message node.</param> /// <param name="token">Token containing the message selector.</param> protected internal UnaryMessageNode(MessageSequenceBase parent, IdentifierToken token) : base(parent) { #if DEBUG if (token == null) throw new ArgumentNullException("token"); #endif this.SelectorToken = token; }
public PoolValueInitializationNode(IdentifierToken poolName) { if (poolName == null) throw new ArgumentNullException(); this.PoolName = poolName; }
protected virtual AssignmentNode ParseAssignment(SemanticNode parent, IdentifierToken identifier, AssignmentOperatorToken assignmentOperator) { // PARSE: <assignment> ::= <assignment target> assignmentOperator <expression> // <assignment target> := identifier AssignmentNode result = new AssignmentNode(parent, identifier, assignmentOperator); Token token = this.GetNextTokenxx(Preference.NegativeSign); ExpressionNode expression = this.ParseExpression(result, token); if (expression == null) this.ReportParserError(result, SemanticErrors.MissingExpression, token); else result.SetContents(expression); return result; }