Search in sources :

Example 1 with XMLParser

use of us.parr.bookish.parse.XMLParser in project bookish by parrt.

the class Translator method parseXMLAttrs.

public static Map<String, String> parseXMLAttrs(String attrs) {
    XMLLexer lexer = new XMLLexer(CharStreams.fromString(attrs));
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    XMLParser parser = new XMLParser(tokens);
    XMLParser.AttrsContext attrsTree = parser.attrs();
    Map<String, String> attrMap = attrsTree.attrMap;
    return attrMap;
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) XMLLexer(us.parr.bookish.parse.XMLLexer) XMLParser(us.parr.bookish.parse.XMLParser)

Aggregations

CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 XMLLexer (us.parr.bookish.parse.XMLLexer)1 XMLParser (us.parr.bookish.parse.XMLParser)1