Esempio n. 1
0
	void XmlElement(
//#line  1865 "VBNET.ATG" 
out XmlExpression expr) {

//#line  1866 "VBNET.ATG" 
		XmlElementExpression el = new XmlElementExpression(); 
		Expect(10);

//#line  1869 "VBNET.ATG" 
		el.StartLocation = t.Location; 
		if (la.kind == 12) {
			lexer.NextToken();

//#line  1870 "VBNET.ATG" 
			Expression innerExpression; 
			Expr(
//#line  1870 "VBNET.ATG" 
out innerExpression);
			Expect(13);

//#line  1871 "VBNET.ATG" 
			el.NameExpression = new XmlEmbeddedExpression() { InlineVBExpression = innerExpression }; 
		} else if (StartOf(4)) {
			Identifier();

//#line  1872 "VBNET.ATG" 
			el.XmlName = t.val; 
		} else SynErr(290);
		while (StartOf(37)) {
			XmlAttribute(
//#line  1872 "VBNET.ATG" 
el.Attributes);
		}
		if (la.kind == 14) {
			lexer.NextToken();

//#line  1873 "VBNET.ATG" 
			el.EndLocation = t.EndLocation; 
		} else if (la.kind == 11) {
			lexer.NextToken();
			while (StartOf(38)) {

//#line  1873 "VBNET.ATG" 
				XmlExpression child; 
				XmlNestedContent(
//#line  1873 "VBNET.ATG" 
out child);

//#line  1873 "VBNET.ATG" 
				el.Children.Add(child); 
			}
			Expect(15);
			while (StartOf(39)) {
				lexer.NextToken();
			}
			Expect(11);

//#line  1873 "VBNET.ATG" 
			el.EndLocation = t.EndLocation; 
		} else SynErr(291);

//#line  1875 "VBNET.ATG" 
		expr = el; 
	}
Esempio n. 2
0
		public override object VisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data)
		{
			return CreateResolveResult(new TypeReference("System.Xml.Linq.XElement"));
		}
Esempio n. 3
0
		public virtual object VisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data) {
			throw new global::System.NotImplementedException("XmlElementExpression");
		}
		public virtual object TrackedVisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data) {
			return base.VisitXmlElementExpression(xmlElementExpression, data);
		}
		public sealed override object VisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data) {
			this.BeginVisit(xmlElementExpression);
			object result = this.TrackedVisitXmlElementExpression(xmlElementExpression, data);
			this.EndVisit(xmlElementExpression);
			return result;
		}
		ObjectCreateExpression ConvertXmlElementExpression(XmlElementExpression xmlElementExpression)
		{
			var newNode = new ObjectCreateExpression(new TypeReference("XElement"), xmlElementExpression.NameIsExpression ? new List<Expression> { xmlElementExpression.NameExpression } : Expressions(xmlElementExpression.XmlName));
			
			foreach (XmlExpression attr in xmlElementExpression.Attributes) {
				if (attr is XmlAttributeExpression) {
					var a = attr as XmlAttributeExpression;
					newNode.Parameters.Add(new ObjectCreateExpression(new TypeReference("XAttribute"), new List<Expression> {
					                                                  	new PrimitiveExpression(a.Name),
					                                                  	a.IsLiteralValue ? new PrimitiveExpression(ConvertEntities(a.LiteralValue)) : a.ExpressionValue
					                                                  }));
				} else if (attr is XmlEmbeddedExpression) {
					newNode.Parameters.Add((attr as XmlEmbeddedExpression).InlineVBExpression);
				}
			}
			
			foreach (XmlExpression expr in xmlElementExpression.Children) {
				XmlContentExpression c = expr as XmlContentExpression;
				// skip whitespace text
				if (!(expr is XmlContentExpression && c.Type == XmlContentType.Text && string.IsNullOrWhiteSpace(c.Content)))
					newNode.Parameters.Add(ConvertXmlExpression(expr));
			}
			
			return newNode;
		}
		public override object VisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data)
		{
			ObjectCreateExpression newNode = ConvertXmlElementExpression(xmlElementExpression);
			
			ReplaceCurrentNode(newNode);
			
			return base.VisitObjectCreateExpression(newNode, data);
		}
Esempio n. 8
0
		public object VisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data)
		{
			throw new NotImplementedException();
		}
		public virtual object VisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data) {
			Debug.Assert((xmlElementExpression != null));
			Debug.Assert((xmlElementExpression.Content != null));
			Debug.Assert((xmlElementExpression.NameExpression != null));
			Debug.Assert((xmlElementExpression.Attributes != null));
			nodeStack.Push(xmlElementExpression.Content);
			xmlElementExpression.Content.AcceptVisitor(this, data);
			xmlElementExpression.Content = ((Expression)(nodeStack.Pop()));
			nodeStack.Push(xmlElementExpression.NameExpression);
			xmlElementExpression.NameExpression.AcceptVisitor(this, data);
			xmlElementExpression.NameExpression = ((Expression)(nodeStack.Pop()));
			for (int i = 0; i < xmlElementExpression.Attributes.Count; i++) {
				XmlExpression o = xmlElementExpression.Attributes[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = (XmlExpression)nodeStack.Pop();
				if (o == null)
					xmlElementExpression.Attributes.RemoveAt(i--);
				else
					xmlElementExpression.Attributes[i] = o;
			}
			for (int i = 0; i < xmlElementExpression.Children.Count; i++) {
				INode o = xmlElementExpression.Children[i];
				Debug.Assert(o != null);
				nodeStack.Push(o);
				o.AcceptVisitor(this, data);
				o = nodeStack.Pop();
				if (o == null)
					xmlElementExpression.Children.RemoveAt(i--);
				else
					xmlElementExpression.Children[i] = o;
			}
			return null;
		}
		public virtual object VisitXmlElementExpression(XmlElementExpression xmlElementExpression, object data) {
			Debug.Assert((xmlElementExpression != null));
			Debug.Assert((xmlElementExpression.Content != null));
			Debug.Assert((xmlElementExpression.NameExpression != null));
			Debug.Assert((xmlElementExpression.Attributes != null));
			xmlElementExpression.Content.AcceptVisitor(this, data);
			xmlElementExpression.NameExpression.AcceptVisitor(this, data);
			foreach (XmlExpression o in xmlElementExpression.Attributes) {
				Debug.Assert(o != null);
				o.AcceptVisitor(this, data);
			}
			return xmlElementExpression.AcceptChildren(this, data);
		}