public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
		{
			if (primitiveExpression.Value is bool)
				return (bool)primitiveExpression.Value ? SymbolDefined : null;
			else
				return null;
		}
		public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
		{
			if (primitiveExpression.Value == null) {
				return NullReturnType.Instance;
			} else {
				return resolver.ProjectContent.SystemTypes.CreatePrimitive(primitiveExpression.Value.GetType());
			}
		}
		public object VisitPrimitiveExpression(PrimitiveExpression pe, object data)
		{
			object val = pe.Value;
			if (val == null) {
				return new B.NullLiteralExpression(GetLexicalInfo(pe));
			}
			if (val is string) {
				return new B.StringLiteralExpression(GetLexicalInfo(pe), (string)val);
			}
			if (val is char) {
				return new B.CharLiteralExpression(GetLexicalInfo(pe), ((char)val).ToString());
			}
			if (val is bool) {
				return new B.BoolLiteralExpression(GetLexicalInfo(pe), (bool)val);
			}
			if (val is byte) {
				AddWarning(pe, "Converting byte literal to int literal");
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (byte)val, false);
			}
			if (val is short) {
				AddWarning(pe, "Converting short literal to int literal");
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (short)val, false);
			}
			if (val is int) {
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (int)val, false);
			}
			if (val is long) {
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (long)val, true);
			}
			if (val is sbyte) {
				AddWarning(pe, "Converting sbyte literal to int literal");
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (sbyte)val, false);
			}
			if (val is ushort) {
				AddWarning(pe, "Converting ushort literal to int literal");
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (ushort)val, false);
			}
			if (val is uint) {
				AddWarning(pe, "Converting uint literal to int/long literal");
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (uint)val);
			}
			if (val is ulong) {
				AddWarning(pe, "Converting ulong literal to long literal");
				return new B.IntegerLiteralExpression(GetLexicalInfo(pe), (long)((ulong)val), true);
			}
			if (val is float) {
				return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (float)val, true);
			}
			if (val is double) {
				return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (double)val, false);
			}
			if (val is decimal) {
				AddWarning(pe, "Converting decimal literal to double literal");
				return new B.DoubleLiteralExpression(GetLexicalInfo(pe), (double)(decimal)val);
			}
			AddError(pe, "Unknown primitive literal of type " + val.GetType().FullName);
			return null;
		}
Exemple #4
0
 static object ConvertAttributeArgument(AST.Expression expression)
 {
     AST.PrimitiveExpression pe = expression as AST.PrimitiveExpression;
     if (pe != null)
     {
         return(pe.Value);
     }
     else
     {
         return(null);
     }
 }
 private bool IsMatch(PrimitiveExpression l, PrimitiveExpression r)
 {
     if (l.Value == null && r.Value == null)
     {
         // both null counts as a match
     }
     else if (l.Value == null || r.Value == null || !l.Value.Equals(r.Value))
     {
         // Fail if one or the other is null, or the values don't match.
         return false;
     }
     return true;
 }
 public static BlockStatement add_Return(this BlockStatement blockStatement, object returnData)
 {
     if (returnData.notNull())
     {
         Expression returnStatement;
         //if (returnData is ExpressionStatement)
         //returnStatement = returnData as ExpressionStatement;
         if (returnData is Expression)
             returnStatement = (returnData as Expression);
         else
             returnStatement = new PrimitiveExpression(returnData, returnData.str());
         blockStatement.append(new ReturnStatement(returnStatement));
     }
     return blockStatement;
 }
        protected void CompleteInternal(CompletionContext context, string key)
        {
            string insertString;

            if (this.outputVisitor != null) {
                PrimitiveExpression pre = new PrimitiveExpression(key, key);
                pre.AcceptVisitor(this.outputVisitor, null);
                insertString = this.outputVisitor.Text;
            } else {
                insertString = key;
            }

            context.Editor.Document.Replace(context.StartOffset, context.Length, insertString);
            context.EndOffset = context.StartOffset + insertString.Length;
        }
		protected override string GenerateCode(LanguageProperties language, IClass currentClass)
		{
			string[] fields = listBox.SelectedItems.OfType<PropertyOrFieldWrapper>().Select(f2 => f2.MemberName).ToArray();
			
			Ast.PrimitiveExpression formatString = new Ast.PrimitiveExpression(GenerateFormatString(currentClass, language.CodeGenerator, fields));
			List<Ast.Expression> param = new List<Ast.Expression>() { formatString };
			
			Ast.ReturnStatement ret = new Ast.ReturnStatement(new Ast.InvocationExpression(
				new Ast.MemberReferenceExpression(new Ast.TypeReferenceExpression(new Ast.TypeReference("System.String", true)), "Format"),
				param.Concat(fields.Select(f => new Ast.IdentifierExpression(f))).ToList()
			));
			
			insertedCode = language.CodeGenerator.GenerateCode(ret, "").Trim();
			
			return insertedCode;
		}
        public static BlockStatement add_Return(this BlockStatement blockStatement, object returnData)
        {
			Expression returnStatement;
			if (returnData.isNull())
				returnStatement = new PrimitiveExpression(null);
			else
			{
				if (returnData is Expression)
					returnStatement = (returnData as Expression);
				else
					returnStatement = new PrimitiveExpression(returnData, returnData.str());

			}
			blockStatement.append(new ReturnStatement(returnStatement));
            return blockStatement;
        }
		/// <summary>
		/// Insert the element represented by the completion data into the text
		/// editor.
		/// </summary>
		/// <param name="textArea">TextArea to insert the completion data in.</param>
		/// <param name="ch">Character that should be inserted after the completion data.
		/// \0 when no character should be inserted.</param>
		/// <returns>Returns true when the insert action has processed the character
		/// <paramref name="ch"/>; false when the character was not processed.</returns>
		public override bool InsertAction(TextArea textArea, char ch)
		{
			string insertString;
			
			if (this.outputVisitor != null) {
				PrimitiveExpression pre = new PrimitiveExpression(this.Text, this.Text);
				pre.AcceptVisitor(this.outputVisitor, null);
				insertString = this.outputVisitor.Text;
			} else {
				insertString = this.Text;
			}
			
			textArea.InsertString(insertString);
			if (ch == insertString[insertString.Length - 1]) {
				return true;
			}
			return false;
		}
        protected override string GenerateCode(LanguageProperties language, IClass currentClass)
        {
            string[] fields = listBox.SelectedItems.OfType <PropertyOrFieldWrapper>().Select(f2 => f2.MemberName).ToArray();

            Ast.PrimitiveExpression formatString = new Ast.PrimitiveExpression(GenerateFormatString(currentClass, language.CodeGenerator, fields));
            List <Ast.Expression>   param        = new List <Ast.Expression>()
            {
                formatString
            };

            Ast.ReturnStatement ret = new Ast.ReturnStatement(new Ast.InvocationExpression(
                                                                  new Ast.MemberReferenceExpression(new Ast.TypeReferenceExpression(new Ast.TypeReference("System.String", true)), "Format"),
                                                                  param.Concat(fields.Select(f => new Ast.IdentifierExpression(f))).ToList()
                                                                  ));

            insertedCode = language.CodeGenerator.GenerateCode(ret, "").Trim();

            return(insertedCode);
        }
