public object Visit(ConstructorDeclaringNode n, object o) { _currentScopeLevel = 2; _currentClassST.EnterSymbol(n.Identifier.Value, n); _currentMethodST = new MethodSymbolTable(_currentClassST, n, _errorSummary); n.Parameters.Accept(this, null); n.VarDeclarings.Accept(this, null); n.Actions.Accept(this, null); _currentClassST.AddLocalMethodST(n.Identifier.Value, _currentMethodST); return(null); }
public object Visit(ConstructorDeclaringNode n, object o) { _currentScopeLevel = 2; Append($"{AddIndent()}public {n.Identifier.Value}("); n.Parameters.Accept(this, null); AppendLine($")"); AppendLine($"{AddIndent()}{{"); IncreaseIndent(); n.VarDeclarings.Accept(this, null); n.Actions.Accept(this, null); DecreaseIndent(); AppendLine($"{AddIndent()}}}"); AppendLine(); return(null); }
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); }