/** * Gets the name of the target. */ public String getName() { return target.getName(); }
DDefine getOrAdd( String name ) { if(patterns.containsKey(name)) { return get(name); } else { DDefine d = new DDefine(name); patterns.put(name,d); return d; } }
public boolean isNullable() { return target.isNullable(); }
public Void onGrammar(DGrammarPattern p) { start("grammar"); ns(null, WellKnownNamespaces.RELAX_NG); on(p.getAnnotation()); start("start"); on(p.getStart()); end(); for (DDefine d : p) { start("define"); attr("name", d.getName()); on(d.getAnnotation()); unwrapGroup(d.getPattern()); end(); } end(); return null; }
public TypeUse onRef(DRefPattern p) { // TODO: check for enums return p.getTarget().getPattern().accept(this); }
DPattern p = def.getPattern(); if (p instanceof DChoicePattern) { DChoicePattern cp = (DChoicePattern) p; new CClassInfoParent.Package(pkg), def.getName(), base, new ArrayList<CEnumConstant>(members),
public void define(String name, Combine combine, ParsedPattern pattern, Location loc, Annotations anno) throws BuildException { if(name==START) grammar.start = (DPattern)pattern; else { // TODO: handle combine DDefine d = grammar.getOrAdd(name); d.setPattern( (DPattern) pattern ); if(anno!=null) d.annotation = ((Annotation)anno).getResult(); } }
public Void onGrammar(DGrammarPattern p) { start("grammar"); ns(null, WellKnownNamespaces.RELAX_NG); on(p.getAnnotation()); start("start"); on(p.getStart()); end(); for (DDefine d : p) { start("define"); attr("name", d.getName()); on(d.getAnnotation()); unwrapGroup(d.getPattern()); end(); } end(); return null; }
public TypeUse onRef(DRefPattern p) { // TODO: check for enums return p.getTarget().getPattern().accept(this); }
DPattern p = def.getPattern(); if (p instanceof DChoicePattern) { DChoicePattern cp = (DChoicePattern) p; new CClassInfoParent.Package(pkg), def.getName(), base, new ArrayList<CEnumConstant>(members),
public void define(String name, Combine combine, ParsedPattern pattern, Location loc, Annotations anno) throws BuildException { if(name==START) { grammar.start = (DPattern)pattern; } else { // TODO: handle combine DDefine d = grammar.getOrAdd(name); d.setPattern( (DPattern) pattern ); if (anno!=null) { d.annotation = ((Annotation)anno).getResult(); } } }
public Void onGrammar(DGrammarPattern p) { for( DDefine def : p ) { defs.add(def); def.getPattern().accept(this); } return p.getStart().accept(this); }
/** * Gets the name of the target. */ public String getName() { return target.getName(); }
DDefine getOrAdd( String name ) { if(patterns.containsKey(name)) { return get(name); } else { DDefine d = new DDefine(name); patterns.put(name,d); return d; } }
public boolean isNullable() { return target.isNullable(); }
public Void onRef(DRefPattern p) { return p.getTarget().getPattern().accept(this); }
public Void onRef(DRefPattern p) { return p.getTarget().getPattern().accept(this); }
public Void onGrammar(DGrammarPattern p) { for( DDefine def : p ) { defs.add(def); def.getPattern().accept(this); } return p.getStart().accept(this); }
private void promoteElementDefsToClasses() { // look for elements among named patterns for( DDefine def : defs ) { DPattern p = def.getPattern(); if (p instanceof DElementPattern) { DElementPattern ep = (DElementPattern) p; mapToClass(ep); } } // also look for root elements grammar.accept(new DPatternWalker() { public Void onRef(DRefPattern p) { return null; // stop recursion } public Void onElement(DElementPattern p) { mapToClass(p); return null; } }); }
private void promoteElementDefsToClasses() { // look for elements among named patterns for( DDefine def : defs ) { DPattern p = def.getPattern(); if (p instanceof DElementPattern) { DElementPattern ep = (DElementPattern) p; mapToClass(ep); } } // also look for root elements grammar.accept(new DPatternWalker() { public Void onRef(DRefPattern p) { return null; // stop recursion } public Void onElement(DElementPattern p) { mapToClass(p); return null; } }); }