//-----------------------------------------------------------
        private Type Visit(ExitStatement node, Table table)
        {
            if (LoopNestingLevel == 0)
            {
                throw new SemanticError("Exit statement must be inside a loop or for statement", node.AnchorToken);
            }

            return(Type.VOID);
        }
Exemple #2
0
        public void Exit()
        {
            var statement = new ExitStatement();

            SerializeAndAssert(statement, (serialized, deserialized) => {
                Assert.IsNotNull(deserialized);
                Assert.IsNull(deserialized.Label);
                Assert.IsNull(serialized.WhenExpression);
            });
        }
Exemple #3
0
        public Node ExitStatement()
        {
            var result = new ExitStatement()
            {
                AnchorToken = Expect(TokenCategory.EXIT)
            };

            Expect(TokenCategory.SEMICOLON);
            return(result);
        }
Exemple #4
0
        public void ExitWhen()
        {
            var statement = new ExitStatement(SqlExpression.Constant(true));

            SerializeAndAssert(statement, (serialized, deserialized) => {
                Assert.IsNotNull(deserialized);
                Assert.IsNull(deserialized.Label);
                Assert.IsNotNull(deserialized.WhenExpression);
                Assert.IsInstanceOf <SqlConstantExpression>(deserialized.WhenExpression);
            });
        }
 public override object VisitExitStatement(ExitStatement exitStatement, object data)
 {
     if (exitStatement.ExitType == ExitType.Function || exitStatement.ExitType == ExitType.Property)
     {
         hasExit = true;
         IdentifierExpression expr = new IdentifierExpression("tmp");
         expressionsToReplace.Add(expr);
         var newNode = new ReturnStatement(expr);
         ReplaceCurrentNode(newNode);
         return(base.VisitReturnStatement(newNode, data));
     }
     return(base.VisitExitStatement(exitStatement, data));
 }
Exemple #6
0
 public object VisitExitStatement(ExitStatement exitStatement, object data)
 {
     if (exitStatement.ExitType == ExitType.Function || exitStatement.ExitType == ExitType.Sub || exitStatement.ExitType == ExitType.Property)
     {
         AddWarning(exitStatement, "ExitStatement is converted to 'return'");
         return(new B.ReturnStatement(GetLexicalInfo(exitStatement)));
     }
     else
     {
         AddWarning(exitStatement, "ExitStatement is converted to 'break'");
         return(new B.BreakStatement(GetLexicalInfo(exitStatement)));
     }
 }
Exemple #7
0
        public void Visit(ExitStatement l)
        {
            if (CheckInclude(l))
            {
                return;
            }

            if (CheckGeneric(l))
            {
                return;
            }

            // We komen in een onbereikbaar stuk code...
            _unreachable = true;
        }
Exemple #8
0
 protected override void VisitExitStatement(ExitStatement statement)
 {
     State.Write(Symbols.EXIT);
     if (!String.IsNullOrWhiteSpace(statement.Label))
     {
         State.Write(Symbols.OpenBracket);
         State.Write(statement.Label);
         State.Write(Symbols.CloseBracket);
     }
     if (statement.When != null)
     {
         State.Write(Symbols.WHEN);
         VisitToken(statement.When);
     }
 }
Exemple #9
0
 protected override void VisitExitStatement(ExitStatement statement)
 {
     throw new NotImplementedException();
 }
 public virtual object Visit(ExitStatement exitStatement, object data)
 {
     Debug.Assert(exitStatement != null);
     return(data);
 }
Exemple #11
0
 public void Visit(ExitStatement l)
 {
     Format(l);
 }
		public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
			throw new global::System.NotImplementedException("ExitStatement");
		}
 public object VisitExitStatement(ExitStatement exitStatement, object data)
 {
     throw new NotImplementedException();
 }
		public virtual object TrackedVisitExitStatement(ExitStatement exitStatement, object data) {
			return base.VisitExitStatement(exitStatement, data);
		}
Exemple #15
0
 public void Visit(ExitStatement l)
 {
     VisitStatementComment(l);
 }
		// returns true if we crossed an unwind-protected region (try/catch/finally, lock, using, ...)
		public virtual bool AddReturnOrigin (UsageVector vector, ExitStatement stmt)
		{
			return Parent.AddReturnOrigin (vector, stmt);
		}
Exemple #17
0
        public override object Visit(ExitStatement that, object value)
        {
            _writer.Write("exit ");
            switch (that.BlockKind)
            {
                case BlockKind.Entry:
                    _writer.Write("entry");
                    break;

                case BlockKind.Function:
                    _writer.Write("function");
                    break;

                case BlockKind.Method:
                    _writer.Write("method");
                    break;

                default:
                    throw new System.ArgumentException("that.BlockKind");
            }
            _writer.WriteLine();
            return null;
        }
Exemple #18
0
 //-----------------------------------------------------------
 private string Visit(ExitStatement node, Table table)
 {
     return("\t\tbr " + loopLabels.Peek() + "\n");
 }
		public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
			Debug.Assert((exitStatement != null));
			return null;
		}
 //Function : ExitFunction
 //Method : This is the Function that
 //used For Exit The Invoke Statement
 public void ExitFunction()
 {
     ExitStatement?.Invoke();
 }
 public override object Visit(ExitStatement that, object value = null)
 {
     return null;
 }