Exemple #12
0
	void SimpleNonInvocationExpression(
#line  1593 "VBNET.ATG" 
out Expression pexpr) {

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

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

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

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

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

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

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

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

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

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

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

#line  1614 "VBNET.ATG" 
				pexpr = new ParenthesizedExpression(expr); 
				break;
			}
			case 2: case 47: case 49: case 50: case 51: case 70: case 95: case 134: case 144: case 169: case 176: case 177: case 205: {
				Identifier();

#line  1616 "VBNET.ATG" 
				pexpr = new IdentifierExpression(t.val); 

#line  1617 "VBNET.ATG" 
				pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
				break;
			}
			case 52: case 54: case 65: case 76: case 77: case 84: case 111: case 117: case 133: case 159: case 160: case 165: case 191: case 192: case 193: case 194: {

#line  1618 "VBNET.ATG" 
				string val = String.Empty; 
				if (StartOf(10)) {
					PrimitiveTypeName(
#line  1619 "VBNET.ATG" 
out val);
				} else if (la.kind == 133) {
					lexer.NextToken();

#line  1619 "VBNET.ATG" 
					val = "Object"; 
				} else SynErr(240);
				Expect(10);

#line  1620 "VBNET.ATG" 
				t.val = ""; 
				Identifier();

#line  1620 "VBNET.ATG" 
				pexpr = new MemberReferenceExpression(new TypeReferenceExpression(val), t.val); 
				break;
			}
			case 119: {
				lexer.NextToken();

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

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

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

#line  1624 "VBNET.ATG" 
					retExpr = new ClassReferenceExpression(); 
				} else SynErr(241);
				Expect(10);
				IdentifierOrKeyword(
#line  1626 "VBNET.ATG" 
out name);

#line  1626 "VBNET.ATG" 
				pexpr = new MemberReferenceExpression(retExpr, name); 
				break;
			}
			case 199: {
				lexer.NextToken();
				Expect(10);
				Identifier();

#line  1628 "VBNET.ATG" 
				type = new TypeReference(t.val ?? ""); 

#line  1630 "VBNET.ATG" 
				type.IsGlobal = true; 

#line  1631 "VBNET.ATG" 
				pexpr = new TypeReferenceExpression(type); 
				break;
			}
			case 127: {
				ObjectCreateExpression(
#line  1632 "VBNET.ATG" 
out expr);

#line  1632 "VBNET.ATG" 
				pexpr = expr; 
				break;
			}
			case 75: case 82: case 200: {

#line  1634 "VBNET.ATG" 
				CastType castType = CastType.Cast; 
				if (la.kind == 82) {
					lexer.NextToken();
				} else if (la.kind == 75) {
					lexer.NextToken();

#line  1636 "VBNET.ATG" 
					castType = CastType.Conversion; 
				} else if (la.kind == 200) {
					lexer.NextToken();

#line  1637 "VBNET.ATG" 
					castType = CastType.TryCast; 
				} else SynErr(242);
				Expect(24);
				Expr(
#line  1639 "VBNET.ATG" 
out expr);
				Expect(12);
				TypeName(
#line  1639 "VBNET.ATG" 
out type);
				Expect(25);

#line  1640 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, castType); 
				break;
			}
			case 59: case 60: case 61: case 62: case 63: case 64: case 66: case 68: case 69: case 72: case 73: case 74: case 195: case 196: case 197: case 198: {
				CastTarget(
#line  1641 "VBNET.ATG" 
out type);
				Expect(24);
				Expr(
#line  1641 "VBNET.ATG" 
out expr);
				Expect(25);

#line  1641 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); 
				break;
			}
			case 43: {
				lexer.NextToken();
				Expr(
#line  1642 "VBNET.ATG" 
out expr);

#line  1642 "VBNET.ATG" 
				pexpr = new AddressOfExpression(expr); 
				break;
			}
			case 102: {
				lexer.NextToken();
				Expect(24);
				GetTypeTypeName(
#line  1643 "VBNET.ATG" 
out type);
				Expect(25);

#line  1643 "VBNET.ATG" 
				pexpr = new TypeOfExpression(type); 
				break;
			}
			case 175: {
				lexer.NextToken();
				SimpleExpr(
#line  1644 "VBNET.ATG" 
out expr);
				Expect(113);
				TypeName(
#line  1644 "VBNET.ATG" 
out type);

#line  1644 "VBNET.ATG" 
				pexpr = new TypeOfIsExpression(expr, type); 
				break;
			}
			}
		} else if (la.kind == 10) {
			lexer.NextToken();
			IdentifierOrKeyword(
#line  1648 "VBNET.ATG" 
out name);

#line  1648 "VBNET.ATG" 
			pexpr = new MemberReferenceExpression(null, name);
		} else SynErr(243);
	}
Exemple #13
0
		public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
		{
			if (primitiveExpression.Value == null) 
				return CreateResult ("");
			Type type = primitiveExpression.Value.GetType();
			return CreateResult (type.FullName);
		}
Exemple #14
0
 public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
 {
     return new CodePrimitiveExpression(primitiveExpression.Value);
 }
 public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
 {
     foreach (var r in Replacements)
     {
         if (ReferenceEquals(primitiveExpression, r.Target))
         {
             ReplaceCurrentNode(r.Replacement);
         }
     }
     return base.VisitPrimitiveExpression(primitiveExpression, data);
 }
