Esempio n. 1
0
	void XmlContentExpression(
//#line  1830 "VBNET.ATG" 
List<XmlExpression> exprs) {

//#line  1831 "VBNET.ATG" 
		XmlContentExpression expr = null; 
		if (la.kind == 16) {
			lexer.NextToken();

//#line  1833 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.Text); 
		} else if (la.kind == 18) {
			lexer.NextToken();

//#line  1834 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.CData); 
		} else if (la.kind == 17) {
			lexer.NextToken();

//#line  1835 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.Comment); 
		} else if (la.kind == 19) {
			lexer.NextToken();

//#line  1836 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.ProcessingInstruction); 
		} else SynErr(289);

//#line  1839 "VBNET.ATG" 
		expr.StartLocation = t.Location;
		expr.EndLocation = t.EndLocation;
		exprs.Add(expr);
		
	}
Esempio n. 2
0
	void XmlNestedContent(
//#line  1845 "VBNET.ATG" 
out XmlExpression expr) {

//#line  1846 "VBNET.ATG" 
		XmlExpression tmpExpr = null; Location start = la.Location; 
		switch (la.kind) {
		case 16: {
			lexer.NextToken();

//#line  1849 "VBNET.ATG" 
			tmpExpr = new XmlContentExpression(t.val, XmlContentType.Text); 
			break;
		}
		case 18: {
			lexer.NextToken();

//#line  1850 "VBNET.ATG" 
			tmpExpr = new XmlContentExpression(t.val, XmlContentType.CData); 
			break;
		}
		case 17: {
			lexer.NextToken();

//#line  1851 "VBNET.ATG" 
			tmpExpr = new XmlContentExpression(t.val, XmlContentType.Comment); 
			break;
		}
		case 19: {
			lexer.NextToken();

//#line  1852 "VBNET.ATG" 
			tmpExpr = new XmlContentExpression(t.val, XmlContentType.ProcessingInstruction); 
			break;
		}
		case 12: {
			lexer.NextToken();

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

//#line  1853 "VBNET.ATG" 
			tmpExpr = new XmlEmbeddedExpression() { InlineVBExpression = innerExpression }; 
			break;
		}
		case 10: {
			XmlElement(
//#line  1854 "VBNET.ATG" 
out tmpExpr);
			break;
		}
		default: SynErr(292); break;
		}

//#line  1857 "VBNET.ATG" 
		if (tmpExpr.StartLocation.IsEmpty)
		tmpExpr.StartLocation = start;
		if (tmpExpr.EndLocation.IsEmpty)
			tmpExpr.EndLocation = t.EndLocation;
		expr = tmpExpr;
		
	}
Esempio n. 3
0
	void XmlContentExpression(
#line  1837 "VBNET.ATG" 
List<XmlExpression> exprs) {

#line  1838 "VBNET.ATG" 
		XmlContentExpression expr = null; 
		if (la.kind == 16) {
			lexer.NextToken();

#line  1840 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.Text); 
		} else if (la.kind == 18) {
			lexer.NextToken();

#line  1841 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.CData); 
		} else if (la.kind == 17) {
			lexer.NextToken();

#line  1842 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.Comment); 
		} else if (la.kind == 19) {
			lexer.NextToken();

#line  1843 "VBNET.ATG" 
			expr = new XmlContentExpression(t.val, XmlContentType.ProcessingInstruction); 
		} else SynErr(293);

#line  1846 "VBNET.ATG" 
		expr.StartLocation = t.Location;
		expr.EndLocation = t.EndLocation;
		exprs.Add(expr);
		
	}
Esempio n. 4
0
		public virtual object VisitXmlContentExpression(XmlContentExpression xmlContentExpression, object data) {
			throw new global::System.NotImplementedException("XmlContentExpression");
		}
		public sealed override object VisitXmlContentExpression(XmlContentExpression xmlContentExpression, object data) {
			this.BeginVisit(xmlContentExpression);
			object result = this.TrackedVisitXmlContentExpression(xmlContentExpression, data);
			this.EndVisit(xmlContentExpression);
			return result;
		}
Esempio n. 6
0
		public override object VisitXmlContentExpression(XmlContentExpression xmlContentExpression, object data)
		{
			switch (xmlContentExpression.Type) {
				case XmlContentType.Comment:
					return CreateResolveResult(new TypeReference("System.Xml.Linq.XComment"));
				case XmlContentType.Text:
					return CreateResolveResult(new TypeReference("System.Xml.Linq.XText"));
				case XmlContentType.CData:
					return CreateResolveResult(new TypeReference("System.Xml.Linq.XCData"));
				case XmlContentType.ProcessingInstruction:
					if (xmlContentExpression.Content.StartsWith("xml ", StringComparison.OrdinalIgnoreCase))
						return CreateResolveResult(new TypeReference("System.Xml.Linq.XDocumentType"));
					return CreateResolveResult(new TypeReference("System.Xml.Linq.XProcessingInstruction"));
				default:
					throw new Exception("Invalid value for XmlContentType");
			}
		}
		public virtual object TrackedVisitXmlContentExpression(XmlContentExpression xmlContentExpression, object data) {
			return base.VisitXmlContentExpression(xmlContentExpression, data);
		}
		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 override object VisitXmlContentExpression(XmlContentExpression xmlContentExpression, object data)
		{

			Expression newNode = ConvertXmlContentExpression(xmlContentExpression);
			
			if (newNode == null)
				return base.VisitXmlContentExpression(xmlContentExpression, data);
			
			ReplaceCurrentNode(newNode);
			
			if (newNode is ObjectCreateExpression)
				return base.VisitObjectCreateExpression((ObjectCreateExpression)newNode, data);
			else if (newNode is PrimitiveExpression)
				return base.VisitPrimitiveExpression((PrimitiveExpression)newNode , data);
			
			return null;
		}
Esempio n. 10
0
		public object VisitXmlContentExpression(XmlContentExpression xmlContentExpression, object data)
		{
			throw new NotImplementedException();
		}
		public virtual object VisitXmlContentExpression(XmlContentExpression xmlContentExpression, object data) {
			Debug.Assert((xmlContentExpression != null));
			return null;
		}