Exemple #22
0
 protected abstract void VisitExitStatement(ExitStatement statement);
		public override bool AddReturnOrigin (UsageVector vector, ExitStatement exit_stmt)
		{
			Parent.AddReturnOrigin (vector, exit_stmt);
			return true;
		}
Exemple #24
0
 void IStatementVisitor.Visit(ExitStatement statement)
 {
     generator.Emit(OpCodes.Ret);
 }
Exemple #25
0
 public void OnExitStatement(ExitStatement stmt)
 {
     Enter(new Exit(stmt), stmt);
     Exit();
 }
		public sealed override object VisitExitStatement(ExitStatement exitStatement, object data) {
			BeginVisit(exitStatement);
			object result = TrackedVisitExitStatement(exitStatement, data);
			EndVisit(exitStatement);
			return result;
		}
Exemple #27
0
            private static IToken BuildCodeElementFromType(CodeElementType type, Token lastTokenBeforeError, string informationText)
            {
                CodeElement codeElement = null;

                switch (type)
                {
                case CodeElementType.ProgramIdentification:
                    codeElement = new ProgramIdentification();
                    break;

                case CodeElementType.ProgramEnd:
                    codeElement = new ProgramEnd();
                    break;

                case CodeElementType.ClassIdentification:
                    codeElement = new ClassIdentification();
                    break;

                case CodeElementType.ClassEnd:
                    codeElement = new ClassEnd();
                    break;

                case CodeElementType.FactoryIdentification:
                    codeElement = new FactoryIdentification();
                    break;

                case CodeElementType.FactoryEnd:
                    codeElement = new FactoryEnd();
                    break;

                case CodeElementType.ObjectIdentification:
                    codeElement = new ObjectIdentification();
                    break;

                case CodeElementType.ObjectEnd:
                    codeElement = new ObjectEnd();
                    break;

                case CodeElementType.MethodIdentification:
                    codeElement = new MethodIdentification();
                    break;

                case CodeElementType.MethodEnd:
                    codeElement = new MethodEnd();
                    break;

                case CodeElementType.EnvironmentDivisionHeader:
                    codeElement = new EnvironmentDivisionHeader();
                    break;

                case CodeElementType.DataDivisionHeader:
                    codeElement = new DataDivisionHeader();
                    break;

                case CodeElementType.ProcedureDivisionHeader:
                    codeElement = new ProcedureDivisionHeader();
                    break;

                case CodeElementType.DeclarativesHeader:
                    codeElement = new DeclarativesHeader();
                    break;

                case CodeElementType.DeclarativesEnd:
                    codeElement = new DeclarativesEnd();
                    break;

                case CodeElementType.SectionHeader:
                    codeElement = new SectionHeader();
                    break;

                case CodeElementType.ConfigurationSectionHeader:
                    codeElement = new ConfigurationSectionHeader();
                    break;

                case CodeElementType.InputOutputSectionHeader:
                    codeElement = new InputOutputSectionHeader();
                    break;

                case CodeElementType.FileSectionHeader:
                    codeElement = new FileSectionHeader();
                    break;

                case CodeElementType.WorkingStorageSectionHeader:
                    codeElement = new WorkingStorageSectionHeader();
                    break;

                case CodeElementType.LocalStorageSectionHeader:
                    codeElement = new LocalStorageSectionHeader();
                    break;

                case CodeElementType.LinkageSectionHeader:
                    codeElement = new LinkageSectionHeader();
                    break;

                case CodeElementType.ParagraphHeader:
                    codeElement = new ParagraphHeader();
                    break;

                case CodeElementType.FileControlParagraphHeader:
                    codeElement = new FileControlParagraphHeader();
                    break;

                case CodeElementType.IOControlParagraphHeader:
                    codeElement = new IOControlParagraphHeader();
                    break;

                case CodeElementType.SentenceEnd:
                    codeElement = new SentenceEnd();
                    break;

                case CodeElementType.FileDescriptionEntry:
                    codeElement = new FileDescriptionEntry();
                    break;

                case CodeElementType.DataDescriptionEntry:
                    codeElement = new DataDescriptionEntry();
                    break;

                case CodeElementType.DataRedefinesEntry:
                    codeElement = new DataRedefinesEntry();
                    break;

                case CodeElementType.DataRenamesEntry:
                    codeElement = new DataRenamesEntry();
                    break;

                case CodeElementType.DataConditionEntry:
                    codeElement = new DataConditionEntry();
                    break;

                case CodeElementType.FileControlEntry:
                    codeElement = new FileControlEntry();
                    break;

                case CodeElementType.IOControlEntry:
                    codeElement = new RerunIOControlEntry();
                    break;

                case CodeElementType.SourceComputerParagraph:
                    codeElement = new SourceComputerParagraph();
                    break;

                case CodeElementType.ObjectComputerParagraph:
                    codeElement = new ObjectComputerParagraph();
                    break;

                case CodeElementType.SpecialNamesParagraph:
                    codeElement = new SpecialNamesParagraph();
                    break;

                case CodeElementType.RepositoryParagraph:
                    codeElement = new RepositoryParagraph();
                    break;

                case CodeElementType.AcceptStatement:
                    codeElement = new AcceptFromInputDeviceStatement();
                    break;

                case CodeElementType.AddStatement:
                    codeElement = new AddSimpleStatement();
                    break;

                case CodeElementType.AlterStatement:
                    codeElement = new AlterStatement();
                    break;

                case CodeElementType.CallStatement:
                    codeElement = new CallStatement();
                    break;

                case CodeElementType.CancelStatement:
                    codeElement = new CancelStatement();
                    break;

                case CodeElementType.CloseStatement:
                    codeElement = new CloseStatement();
                    break;

                case CodeElementType.ComputeStatement:
                    codeElement = new ComputeStatement();
                    break;

                case CodeElementType.ContinueStatement:
                    codeElement = new ContinueStatement();
                    break;

                case CodeElementType.DeleteStatement:
                    codeElement = new DeleteStatement();
                    break;

                case CodeElementType.DisplayStatement:
                    codeElement = new DisplayStatement();
                    break;

                case CodeElementType.DivideStatement:
                    codeElement = new DivideSimpleStatement();
                    break;

                case CodeElementType.EntryStatement:
                    codeElement = new EntryStatement();
                    break;

                case CodeElementType.EvaluateStatement:
                    codeElement = new EvaluateStatement();
                    break;

                case CodeElementType.ExecStatement:
                    codeElement = new ExecStatement();
                    break;

                case CodeElementType.ExitMethodStatement:
                    codeElement = new ExitMethodStatement();
                    break;

                case CodeElementType.ExitProgramStatement:
                    codeElement = new ExitProgramStatement();
                    break;

                case CodeElementType.ExitStatement:
                    codeElement = new ExitStatement();
                    break;

                case CodeElementType.GobackStatement:
                    codeElement = new GobackStatement();
                    break;

                case CodeElementType.GotoStatement:
                    codeElement = new GotoSimpleStatement();
                    break;

                case CodeElementType.IfStatement:
                    codeElement = new IfStatement();
                    break;

                case CodeElementType.InitializeStatement:
                    codeElement = new InitializeStatement();
                    break;

                case CodeElementType.InspectStatement:
                    codeElement = new InspectTallyingStatement();
                    break;

                case CodeElementType.InvokeStatement:
                    codeElement = new InvokeStatement();
                    break;

                case CodeElementType.MergeStatement:
                    codeElement = new MergeStatement();
                    break;

                case CodeElementType.MoveStatement:
                    codeElement = new MoveSimpleStatement(null, null, null);
                    break;

                case CodeElementType.MultiplyStatement:
                    codeElement = new MultiplySimpleStatement();
                    break;

                case CodeElementType.NextSentenceStatement:
                    codeElement = new NextSentenceStatement();
                    break;

                case CodeElementType.OpenStatement:
                    codeElement = new OpenStatement();
                    break;

                case CodeElementType.PerformProcedureStatement:
                    codeElement = new PerformProcedureStatement();
                    break;

                case CodeElementType.PerformStatement:
                    codeElement = new PerformStatement();
                    break;

                case CodeElementType.ReadStatement:
                    codeElement = new ReadStatement();
                    break;

                case CodeElementType.ReleaseStatement:
                    codeElement = new ReleaseStatement();
                    break;

                case CodeElementType.ReturnStatement:
                    codeElement = new ReturnStatement();
                    break;

                case CodeElementType.RewriteStatement:
                    codeElement = new RewriteStatement();
                    break;

                case CodeElementType.SearchStatement:
                    codeElement = new SearchSerialStatement();
                    break;

                case CodeElementType.SetStatement:
                    codeElement = new SetStatementForAssignment();
                    break;

                case CodeElementType.SortStatement:
                    codeElement = new SortStatement();
                    break;

                case CodeElementType.StartStatement:
                    codeElement = new StartStatement();
                    break;

                case CodeElementType.StopStatement:
                    codeElement = new StopStatement();
                    break;

                case CodeElementType.StringStatement:
                    codeElement = new StringStatement();
                    break;

                case CodeElementType.SubtractStatement:
                    codeElement = new SubtractSimpleStatement();
                    break;

                case CodeElementType.UnstringStatement:
                    codeElement = new UnstringStatement();
                    break;

                case CodeElementType.UseStatement:
                    codeElement = new UseAfterIOExceptionStatement();
                    break;

                case CodeElementType.WriteStatement:
                    codeElement = new WriteStatement();
                    break;

                case CodeElementType.XmlGenerateStatement:
                    codeElement = new XmlGenerateStatement();
                    break;

                case CodeElementType.XmlParseStatement:
                    codeElement = new XmlParseStatement();
                    break;

                case CodeElementType.AtEndCondition:
                    codeElement = new AtEndCondition();
                    break;

                case CodeElementType.NotAtEndCondition:
                    codeElement = new NotAtEndCondition();
                    break;

                case CodeElementType.AtEndOfPageCondition:
                    codeElement = new AtEndOfPageCondition();
                    break;

                case CodeElementType.NotAtEndOfPageCondition:
                    codeElement = new NotAtEndOfPageCondition();
                    break;

                case CodeElementType.OnExceptionCondition:
                    codeElement = new OnExceptionCondition();
                    break;

                case CodeElementType.NotOnExceptionCondition:
                    codeElement = new NotOnExceptionCondition();
                    break;

                case CodeElementType.OnOverflowCondition:
                    codeElement = new OnOverflowCondition();
                    break;

                case CodeElementType.NotOnOverflowCondition:
                    codeElement = new NotOnOverflowCondition();
                    break;

                case CodeElementType.InvalidKeyCondition:
                    codeElement = new InvalidKeyCondition();
                    break;

                case CodeElementType.NotInvalidKeyCondition:
                    codeElement = new NotInvalidKeyCondition();
                    break;

                case CodeElementType.OnSizeErrorCondition:
                    codeElement = new OnSizeErrorCondition();
                    break;

                case CodeElementType.NotOnSizeErrorCondition:
                    codeElement = new NotOnSizeErrorCondition();
                    break;

                case CodeElementType.ElseCondition:
                    codeElement = new ElseCondition();
                    break;

                case CodeElementType.WhenCondition:
                    codeElement = new WhenCondition();
                    break;

                case CodeElementType.WhenOtherCondition:
                    codeElement = new WhenOtherCondition();
                    break;

                case CodeElementType.WhenSearchCondition:
                    codeElement = new WhenSearchCondition();
                    break;

                case CodeElementType.AddStatementEnd:
                    codeElement = new AddStatementEnd();
                    break;

                case CodeElementType.CallStatementEnd:
                    codeElement = new CallStatementEnd();
                    break;

                case CodeElementType.ComputeStatementEnd:
                    codeElement = new ComputeStatementEnd();
                    break;

                case CodeElementType.DeleteStatementEnd:
                    codeElement = new DeleteStatementEnd();
                    break;

                case CodeElementType.DivideStatementEnd:
                    codeElement = new DivideStatementEnd();
                    break;

                case CodeElementType.EvaluateStatementEnd:
                    codeElement = new EvaluateStatementEnd();
                    break;

                case CodeElementType.IfStatementEnd:
                    codeElement = new IfStatementEnd();
                    break;

                case CodeElementType.InvokeStatementEnd:
                    codeElement = new InvokeStatementEnd();
                    break;

                case CodeElementType.MultiplyStatementEnd:
                    codeElement = new MultiplyStatementEnd();
                    break;

                case CodeElementType.PerformStatementEnd:
                    codeElement = new PerformStatementEnd();
                    break;

                case CodeElementType.ReadStatementEnd:
                    codeElement = new ReadStatementEnd();
                    break;

                case CodeElementType.ReturnStatementEnd:
                    codeElement = new ReturnStatementEnd();
                    break;

                case CodeElementType.RewriteStatementEnd:
                    codeElement = new RewriteStatementEnd();
                    break;

                case CodeElementType.SearchStatementEnd:
                    codeElement = new SearchStatementEnd();
                    break;

                case CodeElementType.StartStatementEnd:
                    codeElement = new StartStatementEnd();
                    break;

                case CodeElementType.StringStatementEnd:
                    codeElement = new StringStatementEnd();
                    break;

                case CodeElementType.SubtractStatementEnd:
                    codeElement = new SubtractStatementEnd();
                    break;

                case CodeElementType.UnstringStatementEnd:
                    codeElement = new UnstringStatementEnd();
                    break;

                case CodeElementType.WriteStatementEnd:
                    codeElement = new WriteStatementEnd();
                    break;

                case CodeElementType.XmlStatementEnd:
                    codeElement = new XmlStatementEnd();
                    break;

                case CodeElementType.LibraryCopy:
                    codeElement = new LibraryCopyCodeElement();
                    break;

                case CodeElementType.FunctionDeclarationHeader:
                    codeElement = new FunctionDeclarationHeader(null, AccessModifier.Private, FunctionType.Undefined);
                    break;

                case CodeElementType.FunctionDeclarationEnd:
                    codeElement = new FunctionDeclarationEnd();
                    break;

                default:
                    throw new NotImplementedException();
                }
                if (lastTokenBeforeError != null)
                {
                    var missingToken = new MissingToken(TokenType.InvalidToken, informationText, lastTokenBeforeError.TokensLine, lastTokenBeforeError.StopIndex);
                    codeElement.ConsumedTokens.Add(missingToken);
                }
                return(codeElement);
            }
        public override object Visit(ExitStatement that, object value = null)
        {
            PrintPrologue(that);
            _writer.WriteLine("BlockKind = {0}", that.BlockKind.ToString());
            PrintEpilogue(that);

            return null;
        }
 private bool IsMatch(ExitStatement left, ExitStatement data)
 {
     return(false);
 }
		public override bool AddReturnOrigin (UsageVector vector, ExitStatement exit_stmt)
		{
			if (finally_vector != null) {
				int errors = Report.Errors;
				Parent.AddReturnOrigin (vector, exit_stmt);
				if (errors == Report.Errors)
					exit_stmt.Error_FinallyClause (Report);
			} else {
				saved_origins = new ReturnOrigin (saved_origins, vector, exit_stmt);
			}

			// sets ec.NeedReturnLabel()
			stmt.SomeCodeFollows ();
			return true;
		}