Exemple #16
0
	void SimpleNonInvocationExpression(
#line  1730 "VBNET.ATG" 
out Expression pexpr) {

#line  1732 "VBNET.ATG" 
		Expression expr;
		CollectionInitializerExpression cie;
		TypeReference type = null;
		string name = String.Empty;
		Location startLocation = la.Location;
		pexpr = null;
		
		if (StartOf(35)) {
			switch (la.kind) {
			case 3: {
				lexer.NextToken();

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

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

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

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

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

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

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

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

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

#line  1752 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(null, "null");  
				break;
			}
			case 37: {
				lexer.NextToken();
				Expr(
#line  1753 "VBNET.ATG" 
out expr);
				Expect(38);

#line  1753 "VBNET.ATG" 
				pexpr = new ParenthesizedExpression(expr); 
				break;
			}
			case 2: case 58: case 62: case 64: case 65: case 66: case 67: case 68: case 69: case 72: case 89: case 100: case 106: case 109: case 118: case 123: case 128: case 135: case 141: case 145: case 148: case 149: case 150: case 173: case 179: case 181: case 187: case 206: case 215: case 216: case 226: case 227: case 233: case 240: {
				Identifier();

#line  1755 "VBNET.ATG" 
				pexpr = new IdentifierExpression(t.val);
				pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
				
				if (
#line  1758 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
					lexer.NextToken();
					Expect(172);
					TypeArgumentList(
#line  1759 "VBNET.ATG" 
((IdentifierExpression)pexpr).TypeArguments);
					Expect(38);
				}
				break;
			}
			case 70: case 73: case 84: case 101: case 102: case 111: case 143: case 154: case 171: case 199: case 204: case 205: case 211: case 224: case 225: case 228: {

#line  1761 "VBNET.ATG" 
				string val = String.Empty; 
				if (StartOf(12)) {
					PrimitiveTypeName(
#line  1762 "VBNET.ATG" 
out val);
				} else if (la.kind == 171) {
					lexer.NextToken();

#line  1762 "VBNET.ATG" 
					val = "System.Object"; 
				} else SynErr(284);

#line  1763 "VBNET.ATG" 
				pexpr = new TypeReferenceExpression(new TypeReference(val, true)); 
				break;
			}
			case 156: {
				lexer.NextToken();

#line  1764 "VBNET.ATG" 
				pexpr = new ThisReferenceExpression(); 
				break;
			}
			case 161: case 162: {

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

#line  1766 "VBNET.ATG" 
					retExpr = new BaseReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; 
				} else if (la.kind == 162) {
					lexer.NextToken();

#line  1767 "VBNET.ATG" 
					retExpr = new ClassReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; 
				} else SynErr(285);
				Expect(26);
				IdentifierOrKeyword(
#line  1769 "VBNET.ATG" 
out name);

#line  1769 "VBNET.ATG" 
				pexpr = new MemberReferenceExpression(retExpr, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				break;
			}
			case 132: {
				lexer.NextToken();
				Expect(26);
				Identifier();

#line  1771 "VBNET.ATG" 
				type = new TypeReference(t.val ?? ""); 

#line  1773 "VBNET.ATG" 
				type.IsGlobal = true; 

#line  1774 "VBNET.ATG" 
				pexpr = new TypeReferenceExpression(type); 
				break;
			}
			case 165: {
				ObjectCreateExpression(
#line  1775 "VBNET.ATG" 
out expr);

#line  1775 "VBNET.ATG" 
				pexpr = expr; 
				break;
			}
			case 35: {
				CollectionInitializer(
#line  1776 "VBNET.ATG" 
out cie);

#line  1776 "VBNET.ATG" 
				pexpr = cie; 
				break;
			}
			case 96: case 108: case 222: {

#line  1778 "VBNET.ATG" 
				CastType castType = CastType.Cast; 
				if (la.kind == 108) {
					lexer.NextToken();
				} else if (la.kind == 96) {
					lexer.NextToken();

#line  1780 "VBNET.ATG" 
					castType = CastType.Conversion; 
				} else if (la.kind == 222) {
					lexer.NextToken();

#line  1781 "VBNET.ATG" 
					castType = CastType.TryCast; 
				} else SynErr(286);
				Expect(37);
				Expr(
#line  1783 "VBNET.ATG" 
out expr);
				Expect(22);
				TypeName(
#line  1783 "VBNET.ATG" 
out type);
				Expect(38);

#line  1784 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, castType); 
				break;
			}
			case 78: case 79: case 80: case 81: case 82: case 83: case 85: case 87: case 88: case 92: case 93: case 94: case 95: case 97: case 98: case 99: {
				CastTarget(
#line  1785 "VBNET.ATG" 
out type);
				Expect(37);
				Expr(
#line  1785 "VBNET.ATG" 
out expr);
				Expect(38);

#line  1785 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); 
				break;
			}
			case 57: {
				lexer.NextToken();
				Expr(
#line  1786 "VBNET.ATG" 
out expr);

#line  1786 "VBNET.ATG" 
				pexpr = new AddressOfExpression(expr); 
				break;
			}
			case 131: {
				lexer.NextToken();
				Expect(37);
				GetTypeTypeName(
#line  1787 "VBNET.ATG" 
out type);
				Expect(38);

#line  1787 "VBNET.ATG" 
				pexpr = new TypeOfExpression(type); 
				break;
			}
			case 223: {
				lexer.NextToken();
				SimpleExpr(
#line  1788 "VBNET.ATG" 
out expr);
				Expect(146);
				TypeName(
#line  1788 "VBNET.ATG" 
out type);

#line  1788 "VBNET.ATG" 
				pexpr = new TypeOfIsExpression(expr, type); 
				break;
			}
			case 137: {
				ConditionalExpression(
#line  1789 "VBNET.ATG" 
out pexpr);
				break;
			}
			case 10: case 16: case 17: case 18: case 19: {
				XmlLiteralExpression(
#line  1790 "VBNET.ATG" 
out pexpr);
				break;
			}
			}
		} else if (StartOf(36)) {
			if (la.kind == 26) {
				lexer.NextToken();
				if (la.kind == 10) {
					lexer.NextToken();
					IdentifierOrKeyword(
#line  1796 "VBNET.ATG" 
out name);
					Expect(11);

#line  1797 "VBNET.ATG" 
					pexpr = new XmlMemberAccessExpression(null, XmlAxisType.Element, name, true) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				} else if (StartOf(34)) {
					IdentifierOrKeyword(
#line  1798 "VBNET.ATG" 
out name);

#line  1799 "VBNET.ATG" 
					pexpr = new MemberReferenceExpression(null, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				} else SynErr(287);
			} else if (la.kind == 29) {
				lexer.NextToken();
				IdentifierOrKeyword(
#line  1801 "VBNET.ATG" 
out name);

#line  1801 "VBNET.ATG" 
				pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation }); 
			} else {

#line  1802 "VBNET.ATG" 
				XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false; 
				if (la.kind == 27) {
					lexer.NextToken();

#line  1803 "VBNET.ATG" 
					axisType = XmlAxisType.Descendents; 
				} else if (la.kind == 28) {
					lexer.NextToken();

#line  1803 "VBNET.ATG" 
					axisType = XmlAxisType.Attribute; 
				} else SynErr(288);
				if (la.kind == 10) {
					lexer.NextToken();

#line  1804 "VBNET.ATG" 
					isXmlIdentifier = true; 
				}
				IdentifierOrKeyword(
#line  1804 "VBNET.ATG" 
out name);
				if (la.kind == 11) {
					lexer.NextToken();
				}

#line  1805 "VBNET.ATG" 
				pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier); 
			}
		} else SynErr(289);

#line  1810 "VBNET.ATG" 
		if (pexpr != null) {
		pexpr.StartLocation = startLocation;
		pexpr.EndLocation = t.EndLocation;
		}
		
	}
