Exemplo 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; 
	}
Exemplo 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;
		
	}
		Expression ConvertXmlExpression(XmlExpression expr)
		{
			if (expr is XmlElementExpression)
				return ConvertXmlElementExpression(expr as XmlElementExpression);
			else if (expr is XmlContentExpression)
				return ConvertXmlContentExpression(expr as XmlContentExpression);
			else if (expr is XmlEmbeddedExpression)
				return (expr as XmlEmbeddedExpression).InlineVBExpression;
			
			throw new Exception();
		}