Пример #1
0
 public override object Visit(ParenthesizedExpression parenthesizedExpression, object data)
 {
     if (parenthesizedExpression == null) {
         return null;
     }
     return parenthesizedExpression.Expression.AcceptVisitor(this, data);
 }
 public override object Visit(ParenthesizedExpression expression, object data)
 {
     return expression.Expression.AcceptVisitor(this, data);
 }
Пример #3
0
	void SimpleExpr(
#line  1493 "VBNET.ATG" 
out Expression pexpr) {

#line  1495 "VBNET.ATG" 
		Expression expr;
		TypeReference type = null;
		string name = String.Empty;
		pexpr = null;
		
		if (StartOf(20)) {
			switch (la.kind) {
			case 3: {
				lexer.NextToken();

#line  1503 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val);  
				break;
			}
			case 4: {
				lexer.NextToken();

#line  1504 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val);  
				break;
			}
			case 7: {
				lexer.NextToken();

#line  1505 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val);  
				break;
			}
			case 6: {
				lexer.NextToken();

#line  1506 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val);  
				break;
			}
			case 5: {
				lexer.NextToken();

#line  1507 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val);  
				break;
			}
			case 9: {
				lexer.NextToken();

#line  1508 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val);  
				break;
			}
			case 8: {
				lexer.NextToken();

#line  1509 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val);  
				break;
			}
			case 175: {
				lexer.NextToken();

#line  1511 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(true, "true");  
				break;
			}
			case 97: {
				lexer.NextToken();

#line  1512 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(false, "false"); 
				break;
			}
			case 131: {
				lexer.NextToken();

#line  1513 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(null, "null");  
				break;
			}
			case 25: {
				lexer.NextToken();
				Expr(
#line  1514 "VBNET.ATG" 
out expr);
				Expect(26);

#line  1514 "VBNET.ATG" 
				pexpr = new ParenthesizedExpression(expr); 
				break;
			}
			case 2: case 52: case 71: case 171: {
				Identifier();

#line  1515 "VBNET.ATG" 
				pexpr = new IdentifierExpression(t.val); 
				break;
			}
			case 53: case 55: case 66: case 77: case 78: case 85: case 112: case 118: case 161: case 162: case 167: {

#line  1516 "VBNET.ATG" 
				string val = String.Empty; 
				PrimitiveTypeName(
#line  1516 "VBNET.ATG" 
out val);
				Expect(10);
				Identifier();

#line  1517 "VBNET.ATG" 
				pexpr = new FieldReferenceOrInvocationExpression(new TypeReferenceExpression(val), t.val); 
				break;
			}
			case 120: {
				lexer.NextToken();

#line  1518 "VBNET.ATG" 
				pexpr = new ThisReferenceExpression(); 
				break;
			}
			case 125: case 126: {

#line  1519 "VBNET.ATG" 
				Expression retExpr = null; 
				if (la.kind == 125) {
					lexer.NextToken();

#line  1520 "VBNET.ATG" 
					retExpr = new BaseReferenceExpression(); 
				} else if (la.kind == 126) {
					lexer.NextToken();

#line  1521 "VBNET.ATG" 
					retExpr = new ClassReferenceExpression(); 
				} else SynErr(217);
				Expect(10);
				IdentifierOrKeyword(
#line  1523 "VBNET.ATG" 
out name);

#line  1523 "VBNET.ATG" 
				pexpr = new FieldReferenceOrInvocationExpression(retExpr, name); 
				break;
			}
			case 128: {
				ObjectCreateExpression(
#line  1524 "VBNET.ATG" 
out expr);

#line  1524 "VBNET.ATG" 
				pexpr = expr; 
				break;
			}
			case 76: case 83: {
				if (la.kind == 83) {
					lexer.NextToken();
				} else if (la.kind == 76) {
					lexer.NextToken();
				} else SynErr(218);
				Expect(25);
				Expr(
#line  1525 "VBNET.ATG" 
out expr);
				Expect(12);
				TypeName(
#line  1525 "VBNET.ATG" 
out type);
				Expect(26);

#line  1525 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr); 
				break;
			}
			case 60: case 61: case 62: case 63: case 64: case 65: case 67: case 69: case 70: case 73: case 74: case 75: {
				CastTarget(
#line  1526 "VBNET.ATG" 
out type);
				Expect(25);
				Expr(
#line  1526 "VBNET.ATG" 
out expr);
				Expect(26);

#line  1526 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, true); 
				break;
			}
			case 44: {
				lexer.NextToken();
				Expr(
#line  1527 "VBNET.ATG" 
out expr);

#line  1527 "VBNET.ATG" 
				pexpr = new AddressOfExpression(expr); 
				break;
			}
			case 103: {
				lexer.NextToken();
				Expect(25);
				TypeName(
#line  1528 "VBNET.ATG" 
out type);
				Expect(26);

#line  1528 "VBNET.ATG" 
				pexpr = new GetTypeExpression(type); 
				break;
			}
			case 177: {
				lexer.NextToken();
				SimpleExpr(
#line  1529 "VBNET.ATG" 
out expr);
				Expect(114);
				TypeName(
#line  1529 "VBNET.ATG" 
out type);

#line  1529 "VBNET.ATG" 
				pexpr = new TypeOfExpression(expr, type); 
				break;
			}
			}
			while (la.kind == 10 || la.kind == 25) {
				if (la.kind == 10) {
					lexer.NextToken();
					IdentifierOrKeyword(
#line  1532 "VBNET.ATG" 
out name);

#line  1532 "VBNET.ATG" 
					pexpr = new FieldReferenceOrInvocationExpression(pexpr, name); 
				} else {
					lexer.NextToken();

#line  1533 "VBNET.ATG" 
					ArrayList parameters = new ArrayList(); 
					if (StartOf(21)) {

#line  1535 "VBNET.ATG" 
						expr = null; 
						if (StartOf(18)) {
							Argument(
#line  1535 "VBNET.ATG" 
out expr);
						}

#line  1535 "VBNET.ATG" 
						parameters.Add(expr); 
						while (la.kind == 12) {
							lexer.NextToken();

#line  1537 "VBNET.ATG" 
							expr = null; 
							if (StartOf(18)) {
								Argument(
#line  1538 "VBNET.ATG" 
out expr);
							}

#line  1538 "VBNET.ATG" 
							parameters.Add(expr); 
						}
					}
					Expect(26);

#line  1541 "VBNET.ATG" 
					pexpr = new InvocationExpression(pexpr, parameters); 
				}
			}
		} else if (la.kind == 10) {
			lexer.NextToken();
			IdentifierOrKeyword(
#line  1545 "VBNET.ATG" 
out name);

#line  1545 "VBNET.ATG" 
			pexpr = new FieldReferenceOrInvocationExpression(pexpr, name);
			while (la.kind == 10 || la.kind == 25) {
				if (la.kind == 10) {
					lexer.NextToken();
					IdentifierOrKeyword(
#line  1547 "VBNET.ATG" 
out name);

#line  1547 "VBNET.ATG" 
					pexpr = new FieldReferenceOrInvocationExpression(pexpr, name); 
				} else {
					lexer.NextToken();

#line  1548 "VBNET.ATG" 
					ArrayList parameters = new ArrayList(); 
					if (StartOf(21)) {

#line  1550 "VBNET.ATG" 
						expr = null; 
						if (StartOf(18)) {
							Argument(
#line  1550 "VBNET.ATG" 
out expr);
						}

#line  1550 "VBNET.ATG" 
						parameters.Add(expr); 
						while (la.kind == 12) {
							lexer.NextToken();

#line  1552 "VBNET.ATG" 
							expr = null; 
							if (StartOf(18)) {
								Argument(
#line  1553 "VBNET.ATG" 
out expr);
							}

#line  1553 "VBNET.ATG" 
							parameters.Add(expr); 
						}
					}
					Expect(26);

#line  1556 "VBNET.ATG" 
					pexpr = new InvocationExpression(pexpr, parameters); 
				}
			}
		} else SynErr(219);
	}
 public object Visit(ParenthesizedExpression parenthesizedExpression, object data)
 {
     DebugOutput(parenthesizedExpression);
     string innerExpr = parenthesizedExpression.Expression.AcceptVisitor(this, data).ToString();
     return String.Concat("(", innerExpr, ")");
 }
 public virtual object Visit(ParenthesizedExpression parenthesizedExpression, object data)
 {
     return parenthesizedExpression.Expression.AcceptVisitor(this, data);
 }