Exemple #17
0
	void PrimaryExpr(
#line  1895 "cs.ATG" 
out Expression pexpr) {

#line  1897 "cs.ATG" 
		TypeReference type = null;
		Expression expr;
		pexpr = null;
		

#line  1902 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 113) {
			lexer.NextToken();

#line  1904 "cs.ATG" 
			pexpr = new PrimitiveExpression(true, "true");  
		} else if (la.kind == 72) {
			lexer.NextToken();

#line  1905 "cs.ATG" 
			pexpr = new PrimitiveExpression(false, "false"); 
		} else if (la.kind == 90) {
			lexer.NextToken();

#line  1906 "cs.ATG" 
			pexpr = new PrimitiveExpression(null, "null");  
		} else if (la.kind == 2) {
			lexer.NextToken();

#line  1907 "cs.ATG" 
			pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
		} else if (
#line  1908 "cs.ATG" 
StartOfQueryExpression()) {
			QueryExpression(
#line  1909 "cs.ATG" 
out pexpr);
		} else if (
#line  1910 "cs.ATG" 
IdentAndDoubleColon()) {
			Identifier();

#line  1911 "cs.ATG" 
			type = new TypeReference(t.val); 
			Expect(10);

#line  1912 "cs.ATG" 
			pexpr = new TypeReferenceExpression(type); 
			Identifier();

#line  1913 "cs.ATG" 
			if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?"); 
		} else if (la.kind == 64) {
			lexer.NextToken();
			AnonymousMethodExpr(
#line  1915 "cs.ATG" 
out expr);

#line  1915 "cs.ATG" 
			pexpr = expr; 
		} else if (
#line  1916 "cs.ATG" 
la.kind == Tokens.Async && Peek(1).kind == Tokens.Delegate) {
			Expect(145);
			Expect(64);
			AnonymousMethodExpr(
#line  1917 "cs.ATG" 
out expr);

#line  1917 "cs.ATG" 
			pexpr = expr; 

#line  1918 "cs.ATG" 
			((AnonymousMethodExpression)expr).IsAsync = true; 
		} else if (
#line  1920 "cs.ATG" 
la.kind == Tokens.Async && Peek(1).kind == Tokens.OpenParenthesis) {
			Expect(145);
			LambdaExpression(
#line  1922 "cs.ATG" 
out pexpr);

#line  1923 "cs.ATG" 
			((LambdaExpression)pexpr).IsAsync = true; 
		} else if (
#line  1925 "cs.ATG" 
la.kind == Tokens.Async && IsIdentifierToken(Peek(1))) {
			Expect(145);
			Identifier();

#line  1927 "cs.ATG" 
			pexpr = new IdentifierExpression(t.val); 
			ShortedLambdaExpression(
#line  1928 "cs.ATG" 
(IdentifierExpression)pexpr, out pexpr);

#line  1929 "cs.ATG" 
			((LambdaExpression)pexpr).IsAsync = true; 
		} else if (StartOf(18)) {
			Identifier();

#line  1933 "cs.ATG" 
			pexpr = new IdentifierExpression(t.val); 
			if (la.kind == 48 || 
#line  1936 "cs.ATG" 
IsGenericInSimpleNameOrMemberAccess()) {
				if (la.kind == 48) {
					ShortedLambdaExpression(
#line  1935 "cs.ATG" 
(IdentifierExpression)pexpr, out pexpr);
				} else {

#line  1937 "cs.ATG" 
					List<TypeReference> typeList; 
					TypeArgumentList(
#line  1938 "cs.ATG" 
out typeList, false);

#line  1939 "cs.ATG" 
					((IdentifierExpression)pexpr).TypeArguments = typeList; 
				}
			}
		} else if (
#line  1942 "cs.ATG" 
IsLambdaExpression()) {
			LambdaExpression(
#line  1943 "cs.ATG" 
out pexpr);
		} else if (la.kind == 20) {
			lexer.NextToken();
			Expr(
#line  1946 "cs.ATG" 
out expr);
			Expect(21);

#line  1946 "cs.ATG" 
			pexpr = new ParenthesizedExpression(expr); 
		} else if (StartOf(34)) {

#line  1949 "cs.ATG" 
			string val = null; 
			switch (la.kind) {
			case 52: {
				lexer.NextToken();

#line  1950 "cs.ATG" 
				val = "System.Boolean"; 
				break;
			}
			case 54: {
				lexer.NextToken();

#line  1951 "cs.ATG" 
				val = "System.Byte"; 
				break;
			}
			case 57: {
				lexer.NextToken();

#line  1952 "cs.ATG" 
				val = "System.Char"; 
				break;
			}
			case 62: {
				lexer.NextToken();

#line  1953 "cs.ATG" 
				val = "System.Decimal"; 
				break;
			}
			case 66: {
				lexer.NextToken();

#line  1954 "cs.ATG" 
				val = "System.Double"; 
				break;
			}
			case 75: {
				lexer.NextToken();

#line  1955 "cs.ATG" 
				val = "System.Single"; 
				break;
			}
			case 82: {
				lexer.NextToken();

#line  1956 "cs.ATG" 
				val = "System.Int32"; 
				break;
			}
			case 87: {
				lexer.NextToken();

#line  1957 "cs.ATG" 
				val = "System.Int64"; 
				break;
			}
			case 91: {
				lexer.NextToken();

#line  1958 "cs.ATG" 
				val = "System.Object"; 
				break;
			}
			case 102: {
				lexer.NextToken();

#line  1959 "cs.ATG" 
				val = "System.SByte"; 
				break;
			}
			case 104: {
				lexer.NextToken();

#line  1960 "cs.ATG" 
				val = "System.Int16"; 
				break;
			}
			case 108: {
				lexer.NextToken();

#line  1961 "cs.ATG" 
				val = "System.String"; 
				break;
			}
			case 116: {
				lexer.NextToken();

#line  1962 "cs.ATG" 
				val = "System.UInt32"; 
				break;
			}
			case 117: {
				lexer.NextToken();

#line  1963 "cs.ATG" 
				val = "System.UInt64"; 
				break;
			}
			case 120: {
				lexer.NextToken();

#line  1964 "cs.ATG" 
				val = "System.UInt16"; 
				break;
			}
			case 123: {
				lexer.NextToken();

#line  1965 "cs.ATG" 
				val = "System.Void"; 
				break;
			}
			}

#line  1967 "cs.ATG" 
			pexpr = new TypeReferenceExpression(new TypeReference(val, true)) { StartLocation = t.Location, EndLocation = t.EndLocation }; 
		} else if (la.kind == 111) {
			lexer.NextToken();

#line  1970 "cs.ATG" 
			pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 51) {
			lexer.NextToken();

#line  1972 "cs.ATG" 
			pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 89) {
			NewExpression(
#line  1975 "cs.ATG" 
out pexpr);
		} else if (la.kind == 115) {
			lexer.NextToken();
			Expect(20);
			if (
#line  1979 "cs.ATG" 
NotVoidPointer()) {
				Expect(123);

#line  1979 "cs.ATG" 
				type = new TypeReference("System.Void", true); 
			} else if (StartOf(10)) {
				TypeWithRestriction(
#line  1980 "cs.ATG" 
out type, true, true);
			} else SynErr(208);
			Expect(21);

#line  1982 "cs.ATG" 
			pexpr = new TypeOfExpression(type); 
		} else if (la.kind == 63) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1984 "cs.ATG" 
out type);
			Expect(21);

#line  1984 "cs.ATG" 
			pexpr = new DefaultValueExpression(type); 
		} else if (la.kind == 105) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1985 "cs.ATG" 
out type);
			Expect(21);

#line  1985 "cs.ATG" 
			pexpr = new SizeOfExpression(type); 
		} else if (la.kind == 58) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1986 "cs.ATG" 
out expr);
			Expect(21);

#line  1986 "cs.ATG" 
			pexpr = new CheckedExpression(expr); 
		} else if (la.kind == 118) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1987 "cs.ATG" 
out expr);
			Expect(21);

#line  1987 "cs.ATG" 
			pexpr = new UncheckedExpression(expr); 
		} else SynErr(209);

#line  1989 "cs.ATG" 
		if (pexpr != null) {
		if (pexpr.StartLocation.IsEmpty)
			pexpr.StartLocation = startLocation;
		if (pexpr.EndLocation.IsEmpty)
			pexpr.EndLocation = t.EndLocation;
		}
		
		while (StartOf(35)) {

#line  1997 "cs.ATG" 
			startLocation = la.Location; 
			switch (la.kind) {
			case 31: {
				lexer.NextToken();

#line  1999 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); 
				break;
			}
			case 32: {
				lexer.NextToken();

#line  2001 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); 
				break;
			}
			case 47: {
				PointerMemberAccess(
#line  2003 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 15: {
				MemberAccess(
#line  2004 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 20: {
				lexer.NextToken();

#line  2008 "cs.ATG" 
				List<Expression> parameters = new List<Expression>(); 

#line  2009 "cs.ATG" 
				pexpr = new InvocationExpression(pexpr, parameters); 
				if (StartOf(25)) {
					Argument(
#line  2010 "cs.ATG" 
out expr);

#line  2010 "cs.ATG" 
					SafeAdd(pexpr, parameters, expr); 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  2011 "cs.ATG" 
out expr);

#line  2011 "cs.ATG" 
						SafeAdd(pexpr, parameters, expr); 
					}
				}
				Expect(21);
				break;
			}
			case 18: {

#line  2017 "cs.ATG" 
				List<Expression> indices = new List<Expression>();
				pexpr = new IndexerExpression(pexpr, indices);
				
				lexer.NextToken();
				Expr(
#line  2020 "cs.ATG" 
out expr);

#line  2020 "cs.ATG" 
				SafeAdd(pexpr, indices, expr); 
				while (la.kind == 14) {
					lexer.NextToken();
					Expr(
#line  2021 "cs.ATG" 
out expr);

#line  2021 "cs.ATG" 
					SafeAdd(pexpr, indices, expr); 
				}
				Expect(19);
				break;
			}
			}

#line  2024 "cs.ATG" 
			if (pexpr != null) {
			if (pexpr.StartLocation.IsEmpty)
				pexpr.StartLocation = startLocation;
			if (pexpr.EndLocation.IsEmpty)
				pexpr.EndLocation = t.EndLocation;
			}
			
		}
	}
 public override object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
 {
     if (primitiveExpression.Value == null)
     {
         this.Append("None");
     }
     else if (!(primitiveExpression.Value is bool))
     {
         this.Append(primitiveExpression.StringValue);
     }
     else
     {
         this.Append(primitiveExpression.Value.ToString());
     }
     return null;
 }
		public virtual object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
			return base.VisitPrimitiveExpression(primitiveExpression, data);
		}
