public static @bind.as("tm") class Tm extends Glyph { public void toHTML(HTML h) { h.appendLiterally("&;"); } }
public static @bind.as("euro") class Euro extends Glyph { public void toHTML(HTML h) { h.appendLiterally("€"); } }
+ public static @bind.as("#") Text comment() { return new Chars(""); }
public static class Entity extends Text implements ToHTML {
public int code;
public String name;
public static class Link extends Text {
public Text[] t;
public Url u;
- public @bind.as("link") Link(@bind.arg Text[] t, @bind.arg Url u) { this.t = t; this.u = u; }
- public Link(String s, Url u) { this(new Text[] { new Chars(s) }, u); }
+ public Input.Region region;
+ public @bind.as("link") Link(Input.Region region, @bind.arg Text[] t, @bind.arg Url u) { this.region = region; this.t = t; this.u = u; }
+ public Link(String s, Url u) { this(null,new Text[] { new Chars(s) }, u); }
public void toHTML(HTML h) {
h.tag("a",
new Object[] { "href", u==null ? "" : u.toString() },
- new P(t));
+ new P(/*t*/region+""));
}
}
public static void main(String[] s) throws Exception {
try {
- Tree<String> res = new CharParser(MetaGrammar.make()).parse(new FileInputStream(s[0])).expand1();
+ Tree<String> res = new CharParser(MetaGrammar.newInstance()).parse(new FileInputStream(s[0])).expand1();
- Union tibgram = MetaGrammar.make(res, "s", new AnnotationGrammarBindingResolver(TD.class));
+ AnnotationGrammarBindings resolver = new AnnotationGrammarBindings(TD.class);
+ resolver.add(MetaGrammarBindings.class, "meta");
+ Union tibgram = Grammar.create(res, "s", resolver);
System.err.println("parsing " + s[1]);
Tree t = new CharParser(tibgram).parse(new Tib(new FileInputStream(s[1]))).expand1();