use of org.mozilla.javascript.ast.XmlLiteral in project HL4A by HL4A.
the class Parser method xmlInitializer.
private AstNode xmlInitializer() throws IOException {
if (currentToken != Token.LT)
codeBug();
int pos = ts.tokenBeg, tt = ts.getFirstXMLToken();
if (tt != Token.XML && tt != Token.XMLEND) {
reportError("msg.syntax");
return makeErrorNode();
}
XmlLiteral pn = new XmlLiteral(pos);
pn.setLineno(ts.lineno);
for (; ; tt = ts.getNextXMLToken()) {
switch(tt) {
case Token.XML:
pn.addFragment(new XmlString(ts.tokenBeg, ts.getString()));
mustMatchToken(Token.LC, "msg.syntax");
int beg = ts.tokenBeg;
AstNode expr = (peekToken() == Token.RC) ? new EmptyExpression(beg, ts.tokenEnd - beg) : expr();
mustMatchToken(Token.RC, "msg.syntax");
XmlExpression xexpr = new XmlExpression(beg, expr);
xexpr.setIsXmlAttribute(ts.isXMLAttribute());
xexpr.setLength(ts.tokenEnd - beg);
pn.addFragment(xexpr);
break;
case Token.XMLEND:
pn.addFragment(new XmlString(ts.tokenBeg, ts.getString()));
return pn;
default:
reportError("msg.syntax");
return makeErrorNode();
}
}
}
Aggregations