Exemple #31
0
 protected override void visitExitStatement(ExitStatement statement)
 {
     appendExitOrNextStatement(statement, KeywordEnum.EXIT, statement.Loop, statement.Condition);
 }
		public override bool AddReturnOrigin (UsageVector vector, ExitStatement stmt)
		{
			vector = vector.Clone ();
			vector.Location = stmt.loc;
			vector.Next = return_origins;
			return_origins = vector;
			return false;
		}
Exemple #33
0
 public override object VisitExitStatement(ExitStatement exitStatement, object data)
 {
     return(base.VisitExitStatement(exitStatement, data));
 }
			public ReturnOrigin (SavedOrigin next, UsageVector vector, ExitStatement stmt)
				: base (next, vector)
			{
				Stmt = stmt;
			}
Exemple #35
0
	void EmbeddedStatement(
#line  2755 "VBNET.ATG" 
out Statement statement) {

#line  2757 "VBNET.ATG" 
		Statement embeddedStatement = null;
		statement = null;
		Expression expr = null;
		string name = String.Empty;
		List<Expression> p = null;
		
		if (la.kind == 107) {
			lexer.NextToken();

#line  2763 "VBNET.ATG" 
			ExitType exitType = ExitType.None; 
			switch (la.kind) {
			case 195: {
				lexer.NextToken();

#line  2765 "VBNET.ATG" 
				exitType = ExitType.Sub; 
				break;
			}
			case 114: {
				lexer.NextToken();

#line  2767 "VBNET.ATG" 
				exitType = ExitType.Function; 
				break;
			}
			case 171: {
				lexer.NextToken();

#line  2769 "VBNET.ATG" 
				exitType = ExitType.Property; 
				break;
			}
			case 95: {
				lexer.NextToken();

#line  2771 "VBNET.ATG" 
				exitType = ExitType.Do; 
				break;
			}
			case 111: {
				lexer.NextToken();

#line  2773 "VBNET.ATG" 
				exitType = ExitType.For; 
				break;
			}
			case 203: {
				lexer.NextToken();

#line  2775 "VBNET.ATG" 
				exitType = ExitType.Try; 
				break;
			}
			case 216: {
				lexer.NextToken();

#line  2777 "VBNET.ATG" 
				exitType = ExitType.While; 
				break;
			}
			case 182: {
				lexer.NextToken();

#line  2779 "VBNET.ATG" 
				exitType = ExitType.Select; 
				break;
			}
			default: SynErr(273); break;
			}

#line  2781 "VBNET.ATG" 
			statement = new ExitStatement(exitType); 
		} else if (la.kind == 203) {
			TryStatement(
#line  2782 "VBNET.ATG" 
out statement);
		} else if (la.kind == 76) {
			lexer.NextToken();

#line  2783 "VBNET.ATG" 
			ContinueType continueType = ContinueType.None; 
			if (la.kind == 95 || la.kind == 111 || la.kind == 216) {
				if (la.kind == 95) {
					lexer.NextToken();

#line  2783 "VBNET.ATG" 
					continueType = ContinueType.Do; 
				} else if (la.kind == 111) {
					lexer.NextToken();

#line  2783 "VBNET.ATG" 
					continueType = ContinueType.For; 
				} else {
					lexer.NextToken();

#line  2783 "VBNET.ATG" 
					continueType = ContinueType.While; 
				}
			}

#line  2783 "VBNET.ATG" 
			statement = new ContinueStatement(continueType); 
		} else if (la.kind == 200) {
			lexer.NextToken();
			if (StartOf(29)) {
				Expr(
#line  2785 "VBNET.ATG" 
out expr);
			}

#line  2785 "VBNET.ATG" 
			statement = new ThrowStatement(expr); 
		} else if (la.kind == 180) {
			lexer.NextToken();
			if (StartOf(29)) {
				Expr(
#line  2787 "VBNET.ATG" 
out expr);
			}

#line  2787 "VBNET.ATG" 
			statement = new ReturnStatement(expr); 
		} else if (la.kind == 196) {
			lexer.NextToken();
			Expr(
#line  2789 "VBNET.ATG" 
out expr);
			EndOfStmt();
			Block(
#line  2789 "VBNET.ATG" 
out embeddedStatement);
			Expect(100);
			Expect(196);

#line  2790 "VBNET.ATG" 
			statement = new LockStatement(expr, embeddedStatement); 
		} else if (la.kind == 174) {
			lexer.NextToken();
			Identifier();

#line  2792 "VBNET.ATG" 
			name = t.val; 
			if (la.kind == 25) {
				lexer.NextToken();
				if (StartOf(37)) {
					ArgumentList(
#line  2793 "VBNET.ATG" 
out p);
				}
				Expect(26);
			}

#line  2795 "VBNET.ATG" 
			statement = new RaiseEventStatement(name, p);
			
		} else if (la.kind == 218) {
			WithStatement(
#line  2798 "VBNET.ATG" 
out statement);
		} else if (la.kind == 43) {
			lexer.NextToken();

#line  2800 "VBNET.ATG" 
			Expression handlerExpr = null; 
			Expr(
#line  2801 "VBNET.ATG" 
out expr);
			Expect(12);
			Expr(
#line  2801 "VBNET.ATG" 
out handlerExpr);

#line  2803 "VBNET.ATG" 
			statement = new AddHandlerStatement(expr, handlerExpr);
			
		} else if (la.kind == 178) {
			lexer.NextToken();

#line  2806 "VBNET.ATG" 
			Expression handlerExpr = null; 
			Expr(
#line  2807 "VBNET.ATG" 
out expr);
			Expect(12);
			Expr(
#line  2807 "VBNET.ATG" 
out handlerExpr);

#line  2809 "VBNET.ATG" 
			statement = new RemoveHandlerStatement(expr, handlerExpr);
			
		} else if (la.kind == 216) {
			lexer.NextToken();
			Expr(
#line  2812 "VBNET.ATG" 
out expr);
			EndOfStmt();
			Block(
#line  2813 "VBNET.ATG" 
out embeddedStatement);
			Expect(100);
			Expect(216);

#line  2815 "VBNET.ATG" 
			statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
			
		} else if (la.kind == 95) {
			lexer.NextToken();

#line  2820 "VBNET.ATG" 
			ConditionType conditionType = ConditionType.None;
			
			if (la.kind == 209 || la.kind == 216) {
				WhileOrUntil(
#line  2823 "VBNET.ATG" 
out conditionType);
				Expr(
#line  2823 "VBNET.ATG" 
out expr);
				EndOfStmt();
				Block(
#line  2824 "VBNET.ATG" 
out embeddedStatement);
				Expect(138);

#line  2827 "VBNET.ATG" 
				statement = new DoLoopStatement(expr, 
				                               embeddedStatement, 
				                               conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType, 
				                               ConditionPosition.Start);
				
			} else if (la.kind == 1 || la.kind == 11) {
				EndOfStmt();
				Block(
#line  2834 "VBNET.ATG" 
out embeddedStatement);
				Expect(138);
				if (la.kind == 209 || la.kind == 216) {
					WhileOrUntil(
#line  2835 "VBNET.ATG" 
out conditionType);
					Expr(
#line  2835 "VBNET.ATG" 
out expr);
				}

#line  2837 "VBNET.ATG" 
				statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End);
				
			} else SynErr(274);
		} else if (la.kind == 111) {
			lexer.NextToken();

#line  2842 "VBNET.ATG" 
			Expression group = null;
			TypeReference typeReference;
			string        typeName;
			Location startLocation = t.Location;
			
			if (la.kind == 97) {
				lexer.NextToken();
				LoopControlVariable(
#line  2849 "VBNET.ATG" 
out typeReference, out typeName);
				Expect(125);
				Expr(
#line  2850 "VBNET.ATG" 
out group);
				EndOfStmt();
				Block(
#line  2851 "VBNET.ATG" 
out embeddedStatement);
				Expect(149);
				if (StartOf(29)) {
					Expr(
#line  2852 "VBNET.ATG" 
out expr);
				}

#line  2854 "VBNET.ATG" 
				statement = new ForeachStatement(typeReference, 
				                                typeName,
				                                group, 
				                                embeddedStatement, 
				                                expr);
				statement.StartLocation = startLocation;
				statement.EndLocation   = t.EndLocation;
				
				
			} else if (StartOf(38)) {

#line  2865 "VBNET.ATG" 
				Expression start = null;
				Expression end = null;
				Expression step = null;
				Expression variableExpr = null;
				Expression nextExpr = null;
				List<Expression> nextExpressions = null;
				
				if (
#line  2872 "VBNET.ATG" 
IsLoopVariableDeclaration()) {
					LoopControlVariable(
#line  2873 "VBNET.ATG" 
out typeReference, out typeName);
				} else {

#line  2875 "VBNET.ATG" 
					typeReference = null; typeName = null; 
					SimpleExpr(
#line  2876 "VBNET.ATG" 
out variableExpr);
				}
				Expect(10);
				Expr(
#line  2878 "VBNET.ATG" 
out start);
				Expect(201);
				Expr(
#line  2878 "VBNET.ATG" 
out end);
				if (la.kind == 190) {
					lexer.NextToken();
					Expr(
#line  2878 "VBNET.ATG" 
out step);
				}
				EndOfStmt();
				Block(
#line  2879 "VBNET.ATG" 
out embeddedStatement);
				Expect(149);
				if (StartOf(29)) {
					Expr(
#line  2882 "VBNET.ATG" 
out nextExpr);

#line  2884 "VBNET.ATG" 
					nextExpressions = new List<Expression>();
					nextExpressions.Add(nextExpr);
					
					while (la.kind == 12) {
						lexer.NextToken();
						Expr(
#line  2887 "VBNET.ATG" 
out nextExpr);

#line  2887 "VBNET.ATG" 
						nextExpressions.Add(nextExpr); 
					}
				}

#line  2890 "VBNET.ATG" 
				statement = new ForNextStatement {
				TypeReference = typeReference,
				VariableName = typeName, 
				LoopVariableExpression = variableExpr,
				Start = start, 
				End = end, 
				Step = step, 
				EmbeddedStatement = embeddedStatement, 
				NextExpressions = nextExpressions
				};
				
			} else SynErr(275);
		} else if (la.kind == 105) {
			lexer.NextToken();
			Expr(
#line  2903 "VBNET.ATG" 
out expr);

#line  2903 "VBNET.ATG" 
			statement = new ErrorStatement(expr); 
		} else if (la.kind == 176) {
			lexer.NextToken();

#line  2905 "VBNET.ATG" 
			bool isPreserve = false; 
			if (la.kind == 169) {
				lexer.NextToken();

#line  2905 "VBNET.ATG" 
				isPreserve = true; 
			}
			ReDimClause(
#line  2906 "VBNET.ATG" 
out expr);

#line  2908 "VBNET.ATG" 
			ReDimStatement reDimStatement = new ReDimStatement(isPreserve);
			statement = reDimStatement;
			SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression);
			
			while (la.kind == 12) {
				lexer.NextToken();
				ReDimClause(
#line  2912 "VBNET.ATG" 
out expr);

#line  2913 "VBNET.ATG" 
				SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression); 
			}
		} else if (la.kind == 104) {
			lexer.NextToken();
			Expr(
#line  2917 "VBNET.ATG" 
out expr);

#line  2919 "VBNET.ATG" 
			EraseStatement eraseStatement = new EraseStatement();
			if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr);}
			
			while (la.kind == 12) {
				lexer.NextToken();
				Expr(
#line  2922 "VBNET.ATG" 
out expr);

#line  2922 "VBNET.ATG" 
				if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr); }
			}