Exemple #20
0
        /// <summary>
        /// Returns the existing expression plus the specified integer value.
        /// The old <paramref name="expr"/> object is not modified, but might be a subobject on the new expression
        /// (and thus its parent property is modified).
        /// </summary>
        public static Expression AddInteger(Expression expr, int value)
        {
            PrimitiveExpression pe = expr as PrimitiveExpression;

            if (pe != null && pe.Value is int)
            {
                int newVal = (int)pe.Value + value;
                return(new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)));
            }
            BinaryOperatorExpression boe = expr as BinaryOperatorExpression;

            if (boe != null && boe.Op == BinaryOperatorType.Add)
            {
                // clone boe:
                boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);

                boe.Right = AddInteger(boe.Right, value);
                if (boe.Right is PrimitiveExpression && ((PrimitiveExpression)boe.Right).Value is int)
                {
                    int newVal = (int)((PrimitiveExpression)boe.Right).Value;
                    if (newVal == 0)
                    {
                        return(boe.Left);
                    }
                    else if (newVal < 0)
                    {
                        ((PrimitiveExpression)boe.Right).Value = -newVal;
                        boe.Op = BinaryOperatorType.Subtract;
                    }
                }
                return(boe);
            }
            if (boe != null && boe.Op == BinaryOperatorType.Subtract)
            {
                pe = boe.Right as PrimitiveExpression;
                if (pe != null && pe.Value is int)
                {
                    int newVal = (int)pe.Value - value;
                    if (newVal == 0)
                    {
                        return(boe.Left);
                    }

                    // clone boe:
                    boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);

                    if (newVal < 0)
                    {
                        newVal = -newVal;
                        boe.Op = BinaryOperatorType.Add;
                    }
                    boe.Right = new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
                    return(boe);
                }
            }
            BinaryOperatorType opType = BinaryOperatorType.Add;

            if (value < 0)
            {
                value  = -value;
                opType = BinaryOperatorType.Subtract;
            }
            return(new BinaryOperatorExpression(expr, opType, new PrimitiveExpression(value, value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo))));
        }
Exemple #21
0
	void PrimaryExpr(
#line  1849 "cs.ATG" 
out Expression pexpr) {

#line  1851 "cs.ATG" 
		TypeReference type = null;
		Expression expr;
		pexpr = null;
		

#line  1856 "cs.ATG" 
		Location startLocation = la.Location; 
		if (la.kind == 113) {
			lexer.NextToken();

#line  1858 "cs.ATG" 
			pexpr = new PrimitiveExpression(true, "true");  
		} else if (la.kind == 72) {
			lexer.NextToken();

#line  1859 "cs.ATG" 
			pexpr = new PrimitiveExpression(false, "false"); 
		} else if (la.kind == 90) {
			lexer.NextToken();

#line  1860 "cs.ATG" 
			pexpr = new PrimitiveExpression(null, "null");  
		} else if (la.kind == 2) {
			lexer.NextToken();

#line  1861 "cs.ATG" 
            PrimitiveExpression primitiveExpression = new PrimitiveExpression(t.literalValue, t.val);
            primitiveExpression.LiteralFormat = t.literalFormat;
            pexpr = primitiveExpression;
            
		} else if (
#line  1862 "cs.ATG" 
StartOfQueryExpression()) {
			QueryExpression(
#line  1863 "cs.ATG" 
out pexpr);
		} else if (
#line  1864 "cs.ATG" 
IdentAndDoubleColon()) {
			Identifier();

#line  1865 "cs.ATG" 
			type = new TypeReference(t.val); 
			Expect(10);

#line  1866 "cs.ATG" 
			pexpr = new TypeReferenceExpression(type); 
			Identifier();

#line  1867 "cs.ATG" 
			if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?"); 
		} else if (StartOf(19)) {
			Identifier();

#line  1871 "cs.ATG" 
			pexpr = new IdentifierExpression(t.val); 
			if (la.kind == 48 || 
#line  1874 "cs.ATG" 
IsGenericInSimpleNameOrMemberAccess()) {
				if (la.kind == 48) {
					ShortedLambdaExpression(
#line  1873 "cs.ATG" 
(IdentifierExpression)pexpr, out pexpr);
				} else {

#line  1875 "cs.ATG" 
					List<TypeReference> typeList; 
					TypeArgumentList(
#line  1876 "cs.ATG" 
out typeList, false);

#line  1877 "cs.ATG" 
					((IdentifierExpression)pexpr).TypeArguments = typeList; 
				}
			}
		} else if (
#line  1879 "cs.ATG" 
IsLambdaExpression()) {
			LambdaExpression(
#line  1880 "cs.ATG" 
out pexpr);
		} else if (la.kind == 20) {
			lexer.NextToken();
			Expr(
#line  1883 "cs.ATG" 
out expr);
			Expect(21);

#line  1883 "cs.ATG" 
			pexpr = new ParenthesizedExpression(expr); 
		} else if (StartOf(35)) {

#line  1886 "cs.ATG" 
			string val = null; 
			switch (la.kind) {
			case 52: {
				lexer.NextToken();

#line  1887 "cs.ATG" 
				val = "System.Boolean"; 
				break;
			}
			case 54: {
				lexer.NextToken();

#line  1888 "cs.ATG" 
				val = "System.Byte"; 
				break;
			}
			case 57: {
				lexer.NextToken();

#line  1889 "cs.ATG" 
				val = "System.Char"; 
				break;
			}
			case 62: {
				lexer.NextToken();

#line  1890 "cs.ATG" 
				val = "System.Decimal"; 
				break;
			}
			case 66: {
				lexer.NextToken();

#line  1891 "cs.ATG" 
				val = "System.Double"; 
				break;
			}
			case 75: {
				lexer.NextToken();

#line  1892 "cs.ATG" 
				val = "System.Single"; 
				break;
			}
			case 82: {
				lexer.NextToken();

#line  1893 "cs.ATG" 
				val = "System.Int32"; 
				break;
			}
			case 87: {
				lexer.NextToken();

#line  1894 "cs.ATG" 
				val = "System.Int64"; 
				break;
			}
			case 91: {
				lexer.NextToken();

#line  1895 "cs.ATG" 
				val = "System.Object"; 
				break;
			}
			case 102: {
				lexer.NextToken();

#line  1896 "cs.ATG" 
				val = "System.SByte"; 
				break;
			}
			case 104: {
				lexer.NextToken();

#line  1897 "cs.ATG" 
				val = "System.Int16"; 
				break;
			}
			case 108: {
				lexer.NextToken();

#line  1898 "cs.ATG" 
				val = "System.String"; 
				break;
			}
			case 116: {
				lexer.NextToken();

#line  1899 "cs.ATG" 
				val = "System.UInt32"; 
				break;
			}
			case 117: {
				lexer.NextToken();

#line  1900 "cs.ATG" 
				val = "System.UInt64"; 
				break;
			}
			case 120: {
				lexer.NextToken();

#line  1901 "cs.ATG" 
				val = "System.UInt16"; 
				break;
			}
			case 123: {
				lexer.NextToken();

#line  1902 "cs.ATG" 
				val = "System.Void"; 
				break;
			}
			}

#line  1904 "cs.ATG" 
			pexpr = new TypeReferenceExpression(new TypeReference(val, true));
            pexpr.StartLocation = t.Location;
            pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 111) {
			lexer.NextToken();

#line  1907 "cs.ATG" 
			pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 51) {
			lexer.NextToken();

#line  1909 "cs.ATG" 
			pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; 
		} else if (la.kind == 89) {
			NewExpression(
#line  1912 "cs.ATG" 
out pexpr);
		} else if (la.kind == 115) {
			lexer.NextToken();
			Expect(20);
			if (
#line  1916 "cs.ATG" 
NotVoidPointer()) {
				Expect(123);

#line  1916 "cs.ATG" 
				type = new TypeReference("System.Void", true); 
			} else if (StartOf(10)) {
				TypeWithRestriction(
#line  1917 "cs.ATG" 
out type, true, true);
			} else SynErr(207);
			Expect(21);

#line  1919 "cs.ATG" 
			pexpr = new TypeOfExpression(type); 
		} else if (la.kind == 63) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1921 "cs.ATG" 
out type);
			Expect(21);

