public InterfaceMethodDeclaringNode(IdentifierNode ident, TypeNode type, ParameterSequenceNode parameters,
                                     SourceCodePosition pos) : base(pos)
 {
     Identifier = ident;
     Type       = type;
     Parameters = parameters;
 }
 public ConstructorDeclaringNode(IdentifierNode ident, TypeNode type, ParameterSequenceNode parameters, DeclaringSequenceNode vars,
                                 ActionSequenceNode actions, SourceCodePosition pos) : base(pos)
 {
     Identifier    = ident;
     Type          = type;
     Parameters    = parameters;
     VarDeclarings = vars;
     Actions       = actions;
 }
Beispiel #3
0
 public MethodDeclaringNode(IdentifierNode ident, TypeNode type, ParameterSequenceNode parameters,
                            DeclaringSequenceNode vars, ActionSequenceNode actions, ReturnActionNode ret, SourceCodePosition pos)
     : base(pos)
 {
     Identifier    = ident;
     Type          = type;
     Parameters    = parameters;
     VarDeclarings = vars;
     Actions       = actions;
     Return        = ret;
 }
Beispiel #4
0
        private DeclaringNode ParseInterfaceMethod()
        {
            DeclaringNode      itsAST;
            SourceCodePosition itsPos = _currentToken.SourcePosition;

            Accept(Token.TokenType.Method);
            TypeNode       itsType = ReturnType();
            IdentifierNode itsName = new IdentifierNode(_currentToken, itsType);

            Accept(Token.TokenType.Identifier);
            Accept(Token.TokenType.LeftParen);
            ParameterSequenceNode itsParams = Parameters();

            Accept(Token.TokenType.RightParen);
            Accept(Token.TokenType.Semicolon);
            itsAST = new InterfaceMethodDeclaringNode(itsName, itsType, itsParams, itsPos);
            return(itsAST);
        }
Beispiel #5
0
        private ParameterSequenceNode ParseParameters()
        {
            ParameterSequenceNode itsAST;
            SourceCodePosition    itsPos   = _currentToken.SourcePosition;
            ParameterNode         itsParam = ParseParameter();

            if (_currentToken.Type == Token.TokenType.Comma)
            {
                Accept(Token.TokenType.Comma);
                ParameterSequenceNode nextParams = ParseParameters();
                itsAST = new MultipleParameterSequenceNode(itsParam, nextParams, itsPos);
            }
            else
            {
                itsAST = new SingleParameterSequenceNode(itsParam, itsPos);
            }
            return(itsAST);
        }
Beispiel #6
0
        private ConstructorDeclaringNode ConstructorDeclaring()
        {
            ConstructorDeclaringNode itsAST;
            SourceCodePosition       itsPos = _currentToken.SourcePosition;

            Accept(Token.TokenType.Constructor);
            IdentifierNode itsName = new IdentifierNode(_currentToken);
            TypeNode       itsType = new ClassTypeNode(itsName, itsPos);

            Accept(Token.TokenType.Identifier);
            Accept(Token.TokenType.LeftParen);
            ParameterSequenceNode itsParams = Parameters();

            Accept(Token.TokenType.RightParen);
            Accept(Token.TokenType.LeftBrace);
            DeclaringSequenceNode itsVars    = VariableDeclarings();
            ActionSequenceNode    itsActions = ActionStatements();

            Accept(Token.TokenType.RightBrace);
            itsAST = new ConstructorDeclaringNode(itsName, itsType, itsParams, itsVars, itsActions, itsPos);
            return(itsAST);
        }
Beispiel #7
0
        private MethodDeclaringNode ParseMethodDeclaring()
        {
            MethodDeclaringNode itsAST;
            SourceCodePosition  itsPos = _currentToken.SourcePosition;

            Accept(Token.TokenType.Method);
            TypeNode       itsType = ReturnType();
            IdentifierNode itsName = new IdentifierNode(_currentToken);

            Accept(Token.TokenType.Identifier);
            Accept(Token.TokenType.LeftParen);
            ParameterSequenceNode itsParams = Parameters();

            Accept(Token.TokenType.RightParen);
            Accept(Token.TokenType.LeftBrace);
            DeclaringSequenceNode itsVars    = VariableDeclarings();
            ActionSequenceNode    itsActions = ActionStatements();
            ReturnActionNode      itsReturn  = ReturnStatement();

            Accept(Token.TokenType.RightBrace);
            itsAST = new MethodDeclaringNode(itsName, itsType, itsParams, itsVars, itsActions, itsReturn, itsPos);
            return(itsAST);
        }
Beispiel #8
0
        private MethodDeclaringNode CreateStdMethod(ParameterSequenceNode parameters, TypeNode type)
        {
            MethodDeclaringNode declaring = new MethodDeclaringNode(_dummyIdent, type, parameters, new EmptyDeclaringSequenceNode(_dummyPos), new EmptyActionSequenceNode(_dummyPos), new ReturnActionNode(null, _dummyPos), _dummyPos);

            return(declaring);
        }