#line  2923 "VBNET.ATG" 
			statement = eraseStatement; 
		} else if (la.kind == 191) {
			lexer.NextToken();

#line  2925 "VBNET.ATG" 
			statement = new StopStatement(); 
		} else if (
#line  2927 "VBNET.ATG" 
la.kind == Tokens.If) {
			Expect(122);

#line  2928 "VBNET.ATG" 
			Location ifStartLocation = t.Location; 
			Expr(
#line  2928 "VBNET.ATG" 
out expr);
			if (la.kind == 199) {
				lexer.NextToken();
			}
			if (la.kind == 1 || la.kind == 11) {
				EndOfStmt();
				Block(
#line  2931 "VBNET.ATG" 
out embeddedStatement);

#line  2933 "VBNET.ATG" 
				IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement);
				ifStatement.StartLocation = ifStartLocation;
				Location elseIfStart;
				
				while (la.kind == 99 || 
#line  2939 "VBNET.ATG" 
IsElseIf()) {
					if (
#line  2939 "VBNET.ATG" 
IsElseIf()) {
						Expect(98);

#line  2939 "VBNET.ATG" 
						elseIfStart = t.Location; 
						Expect(122);
					} else {
						lexer.NextToken();

#line  2940 "VBNET.ATG" 
						elseIfStart = t.Location; 
					}

#line  2942 "VBNET.ATG" 
					Expression condition = null; Statement block = null; 
					Expr(
#line  2943 "VBNET.ATG" 
out condition);
					if (la.kind == 199) {
						lexer.NextToken();
					}
					EndOfStmt();
					Block(
#line  2944 "VBNET.ATG" 
out block);

#line  2946 "VBNET.ATG" 
					ElseIfSection elseIfSection = new ElseIfSection(condition, block);
					elseIfSection.StartLocation = elseIfStart;
					elseIfSection.EndLocation = t.Location;
					elseIfSection.Parent = ifStatement;
					ifStatement.ElseIfSections.Add(elseIfSection);
					
				}
				if (la.kind == 98) {
					lexer.NextToken();
					EndOfStmt();
					Block(
#line  2955 "VBNET.ATG" 
out embeddedStatement);

#line  2957 "VBNET.ATG" 
					ifStatement.FalseStatement.Add(embeddedStatement);
					
				}
				Expect(100);
				Expect(122);

#line  2961 "VBNET.ATG" 
				ifStatement.EndLocation = t.Location;
				statement = ifStatement;
				
			} else if (StartOf(39)) {

#line  2966 "VBNET.ATG" 
				IfElseStatement ifStatement = new IfElseStatement(expr);
				ifStatement.StartLocation = ifStartLocation;
				
				SingleLineStatementList(
#line  2969 "VBNET.ATG" 
ifStatement.TrueStatement);
				if (la.kind == 98) {
					lexer.NextToken();
					if (StartOf(39)) {
						SingleLineStatementList(
#line  2972 "VBNET.ATG" 
ifStatement.FalseStatement);
					}
				}

#line  2974 "VBNET.ATG" 
				ifStatement.EndLocation = t.Location; statement = ifStatement; 
			} else SynErr(276);
		} else if (la.kind == 182) {
			lexer.NextToken();
			if (la.kind == 61) {
				lexer.NextToken();
			}
			Expr(
#line  2977 "VBNET.ATG" 
out expr);
			EndOfStmt();

#line  2978 "VBNET.ATG" 
			List<SwitchSection> selectSections = new List<SwitchSection>();
			Statement block = null;
			
			while (la.kind == 61) {

#line  2982 "VBNET.ATG" 
				List<CaseLabel> caseClauses = null; Location caseLocation = la.Location; 
				lexer.NextToken();
				CaseClauses(
#line  2983 "VBNET.ATG" 
out caseClauses);
				if (
#line  2983 "VBNET.ATG" 
IsNotStatementSeparator()) {
					lexer.NextToken();
				}
				EndOfStmt();

#line  2985 "VBNET.ATG" 
				SwitchSection selectSection = new SwitchSection(caseClauses);
				selectSection.StartLocation = caseLocation;
				
				Block(
#line  2988 "VBNET.ATG" 
out block);

#line  2990 "VBNET.ATG" 
				selectSection.Children = block.Children;
				selectSection.EndLocation = t.EndLocation;
				selectSections.Add(selectSection);
				
			}

#line  2996 "VBNET.ATG" 
			statement = new SwitchStatement(expr, selectSections);
			
			Expect(100);
			Expect(182);
		} else if (la.kind == 157) {

#line  2999 "VBNET.ATG" 
			OnErrorStatement onErrorStatement = null; 
			OnErrorStatement(
#line  3000 "VBNET.ATG" 
out onErrorStatement);

#line  3000 "VBNET.ATG" 
			statement = onErrorStatement; 
		} else if (la.kind == 119) {

#line  3001 "VBNET.ATG" 
			GotoStatement goToStatement = null; 
			GotoStatement(
#line  3002 "VBNET.ATG" 
out goToStatement);

#line  3002 "VBNET.ATG" 
			statement = goToStatement; 
		} else if (la.kind == 179) {

#line  3003 "VBNET.ATG" 
			ResumeStatement resumeStatement = null; 
			ResumeStatement(
#line  3004 "VBNET.ATG" 
out resumeStatement);

#line  3004 "VBNET.ATG" 
			statement = resumeStatement; 
		} else if (StartOf(38)) {

#line  3007 "VBNET.ATG" 
			Expression val = null;
			AssignmentOperatorType op;
			
			bool mustBeAssignment = la.kind == Tokens.Plus  || la.kind == Tokens.Minus ||
			                        la.kind == Tokens.Not   || la.kind == Tokens.Times;
			
			SimpleExpr(
#line  3013 "VBNET.ATG" 
out expr);
			if (StartOf(40)) {
				AssignmentOperator(
#line  3015 "VBNET.ATG" 
out op);
				Expr(
#line  3015 "VBNET.ATG" 
out val);

#line  3015 "VBNET.ATG" 
				expr = new AssignmentExpression(expr, op, val); 
			} else if (la.kind == 1 || la.kind == 11 || la.kind == 98) {

#line  3016 "VBNET.ATG" 
				if (mustBeAssignment) Error("error in assignment."); 
			} else SynErr(277);

#line  3019 "VBNET.ATG" 
			// a field reference expression that stands alone is a
			// invocation expression without parantheses and arguments
			if(expr is MemberReferenceExpression || expr is IdentifierExpression) {
				expr = new InvocationExpression(expr);
			}
			statement = new ExpressionStatement(expr);
			
		} else if (la.kind == 60) {
			lexer.NextToken();
			SimpleExpr(
#line  3026 "VBNET.ATG" 
out expr);

#line  3026 "VBNET.ATG" 
			statement = new ExpressionStatement(expr); 
		} else if (la.kind == 211) {
			lexer.NextToken();

#line  3028 "VBNET.ATG" 
			Statement block;  
			if (
#line  3029 "VBNET.ATG" 
Peek(1).kind == Tokens.As) {

#line  3030 "VBNET.ATG" 
				LocalVariableDeclaration resourceAquisition = new LocalVariableDeclaration(Modifiers.None); 
				VariableDeclarator(
#line  3031 "VBNET.ATG" 
resourceAquisition.Variables);
				while (la.kind == 12) {
					lexer.NextToken();
					VariableDeclarator(
#line  3033 "VBNET.ATG" 
resourceAquisition.Variables);
				}
				Block(
#line  3035 "VBNET.ATG" 
out block);

#line  3037 "VBNET.ATG" 
				statement = new UsingStatement(resourceAquisition, block);
				
			} else if (StartOf(29)) {
				Expr(
#line  3039 "VBNET.ATG" 
out expr);
				Block(
#line  3040 "VBNET.ATG" 
out block);

#line  3041 "VBNET.ATG" 
				statement = new UsingStatement(new ExpressionStatement(expr), block); 
			} else SynErr(278);
			Expect(100);
			Expect(211);
		} else if (StartOf(41)) {
			LocalDeclarationStatement(
#line  3044 "VBNET.ATG" 
out statement);
		} else SynErr(279);
	}
 public virtual object VisitExitStatement(ExitStatement exitStatement, object data)
 {
     throw new global::System.NotImplementedException("ExitStatement");
 }