#line  1921 "cs.ATG" 
			pexpr = new DefaultValueExpression(type); 
		} else if (la.kind == 105) {
			lexer.NextToken();
			Expect(20);
			Type(
#line  1922 "cs.ATG" 
out type);
			Expect(21);

#line  1922 "cs.ATG" 
			pexpr = new SizeOfExpression(type); 
		} else if (la.kind == 58) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1923 "cs.ATG" 
out expr);
			Expect(21);

#line  1923 "cs.ATG" 
			pexpr = new CheckedExpression(expr); 
		} else if (la.kind == 118) {
			lexer.NextToken();
			Expect(20);
			Expr(
#line  1924 "cs.ATG" 
out expr);
			Expect(21);

#line  1924 "cs.ATG" 
			pexpr = new UncheckedExpression(expr); 
		} else if (la.kind == 64) {
			lexer.NextToken();
			AnonymousMethodExpr(
#line  1925 "cs.ATG" 
out expr);

#line  1925 "cs.ATG" 
			pexpr = expr; 
		} else SynErr(208);

#line  1927 "cs.ATG" 
		if (pexpr != null) {
		if (pexpr.StartLocation.IsEmpty)
			pexpr.StartLocation = startLocation;
		if (pexpr.EndLocation.IsEmpty)
			pexpr.EndLocation = t.EndLocation;
		}
		
		while (StartOf(36)) {

#line  1935 "cs.ATG" 
			startLocation = la.Location; 
			switch (la.kind) {
			case 31: {
				lexer.NextToken();

#line  1937 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); 
				break;
			}
			case 32: {
				lexer.NextToken();

#line  1939 "cs.ATG" 
				pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); 
				break;
			}
			case 47: {
				PointerMemberAccess(
#line  1941 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 15: {
				MemberAccess(
#line  1942 "cs.ATG" 
out pexpr, pexpr);
				break;
			}
			case 20: {
				lexer.NextToken();

#line  1946 "cs.ATG" 
				List<Expression> parameters = new List<Expression>(); 

#line  1947 "cs.ATG" 
				pexpr = new InvocationExpression(pexpr, parameters); 
				if (StartOf(26)) {
					Argument(
#line  1948 "cs.ATG" 
out expr);

#line  1948 "cs.ATG" 
					SafeAdd(pexpr, parameters, expr); 
					while (la.kind == 14) {
						lexer.NextToken();
						Argument(
#line  1949 "cs.ATG" 
out expr);

#line  1949 "cs.ATG" 
						SafeAdd(pexpr, parameters, expr); 
					}
				}
				Expect(21);
				break;
			}
			case 18: {

#line  1955 "cs.ATG" 
				List<Expression> indices = new List<Expression>();
				pexpr = new IndexerExpression(pexpr, indices);
				
				lexer.NextToken();
				Expr(
#line  1958 "cs.ATG" 
out expr);

#line  1958 "cs.ATG" 
				SafeAdd(pexpr, indices, expr); 
				while (la.kind == 14) {
					lexer.NextToken();
					Expr(
#line  1959 "cs.ATG" 
out expr);

#line  1959 "cs.ATG" 
					SafeAdd(pexpr, indices, expr); 
				}
				Expect(19);
				break;
			}
			}

#line  1962 "cs.ATG" 
			if (pexpr != null) {
			if (pexpr.StartLocation.IsEmpty)
				pexpr.StartLocation = startLocation;
			if (pexpr.EndLocation.IsEmpty)
				pexpr.EndLocation = t.EndLocation;
			}
			
		}
	}
		Expression ConvertXmlContentExpression(XmlContentExpression xmlContentExpression)
		{
			Expression newNode = null;
			switch (xmlContentExpression.Type) {
				case XmlContentType.Comment:
					newNode = new ObjectCreateExpression(new TypeReference("XComment"), Expressions(xmlContentExpression.Content));
					break;
				case XmlContentType.Text:
					newNode = new PrimitiveExpression(ConvertEntities(xmlContentExpression.Content));
					break;
				case XmlContentType.CData:
					newNode = new ObjectCreateExpression(new TypeReference("XCData"), Expressions(xmlContentExpression.Content));
					break;
				case XmlContentType.ProcessingInstruction:
					string content = xmlContentExpression.Content.Trim();
					if (content.StartsWith("xml", StringComparison.OrdinalIgnoreCase)) {
						XDeclaration decl;
						try {
							decl = XDocument.Parse("<?" + content + "?><Dummy />").Declaration;
						} catch (XmlException) {
							decl = new XDeclaration(null, null, null);
						}
						newNode = new ObjectCreateExpression(new TypeReference("XDeclaration"), Expressions(decl.Version, decl.Encoding, decl.Standalone));
					} else {
						string target = content.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault() ?? "";
						string piData = content.IndexOf(' ') > -1 ? content.Substring(content.IndexOf(' ')) : "";
						newNode = new ObjectCreateExpression(new TypeReference("XProcessingInstruction"), Expressions(target, piData));
					}
					break;
				default:
					throw new Exception("Invalid value for XmlContentType");
			}
			return newNode;
		}
			public void VisitExpression (PrimitiveExpression expression, MethodProperties meth)
			{
				return;
			}
Exemple #24
0
	void UnaryExpr(
#line  1834 "cs.ATG" 
out Expression uExpr) {

#line  1836 "cs.ATG" 
		TypeReference type = null;
		Expression expr = null;
		ArrayList expressions = new ArrayList();
		uExpr = null;
		
		while (StartOf(32) || 
#line  1859 "cs.ATG" 
IsTypeCast()) {
			if (la.kind == 4) {
				lexer.NextToken();

#line  1845 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus) { StartLocation = t.Location }); 
			} else if (la.kind == 5) {
				lexer.NextToken();

#line  1846 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus) { StartLocation = t.Location }); 
			} else if (la.kind == 24) {
				lexer.NextToken();

#line  1847 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not) { StartLocation = t.Location }); 
			} else if (la.kind == 27) {
				lexer.NextToken();

#line  1848 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot) { StartLocation = t.Location }); 
			} else if (la.kind == 6) {
				lexer.NextToken();

#line  1849 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Dereference) { StartLocation = t.Location }); 
			} else if (la.kind == 31) {
				lexer.NextToken();

#line  1850 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment) { StartLocation = t.Location }); 
			} else if (la.kind == 32) {
				lexer.NextToken();

#line  1851 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement) { StartLocation = t.Location }); 
			} else if (la.kind == 28) {
				lexer.NextToken();

#line  1852 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.AddressOf) { StartLocation = t.Location }); 
			} else if (la.kind == 146) {
				lexer.NextToken();

#line  1853 "cs.ATG" 
				expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Await) { StartLocation = t.Location }); 
			} else {
				Expect(20);
				Type(
#line  1859 "cs.ATG" 
out type);
				Expect(21);

#line  1859 "cs.ATG" 
				expressions.Add(new CastExpression(type) { StartLocation = t.Location }); 
			}
		}
		if (
#line  1864 "cs.ATG" 
LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffix()) {
			Expect(2);

#line  1867 "cs.ATG" 
			expressions.RemoveAt(expressions.Count - 1);
			if (t.literalValue is uint) {
				expr = new PrimitiveExpression(int.MinValue, int.MinValue.ToString());
			} else if (t.literalValue is ulong) {
				expr = new PrimitiveExpression(long.MinValue, long.MinValue.ToString());
			} else {
				throw new Exception("t.literalValue must be uint or ulong");
			}
			
		} else if (StartOf(33)) {
			PrimaryExpr(
#line  1876 "cs.ATG" 
out expr);
		} else SynErr(207);

