}
}
- public static @bind.as("#import") GrammarNode poundimport(String fileName) {
- System.err.println("#import " + fileName);
+ public static @bind.as("#import") GrammarNode poundimport(String fileName, String as) {
+ if (as==null) as = "";
+ System.err.println("#import " + fileName + " as " + as);
try {
Tree t = new CharParser(MetaGrammar.make()).parse(new FileInputStream(fileName)).expand1();
Tree.TreeFunctor<Object,Object> red = (Tree.TreeFunctor<Object,Object>)t.head();
- return (MetaGrammarBindings.GrammarNode)red.invoke(t);
+ String oldprefix = prefix;
+ prefix = as;
+ GrammarNode gn = (GrammarNode)red.invoke(t);
+ prefix = oldprefix;
+ return gn;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);