Ejemplo n.º 1
0
 /// <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;
 }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
 /// <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;
 }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
 protected virtual PoolConstantDefinitionNode CreatePoolConstantDefinitionNode(IdentifierToken poolName)
 {
     return new PoolConstantDefinitionNode(poolName);
 }
Ejemplo n.º 6
0
 protected virtual GlobalInitializationNode CreateGlobalInitializationNode(IdentifierToken globalName)
 {
     return new GlobalInitializationNode(globalName);
 }
Ejemplo n.º 7
0
 protected virtual InstanceMethodDefinitionNode CreateInstanceMethodDefinitionNode(IdentifierToken className)
 {
     return new InstanceMethodDefinitionNode(className);
 }
Ejemplo n.º 8
0
 public InstanceMethodDefinitionNode(IdentifierToken className)
     : base(className)
 {
 }
Ejemplo n.º 9
0
 protected virtual ClassMethodDefinitionNode CreateClassMethodDefinitionNode(IdentifierToken className)
 {
     return new ClassMethodDefinitionNode(className);
 }
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
 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;
 }
Ejemplo n.º 12
0
 public PoolConstantDefinitionNode(IdentifierToken poolName)
     : base(poolName)
 {
 }
Ejemplo n.º 13
0
 public PoolItemDefinitionNode(IdentifierToken poolName)
 {
     if (poolName == null)
         throw new ArgumentNullException();
     this.PoolName = poolName;
 }
Ejemplo n.º 14
0
 /// <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;
 }
Ejemplo n.º 15
0
 public PoolVariableDefinitionNode(IdentifierToken poolName)
     : base(poolName)
 {
 }
Ejemplo n.º 16
0
 protected virtual UnaryMessageNode ParseUnaryMessage(MessageSequenceBase parent, IdentifierToken token)
 {
     // PARSE: <unary message> ::= unarySelector
     return new UnaryMessageNode(parent, token);
 }
Ejemplo n.º 17
0
 // 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;
 }
Ejemplo n.º 18
0
 public MethodDefinitionNode(IdentifierToken className)
 {
     if (className == null)
         throw new ArgumentNullException();
     this.ClassName = className;
 }
Ejemplo n.º 19
0
 protected virtual PoolValueInitializationNode CreatePoolValueInitializationNode(IdentifierToken poolName)
 {
     return new PoolValueInitializationNode(poolName);
 }
Ejemplo n.º 20
0
 /// <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;
 }
Ejemplo n.º 21
0
 protected virtual PoolVariableDefinitionNode CreatePoolVariableDefinitionNode(IdentifierToken poolName)
 {
     return new PoolVariableDefinitionNode(poolName);
 }
Ejemplo n.º 22
0
        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;
        }
Ejemplo n.º 23
0
 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;
 }
Ejemplo n.º 24
0
        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;
        }
Ejemplo n.º 25
0
 /// <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;
 }
Ejemplo n.º 26
0
 public ClassMethodDefinitionNode(IdentifierToken className)
     : base(className)
 {
 }
Ejemplo n.º 27
0
 public GlobalInitializationNode(IdentifierToken globalName)
 {
     if (globalName == null)
         throw new ArgumentNullException();
     this.GlobalName = globalName;
 }
Ejemplo n.º 28
0
 /// <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;
 }
Ejemplo n.º 30
0
        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;
        }