#line  1878 "cs.ATG" 
		for (int i = 0; i < expressions.Count; ++i) {
		Expression nextExpression = i + 1 < expressions.Count ? (Expression)expressions[i + 1] : expr;
		if (expressions[i] is CastExpression) {
			((CastExpression)expressions[i]).Expression = nextExpression;
		} else {
			((UnaryOperatorExpression)expressions[i]).Expression = nextExpression;
		}
		}
		if (expressions.Count > 0) {
			uExpr = (Expression)expressions[0];
		} else {
			uExpr = expr;
		}
		
	}
		public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
		{
			if (primitiveExpression.Value == null) {
				return CreateResolveResult(NullReturnType.Instance);
			} else if (primitiveExpression.Value is int) {
				return new IntegerLiteralResolveResult(resolver.CallingClass, resolver.CallingMember, resolver.ProjectContent.SystemTypes.Int32);
			} else {
				return CreateResolveResult(resolver.ProjectContent.SystemTypes.CreatePrimitive(primitiveExpression.Value.GetType()));
			}
		}
Exemple #26
0
	void SimpleNonInvocationExpression(
#line  1645 "VBNET.ATG" 
out Expression pexpr) {

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

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

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

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

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

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

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

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

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

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

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

#line  1666 "VBNET.ATG" 
				pexpr = new ParenthesizedExpression(expr); 
				break;
			}
			case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
				Identifier();

#line  1668 "VBNET.ATG" 
				pexpr = new IdentifierExpression(t.val);
				pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
				
				if (
#line  1671 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
					lexer.NextToken();
					Expect(155);
					TypeArgumentList(
#line  1672 "VBNET.ATG" 
((IdentifierExpression)pexpr).TypeArguments);
					Expect(26);
				}
				break;
			}
			case 55: case 58: case 69: case 86: case 87: case 96: case 128: case 137: case 154: case 181: case 186: case 187: case 193: case 206: case 207: case 210: {

#line  1674 "VBNET.ATG" 
				string val = String.Empty; 
				if (StartOf(11)) {
					PrimitiveTypeName(
#line  1675 "VBNET.ATG" 
out val);
				} else if (la.kind == 154) {
					lexer.NextToken();

#line  1675 "VBNET.ATG" 
					val = "System.Object"; 
				} else SynErr(257);

#line  1676 "VBNET.ATG" 
				pexpr = new TypeReferenceExpression(new TypeReference(val, true)); 
				break;
			}
			case 139: {
				lexer.NextToken();

#line  1677 "VBNET.ATG" 
				pexpr = new ThisReferenceExpression(); 
				break;
			}
			case 144: case 145: {

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

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

#line  1680 "VBNET.ATG" 
					retExpr = new ClassReferenceExpression(); 
				} else SynErr(258);
				Expect(16);
				IdentifierOrKeyword(
#line  1682 "VBNET.ATG" 
out name);

#line  1682 "VBNET.ATG" 
				pexpr = new MemberReferenceExpression(retExpr, name); 
				break;
			}
			case 117: {
				lexer.NextToken();
				Expect(16);
				Identifier();

#line  1684 "VBNET.ATG" 
				type = new TypeReference(t.val ?? ""); 

#line  1686 "VBNET.ATG" 
				type.IsGlobal = true; 

#line  1687 "VBNET.ATG" 
				pexpr = new TypeReferenceExpression(type); 
				break;
			}
			case 148: {
				ObjectCreateExpression(
#line  1688 "VBNET.ATG" 
out expr);

#line  1688 "VBNET.ATG" 
				pexpr = expr; 
				break;
			}
			case 81: case 93: case 204: {

#line  1690 "VBNET.ATG" 
				CastType castType = CastType.Cast; 
				if (la.kind == 93) {
					lexer.NextToken();
				} else if (la.kind == 81) {
					lexer.NextToken();

#line  1692 "VBNET.ATG" 
					castType = CastType.Conversion; 
				} else if (la.kind == 204) {
					lexer.NextToken();

#line  1693 "VBNET.ATG" 
					castType = CastType.TryCast; 
				} else SynErr(259);
				Expect(25);
				Expr(
#line  1695 "VBNET.ATG" 
out expr);
				Expect(12);
				TypeName(
#line  1695 "VBNET.ATG" 
out type);
				Expect(26);

#line  1696 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, castType); 
				break;
			}
			case 63: case 64: case 65: case 66: case 67: case 68: case 70: case 72: case 73: case 77: case 78: case 79: case 80: case 82: case 83: case 84: {
				CastTarget(
#line  1697 "VBNET.ATG" 
out type);
				Expect(25);
				Expr(
#line  1697 "VBNET.ATG" 
out expr);
				Expect(26);

#line  1697 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); 
				break;
			}
			case 44: {
				lexer.NextToken();
				Expr(
#line  1698 "VBNET.ATG" 
out expr);

#line  1698 "VBNET.ATG" 
				pexpr = new AddressOfExpression(expr); 
				break;
			}
			case 116: {
				lexer.NextToken();
				Expect(25);
				GetTypeTypeName(
#line  1699 "VBNET.ATG" 
out type);
				Expect(26);

#line  1699 "VBNET.ATG" 
				pexpr = new TypeOfExpression(type); 
				break;
			}
			case 205: {
				lexer.NextToken();
				SimpleExpr(
#line  1700 "VBNET.ATG" 
out expr);
				Expect(131);
				TypeName(
#line  1700 "VBNET.ATG" 
out type);

#line  1700 "VBNET.ATG" 
				pexpr = new TypeOfIsExpression(expr, type); 
				break;
			}
			case 122: {
				ConditionalExpression(
#line  1701 "VBNET.ATG" 
out pexpr);
				break;
			}
			}
		} else if (la.kind == 16) {
			lexer.NextToken();
			IdentifierOrKeyword(
#line  1705 "VBNET.ATG" 
out name);

#line  1705 "VBNET.ATG" 
			pexpr = new MemberReferenceExpression(null, name);
		} else SynErr(260);
	}
 public object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
 {
     this.builder.AppendFormat ("{0}", primitiveExpression.StringValue);
     return data;
 }
		public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
			throw new global::System.NotImplementedException("PrimitiveExpression");
		}
		public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
		{
			return CreateValue(primitiveExpression.Value);
		}
		public sealed override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
			this.BeginVisit(primitiveExpression);
			object result = this.TrackedVisitPrimitiveExpression(primitiveExpression, data);
			this.EndVisit(primitiveExpression);
			return result;
		}
		public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
			Debug.Assert((primitiveExpression != null));
			return null;
		}
