public override object Visit(StopStatement stopStatement, object data)
 {
     return null;
 }
 public object Visit(StopStatement stopStatement, object data)
 {
     DebugOutput(stopStatement);
     AppendIndentation();
     sourceText.Append("Debugger.Break();");
     AppendNewLine();
     return null;
 }
Ejemplo n.º 3
0
	void EmbeddedStatement(
#line  2071 "VBNET.ATG" 
out Statement statement) {

#line  2073 "VBNET.ATG" 
		Statement embeddedStatement = null;
		statement = null;
		Expression expr = null;
		string name = String.Empty;
		ArrayList p = null;
		
		switch (la.kind) {
		case 95: {
			lexer.NextToken();

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

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

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

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

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

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

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

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

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

#line  2097 "VBNET.ATG" 
			statement = new ExitStatement(exitType); 
			break;
		}
		case 176: {
			TryStatement(
#line  2098 "VBNET.ATG" 
out statement);
			break;
		}
		case 173: {
			lexer.NextToken();
			if (StartOf(18)) {
				Expr(
#line  2100 "VBNET.ATG" 
out expr);
			}

#line  2100 "VBNET.ATG" 
			statement = new ThrowStatement(expr); 
			break;
		}
		case 156: {
			lexer.NextToken();
			if (StartOf(18)) {
				Expr(
#line  2102 "VBNET.ATG" 
out expr);
			}

#line  2102 "VBNET.ATG" 
			statement = new ReturnStatement(expr); 
			break;
		}
		case 170: {
			lexer.NextToken();
			Expr(
#line  2104 "VBNET.ATG" 
out expr);
			EndOfStmt();
			Block(
#line  2104 "VBNET.ATG" 
out embeddedStatement);
			Expect(89);
			Expect(170);

#line  2105 "VBNET.ATG" 
			statement = new LockStatement(expr, embeddedStatement); 
			break;
		}
		case 151: {
			lexer.NextToken();
			Identifier();

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

#line  2109 "VBNET.ATG" 
			statement = new RaiseEventStatement(name, p); 
			break;
		}
		case 184: {
			WithStatement(
#line  2111 "VBNET.ATG" 
out statement);
			break;
		}
		case 43: {
			lexer.NextToken();

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

#line  2116 "VBNET.ATG" 
			statement = new AddHandlerStatement(expr, handlerExpr);
			
			break;
		}
		case 154: {
			lexer.NextToken();

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

#line  2122 "VBNET.ATG" 
			statement = new RemoveHandlerStatement(expr, handlerExpr);
			
			break;
		}
		case 183: {
			lexer.NextToken();
			Expr(
#line  2125 "VBNET.ATG" 
out expr);
			EndOfStmt();
			Block(
#line  2126 "VBNET.ATG" 
out embeddedStatement);
			Expect(89);
			Expect(183);

#line  2128 "VBNET.ATG" 
			statement = new WhileStatement(expr, embeddedStatement);
			
			break;
		}
		case 84: {
			lexer.NextToken();

#line  2133 "VBNET.ATG" 
			ConditionType conditionType = ConditionType.None;
			
			if (la.kind == 179 || la.kind == 183) {
				WhileOrUntil(
#line  2136 "VBNET.ATG" 
out conditionType);
				Expr(
#line  2136 "VBNET.ATG" 
out expr);
				EndOfStmt();
				Block(
#line  2137 "VBNET.ATG" 
out embeddedStatement);
				Expect(119);

#line  2140 "VBNET.ATG" 
				statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.Start);
				
			} else if (la.kind == 1 || la.kind == 13) {
				EndOfStmt();
				Block(
#line  2144 "VBNET.ATG" 
out embeddedStatement);
				Expect(119);
				if (la.kind == 179 || la.kind == 183) {
					WhileOrUntil(
#line  2145 "VBNET.ATG" 
out conditionType);
					Expr(
#line  2145 "VBNET.ATG" 
out expr);
				}

#line  2147 "VBNET.ATG" 
				statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End);
				
			} else SynErr(230);
			break;
		}
		case 99: {
			lexer.NextToken();

#line  2152 "VBNET.ATG" 
			Expression group = null;
			LoopControlVariableExpression loopControlExpr = null;
			
			if (la.kind == 86) {
				lexer.NextToken();
				LoopControlVariable(
#line  2157 "VBNET.ATG" 
out loopControlExpr);
				Expect(110);
				Expr(
#line  2158 "VBNET.ATG" 
out group);
				EndOfStmt();
				Block(
#line  2159 "VBNET.ATG" 
out embeddedStatement);
				Expect(129);
				if (StartOf(18)) {
					Expr(
#line  2160 "VBNET.ATG" 
out expr);
				}

#line  2162 "VBNET.ATG" 
				statement = new ForeachStatement(loopControlExpr, group, embeddedStatement, expr);
				
			} else if (StartOf(9)) {

#line  2166 "VBNET.ATG" 
				Expression start = null;
				Expression end = null;
				Expression step = null;
				Expression nextExpr = null;
				ArrayList nextExpressions = null;
				
				LoopControlVariable(
#line  2172 "VBNET.ATG" 
out loopControlExpr);
				Expect(11);
				Expr(
#line  2173 "VBNET.ATG" 
out start);
				Expect(174);
				Expr(
#line  2173 "VBNET.ATG" 
out end);
				if (la.kind == 164) {
					lexer.NextToken();
					Expr(
#line  2173 "VBNET.ATG" 
out step);
				}
				EndOfStmt();
				Block(
#line  2174 "VBNET.ATG" 
out embeddedStatement);
				Expect(129);
				if (StartOf(18)) {
					Expr(
#line  2177 "VBNET.ATG" 
out nextExpr);

#line  2177 "VBNET.ATG" 
					nextExpressions = new ArrayList(); nextExpressions.Add(nextExpr); 
					while (la.kind == 12) {
						lexer.NextToken();
						Expr(
#line  2178 "VBNET.ATG" 
out nextExpr);

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

#line  2181 "VBNET.ATG" 
				statement = new ForStatement(loopControlExpr, start, end, step, embeddedStatement, nextExpressions);
				
			} else SynErr(231);
			break;
		}
		case 93: {
			lexer.NextToken();
			Expr(
#line  2185 "VBNET.ATG" 
out expr);

#line  2185 "VBNET.ATG" 
			statement = new ErrorStatement(expr); 
			break;
		}
		case 153: {
			lexer.NextToken();

#line  2187 "VBNET.ATG" 
			Expression clause = null; 
			if (la.kind == 146) {
				lexer.NextToken();
			}
			Expr(
#line  2188 "VBNET.ATG" 
out clause);

#line  2190 "VBNET.ATG" 
			ArrayList clauses = new ArrayList();
			clauses.Add(clause);
			/*ReDimStatement reDimStatement = new ReDimStatement(clauses);*/
			
			while (la.kind == 12) {
				lexer.NextToken();
				Expr(
#line  2194 "VBNET.ATG" 
out clause);

#line  2194 "VBNET.ATG" 
				clauses.Add(clause); 
			}
			break;
		}
		case 92: {
			lexer.NextToken();
			Expr(
#line  2197 "VBNET.ATG" 
out expr);

#line  2199 "VBNET.ATG" 
			ArrayList arrays = new ArrayList();
			arrays.Add(expr);
			EraseStatement eraseStatement = new EraseStatement(arrays);
			
			
			while (la.kind == 12) {
				lexer.NextToken();
				Expr(
#line  2204 "VBNET.ATG" 
out expr);

#line  2204 "VBNET.ATG" 
				arrays.Add(expr); 
			}

#line  2205 "VBNET.ATG" 
			statement = eraseStatement; 
			break;
		}
		case 165: {
			lexer.NextToken();

#line  2207 "VBNET.ATG" 
			statement = new StopStatement(); 
			break;
		}
		case 107: {
			lexer.NextToken();
			Expr(
#line  2209 "VBNET.ATG" 
out expr);
			if (la.kind == 172) {
				lexer.NextToken();
			}
			if (
#line  2211 "VBNET.ATG" 
IsEndStmtAhead()) {
				Expect(89);

#line  2211 "VBNET.ATG" 
				statement = new IfStatement(expr, new EndStatement()); 
			} else if (la.kind == 1 || la.kind == 13) {
				EndOfStmt();
				Block(
#line  2214 "VBNET.ATG" 
out embeddedStatement);

#line  2216 "VBNET.ATG" 
				ArrayList elseIfSections = new ArrayList();
				IfStatement ifStatement = new IfStatement(expr, embeddedStatement);
				
				while (la.kind == 88 || 
#line  2221 "VBNET.ATG" 
IsElseIf()) {
					if (
#line  2221 "VBNET.ATG" 
IsElseIf()) {
						Expect(87);
						Expect(107);
					} else {
						lexer.NextToken();
					}

#line  2224 "VBNET.ATG" 
					Expression condition = null; Statement block = null; 
					Expr(
#line  2225 "VBNET.ATG" 
out condition);
					if (la.kind == 172) {
						lexer.NextToken();
					}
					EndOfStmt();
					Block(
#line  2226 "VBNET.ATG" 
out block);

#line  2228 "VBNET.ATG" 
					ElseIfSection elseIfSection = new ElseIfSection(condition, block);
					elseIfSections.Add(elseIfSection);
					
				}
				if (la.kind == 87) {
					lexer.NextToken();
					EndOfStmt();
					Block(
#line  2234 "VBNET.ATG" 
out embeddedStatement);

#line  2236 "VBNET.ATG" 
					ifStatement.EmbeddedElseStatement = embeddedStatement;
					
				}
				Expect(89);
				Expect(107);

#line  2240 "VBNET.ATG" 
				ifStatement.ElseIfStatements = elseIfSections;
				statement = ifStatement;
				
			} else if (StartOf(27)) {
				EmbeddedStatement(
#line  2244 "VBNET.ATG" 
out embeddedStatement);

#line  2246 "VBNET.ATG" 
				SimpleIfStatement ifStatement = new SimpleIfStatement(expr);
				ArrayList statements = new ArrayList();
				statements.Add(embeddedStatement);
				ifStatement.Statements = statements;
				
				while (la.kind == 13) {
					lexer.NextToken();
					EmbeddedStatement(
#line  2251 "VBNET.ATG" 
out embeddedStatement);

#line  2251 "VBNET.ATG" 
					statements.Add(embeddedStatement); 
				}
				if (la.kind == 87) {
					lexer.NextToken();
					if (StartOf(27)) {
						EmbeddedStatement(
#line  2253 "VBNET.ATG" 
out embeddedStatement);
					}

#line  2255 "VBNET.ATG" 
					ArrayList elseStatements = new ArrayList();
					elseStatements.Add(embeddedStatement);
					ifStatement.ElseStatements = elseStatements;
					
					while (la.kind == 13) {
						lexer.NextToken();
						EmbeddedStatement(
#line  2260 "VBNET.ATG" 
out embeddedStatement);

#line  2261 "VBNET.ATG" 
						elseStatements.Add(embeddedStatement); 
					}
				}

#line  2264 "VBNET.ATG" 
				statement = ifStatement; 
			} else SynErr(232);
			break;
		}
		case 157: {
			lexer.NextToken();
			if (la.kind == 58) {
				lexer.NextToken();
			}
			Expr(
#line  2267 "VBNET.ATG" 
out expr);
			EndOfStmt();

#line  2269 "VBNET.ATG" 
			ArrayList selectSections = new ArrayList();
			Statement block = null;
			
			while (la.kind == 58) {

#line  2273 "VBNET.ATG" 
				ArrayList caseClauses = null; 
				lexer.NextToken();
				CaseClauses(
#line  2274 "VBNET.ATG" 
out caseClauses);
				if (
#line  2274 "VBNET.ATG" 
IsNotStatementSeparator()) {
					lexer.NextToken();
				}
				EndOfStmt();

#line  2276 "VBNET.ATG" 
				SelectSection selectSection = new SelectSection();
				selectSection.CaseClauses = caseClauses;
				compilationUnit.BlockStart(selectSection);
				
				Block(
#line  2280 "VBNET.ATG" 
out block);

#line  2282 "VBNET.ATG" 
				selectSection.EmbeddedStatement = block;
				compilationUnit.BlockEnd();
				selectSections.Add(selectSection);
				
			}

#line  2287 "VBNET.ATG" 
			statement = new SelectStatement(expr, selectSections); 
			Expect(89);
			Expect(157);
			break;
		}
		case 136: {

#line  2289 "VBNET.ATG" 
			OnErrorStatement onErrorStatement = null; 
			OnErrorStatement(
#line  2290 "VBNET.ATG" 
out onErrorStatement);

#line  2290 "VBNET.ATG" 
			statement = onErrorStatement; 
			break;
		}
		case 105: {

#line  2291 "VBNET.ATG" 
			GoToStatement goToStatement = null; 
			GoToStatement(
#line  2292 "VBNET.ATG" 
out goToStatement);

#line  2292 "VBNET.ATG" 
			statement = goToStatement; 
			break;
		}
		case 155: {

#line  2293 "VBNET.ATG" 
			ResumeStatement resumeStatement = null; 
			ResumeStatement(
#line  2294 "VBNET.ATG" 
out resumeStatement);

#line  2294 "VBNET.ATG" 
			statement = resumeStatement; 
			break;
		}
		case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 14: case 15: case 16: case 25: case 44: case 52: case 53: case 55: case 60: case 61: case 62: case 63: case 64: case 65: case 66: case 67: case 69: case 70: case 71: case 73: case 74: case 75: case 76: case 77: case 78: case 83: case 85: case 97: case 103: case 112: case 118: case 120: case 125: case 126: case 128: case 131: case 161: case 162: case 167: case 171: case 175: case 177: {

#line  2297 "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;
			
			UnaryExpr(
#line  2303 "VBNET.ATG" 
out expr);
			if (StartOf(14)) {
				AssignmentOperator(
#line  2305 "VBNET.ATG" 
out op);
				Expr(
#line  2305 "VBNET.ATG" 
out val);

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

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

#line  2309 "VBNET.ATG" 
			// a field reference expression that stands alone is a
			// invocation expression without parantheses and arguments
			if(expr is FieldReferenceOrInvocationExpression) {
				expr = new InvocationExpression(expr, new ArrayList());
			}
			statement = new StatementExpression(expr);
			
			break;
		}
		case 57: {
			lexer.NextToken();
			UnaryExpr(
#line  2316 "VBNET.ATG" 
out expr);

#line  2316 "VBNET.ATG" 
			statement = new StatementExpression(expr); 
			break;
		}
		default: SynErr(234); break;
		}
	}
 public virtual object Visit(StopStatement stopStatement, object data)
 {
     return data;
 }