Exemple #37
0
        public override object Visit(ExitStatement that, object value)
        {
            /** \todo Locate the parent node, most likely through a stack of already entered nodes. */
            #if false
            switch (that.Above.Kind)
            {
                case NodeKind.EntryStatement:
                    throw new WriterError(that.Cursor, "The construct 'exit entry' is never valid");

                case NodeKind.FunctionStatement:
                {
                    FunctionStatement above = (FunctionStatement) that.Above;
                    if (above.Profile.Type.Kind != NodeKind.NoneType)
                        throw new WriterError(that.Cursor, "Function returns a value so 'exit function' is invalid");
                    _writer.WriteLine("return");
                    break;
                }

            #  if DONE
                case NodeKind.MethodStatement:
                {
                    MethodStatement above = (MethodStatement) that.Above;
                    if (above.Profile.Type.Kind != NodeKind.NoneType)
                        throw new WriterError(that.Cursor, "Method returns a value so 'exit method' is invalid");
                    _writer.WriteLine("return");
                    break;
                }
            #  endif

                default:
                    throw new WriterError(that.Cursor, "'exit' statement encountered in unknown context");
            }
            #endif
            return null;
        }
Exemple #38
0
 public virtual T Visit(ExitStatement stmt) => Visit(stmt as Statement);
Exemple #39
0
 public virtual object Visit(ExitStatement that, object value)
 {
     throw new System.NotImplementedException();
 }