Exemple #32
0
	void SimpleNonInvocationExpression(
//#line  1723 "VBNET.ATG" 
out Expression pexpr) {

//#line  1725 "VBNET.ATG" 
		Expression expr;
		CollectionInitializerExpression cie;
		TypeReference type = null;
		string name = String.Empty;
		Location startLocation = la.Location;
		pexpr = null;
		
		if (StartOf(34)) {
			switch (la.kind) {
			case 3: {
				lexer.NextToken();

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

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

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

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

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

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

//#line  1741 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };  
				break;
			}
			case 217: {
				lexer.NextToken();

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

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

//#line  1745 "VBNET.ATG" 
				pexpr = new PrimitiveExpression(null, "null");  
				break;
			}
			case 37: {
				lexer.NextToken();
				Expr(
//#line  1746 "VBNET.ATG" 
out expr);
				Expect(38);

//#line  1746 "VBNET.ATG" 
				pexpr = new ParenthesizedExpression(expr); 
				break;
			}
			case 2: case 58: case 62: case 64: case 65: case 66: case 67: case 70: case 87: case 98: case 104: case 107: case 116: case 121: case 126: case 133: case 139: case 143: case 146: case 147: case 170: case 176: case 178: case 184: case 203: case 212: case 213: case 223: case 224: case 230: {
				Identifier();

//#line  1748 "VBNET.ATG" 
				pexpr = new IdentifierExpression(t.val);
				pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
				
				if (
//#line  1751 "VBNET.ATG" 
la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
					lexer.NextToken();
					Expect(169);
					TypeArgumentList(
//#line  1752 "VBNET.ATG" 
((IdentifierExpression)pexpr).TypeArguments);
					Expect(38);
				}
				break;
			}
			case 68: case 71: case 82: case 99: case 100: case 109: case 141: case 151: case 168: case 196: case 201: case 202: case 208: case 221: case 222: case 225: {

//#line  1754 "VBNET.ATG" 
				string val = String.Empty; 
				if (StartOf(12)) {
					PrimitiveTypeName(
//#line  1755 "VBNET.ATG" 
out val);
				} else if (la.kind == 168) {
					lexer.NextToken();

//#line  1755 "VBNET.ATG" 
					val = "System.Object"; 
				} else SynErr(280);

//#line  1756 "VBNET.ATG" 
				pexpr = new TypeReferenceExpression(new TypeReference(val, true)); 
				break;
			}
			case 153: {
				lexer.NextToken();

//#line  1757 "VBNET.ATG" 
				pexpr = new ThisReferenceExpression(); 
				break;
			}
			case 158: case 159: {

//#line  1758 "VBNET.ATG" 
				Expression retExpr = null; 
				if (la.kind == 158) {
					lexer.NextToken();

//#line  1759 "VBNET.ATG" 
					retExpr = new BaseReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; 
				} else if (la.kind == 159) {
					lexer.NextToken();

//#line  1760 "VBNET.ATG" 
					retExpr = new ClassReferenceExpression() { StartLocation = t.Location, EndLocation = t.EndLocation }; 
				} else SynErr(281);
				Expect(26);
				IdentifierOrKeyword(
//#line  1762 "VBNET.ATG" 
out name);

//#line  1762 "VBNET.ATG" 
				pexpr = new MemberReferenceExpression(retExpr, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				break;
			}
			case 130: {
				lexer.NextToken();
				Expect(26);
				Identifier();

//#line  1764 "VBNET.ATG" 
				type = new TypeReference(t.val ?? ""); 

//#line  1766 "VBNET.ATG" 
				type.IsGlobal = true; 

//#line  1767 "VBNET.ATG" 
				pexpr = new TypeReferenceExpression(type); 
				break;
			}
			case 162: {
				ObjectCreateExpression(
//#line  1768 "VBNET.ATG" 
out expr);

//#line  1768 "VBNET.ATG" 
				pexpr = expr; 
				break;
			}
			case 35: {
				CollectionInitializer(
//#line  1769 "VBNET.ATG" 
out cie);

//#line  1769 "VBNET.ATG" 
				pexpr = cie; 
				break;
			}
			case 94: case 106: case 219: {

//#line  1771 "VBNET.ATG" 
				CastType castType = CastType.Cast; 
				if (la.kind == 106) {
					lexer.NextToken();
				} else if (la.kind == 94) {
					lexer.NextToken();

//#line  1773 "VBNET.ATG" 
					castType = CastType.Conversion; 
				} else if (la.kind == 219) {
					lexer.NextToken();

//#line  1774 "VBNET.ATG" 
					castType = CastType.TryCast; 
				} else SynErr(282);
				Expect(37);
				Expr(
//#line  1776 "VBNET.ATG" 
out expr);
				Expect(22);
				TypeName(
//#line  1776 "VBNET.ATG" 
out type);
				Expect(38);

//#line  1777 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, castType); 
				break;
			}
			case 76: case 77: case 78: case 79: case 80: case 81: case 83: case 85: case 86: case 90: case 91: case 92: case 93: case 95: case 96: case 97: {
				CastTarget(
//#line  1778 "VBNET.ATG" 
out type);
				Expect(37);
				Expr(
//#line  1778 "VBNET.ATG" 
out expr);
				Expect(38);

//#line  1778 "VBNET.ATG" 
				pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); 
				break;
			}
			case 57: {
				lexer.NextToken();
				Expr(
//#line  1779 "VBNET.ATG" 
out expr);

//#line  1779 "VBNET.ATG" 
				pexpr = new AddressOfExpression(expr); 
				break;
			}
			case 129: {
				lexer.NextToken();
				Expect(37);
				GetTypeTypeName(
//#line  1780 "VBNET.ATG" 
out type);
				Expect(38);

//#line  1780 "VBNET.ATG" 
				pexpr = new TypeOfExpression(type); 
				break;
			}
			case 220: {
				lexer.NextToken();
				SimpleExpr(
//#line  1781 "VBNET.ATG" 
out expr);
				Expect(144);
				TypeName(
//#line  1781 "VBNET.ATG" 
out type);

//#line  1781 "VBNET.ATG" 
				pexpr = new TypeOfIsExpression(expr, type); 
				break;
			}
			case 135: {
				ConditionalExpression(
//#line  1782 "VBNET.ATG" 
out pexpr);
				break;
			}
			case 10: case 16: case 17: case 18: case 19: {
				XmlLiteralExpression(
//#line  1783 "VBNET.ATG" 
out pexpr);
				break;
			}
			}
		} else if (StartOf(35)) {
			if (la.kind == 26) {
				lexer.NextToken();
				if (la.kind == 10) {
					lexer.NextToken();
					IdentifierOrKeyword(
//#line  1789 "VBNET.ATG" 
out name);
					Expect(11);

//#line  1790 "VBNET.ATG" 
					pexpr = new XmlMemberAccessExpression(null, XmlAxisType.Element, name, true) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				} else if (StartOf(33)) {
					IdentifierOrKeyword(
//#line  1791 "VBNET.ATG" 
out name);

//#line  1792 "VBNET.ATG" 
					pexpr = new MemberReferenceExpression(null, name) { StartLocation = startLocation, EndLocation = t.EndLocation }; 
				} else SynErr(283);
			} else if (la.kind == 29) {
				lexer.NextToken();
				IdentifierOrKeyword(
//#line  1794 "VBNET.ATG" 
out name);

//#line  1794 "VBNET.ATG" 
				pexpr = new BinaryOperatorExpression(null, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name) { StartLocation = t.Location, EndLocation = t.EndLocation }); 
			} else {

//#line  1795 "VBNET.ATG" 
				XmlAxisType axisType = XmlAxisType.Element; bool isXmlIdentifier = false; 
				if (la.kind == 27) {
					lexer.NextToken();

//#line  1796 "VBNET.ATG" 
					axisType = XmlAxisType.Descendents; 
				} else if (la.kind == 28) {
					lexer.NextToken();

//#line  1796 "VBNET.ATG" 
					axisType = XmlAxisType.Attribute; 
				} else SynErr(284);
				if (la.kind == 10) {
					lexer.NextToken();

//#line  1797 "VBNET.ATG" 
					isXmlIdentifier = true; 
				}
				IdentifierOrKeyword(
//#line  1797 "VBNET.ATG" 
out name);
				if (la.kind == 11) {
					lexer.NextToken();
				}

//#line  1798 "VBNET.ATG" 
				pexpr = new XmlMemberAccessExpression(null, axisType, name, isXmlIdentifier); 
			}
		} else SynErr(285);

//#line  1803 "VBNET.ATG" 
		if (pexpr != null) {
		pexpr.StartLocation = startLocation;
		pexpr.EndLocation = t.EndLocation;
		}
		
	}
Exemple #33
0
 public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
     throw CreateException(primitiveExpression);
 }