public static AttributeDict parse(ActionAST action, String s, char separator, Grammar g) { AttributeDict dict = new AttributeDict(); List<Pair<String, Integer>> decls = splitDecls(s, separator); for (Pair<String, Integer> decl : decls) { if (decl.a.trim().length() > 0) { Attribute a = parseAttributeDef(action, decl, g); dict.add(a); } } return dict; }
/** $x Attribute: rule arguments, return values, predefined rule prop. */ @Override public Attribute resolveToAttribute(String x, ActionAST node) { if ( args!=null ) { Attribute a = args.get(x); if ( a!=null ) return a; } if ( retvals!=null ) { Attribute a = retvals.get(x); if ( a!=null ) return a; } if ( locals!=null ) { Attribute a = locals.get(x); if ( a!=null ) return a; } AttributeDict properties = getPredefinedScope(LabelType.RULE_LABEL); return properties.get(x); }
@Override public String toString() { return getName()+":"+attributes; } }
protected void checkLocalConflictingDeclarations(Rule r, AttributeDict attributes, AttributeDict referenceAttributes, ErrorType errorType) { if (attributes == null || referenceAttributes == null) { return; } Set<String> conflictingKeys = attributes.intersection(referenceAttributes); for (String key : conflictingKeys) { errMgr.grammarError( errorType, g.fileName, attributes.get(key).token != null ? attributes.get(key).token : ((GrammarAST) r.ast.getChild(0)).token, key, r.name); } }
/** Return the set of keys that collide from * {@code this} and {@code other}. */ public Set<String> intersection(AttributeDict other) { if ( other==null || other.size()==0 || size()==0 ) { return Collections.emptySet(); } Set<String> result = new HashSet<String>(attributes.keySet()); result.retainAll(other.attributes.keySet()); return result; }
protected void checkLocalConflictingDeclarations(Rule r, AttributeDict attributes, AttributeDict referenceAttributes, ErrorType errorType) { if (attributes == null || referenceAttributes == null) { return; } Set<String> conflictingKeys = attributes.intersection(referenceAttributes); for (String key : conflictingKeys) { errMgr.grammarError( errorType, g.fileName, attributes.get(key).token != null ? attributes.get(key).token : ((GrammarAST)r.ast.getChild(0)).token, key, r.name); } }
/** Return the set of keys that collide from * {@code this} and {@code other}. */ public Set<String> intersection(AttributeDict other) { if ( other==null || other.size()==0 || size()==0 ) { return Collections.emptySet(); } Set<String> result = new HashSet<String>(attributes.keySet()); result.retainAll(other.attributes.keySet()); return result; }
/** $x Attribute: rule arguments, return values, predefined rule prop. */ @Override public Attribute resolveToAttribute(String x, ActionAST node) { if ( args!=null ) { Attribute a = args.get(x); if ( a!=null ) return a; } if ( retvals!=null ) { Attribute a = retvals.get(x); if ( a!=null ) return a; } if ( locals!=null ) { Attribute a = locals.get(x); if ( a!=null ) return a; } AttributeDict properties = getPredefinedScope(LabelType.RULE_LABEL); return properties.get(x); }
public static AttributeDict parse(ActionAST action, String s, char separator, Grammar g) { AttributeDict dict = new AttributeDict(); List<Pair<String, Integer>> decls = splitDecls(s, separator); for (Pair<String, Integer> decl : decls) { // System.out.println("decl="+decl); if ( decl.a.trim().length()>0 ) { Attribute a = parseAttributeDef(action, decl, g); dict.add(a); } } return dict; }
protected void checkLocalConflictingDeclarations(Rule r, AttributeDict attributes, AttributeDict referenceAttributes, ErrorType errorType) { if (attributes == null || referenceAttributes == null) { return; } Set<String> conflictingKeys = attributes.intersection(referenceAttributes); for (String key : conflictingKeys) { errMgr.grammarError( errorType, g.fileName, attributes.get(key).token != null ? attributes.get(key).token : ((GrammarAST)r.ast.getChild(0)).token, key, r.name); } }
/** Return the set of keys that collide from * {@code this} and {@code other}. */ public Set<String> intersection(AttributeDict other) { if ( other==null || other.size()==0 || size()==0 ) { return Collections.emptySet(); } Set<String> result = new HashSet<String>(attributes.keySet()); result.retainAll(other.attributes.keySet()); return result; }
@Override public String toString() { return getName()+":"+attributes; } }
/** $x Attribute: rule arguments, return values, predefined rule prop. */ @Override public Attribute resolveToAttribute(String x, ActionAST node) { if ( args!=null ) { Attribute a = args.get(x); if ( a!=null ) return a; } if ( retvals!=null ) { Attribute a = retvals.get(x); if ( a!=null ) return a; } if ( locals!=null ) { Attribute a = locals.get(x); if ( a!=null ) return a; } AttributeDict properties = getPredefinedScope(LabelType.RULE_LABEL); return properties.get(x); }
public static AttributeDict parse(ActionAST action, String s, char separator, Grammar g) { AttributeDict dict = new AttributeDict(); List<Pair<String, Integer>> decls = splitDecls(s, separator); for (Pair<String, Integer> decl : decls) { if (decl.a.trim().length() > 0) { Attribute a = parseAttributeDef(action, decl, g); dict.add(a); } } return dict; }
protected void checkLocalConflictingDeclarations(Rule r, AttributeDict attributes, AttributeDict referenceAttributes, ErrorType errorType) { if (attributes == null || referenceAttributes == null) { return; } Set<String> conflictingKeys = attributes.intersection(referenceAttributes); for (String key : conflictingKeys) { errMgr.grammarError( errorType, g.fileName, attributes.get(key).token != null ? attributes.get(key).token : ((GrammarAST) r.ast.getChild(0)).token, key, r.name); } }
/** Return the set of keys that collide from * {@code this} and {@code other}. */ public Set<String> intersection(AttributeDict other) { if ( other==null || other.size()==0 || size()==0 ) { return Collections.emptySet(); } Set<String> result = new HashSet<String>(attributes.keySet()); result.retainAll(other.attributes.keySet()); return result; }
@Override public String toString() { return getName()+":"+attributes; } }
/** $x Attribute: rule arguments, return values, predefined rule prop. */ @Override public Attribute resolveToAttribute(String x, ActionAST node) { if ( args!=null ) { Attribute a = args.get(x); if ( a!=null ) return a; } if ( retvals!=null ) { Attribute a = retvals.get(x); if ( a!=null ) return a; } if ( locals!=null ) { Attribute a = locals.get(x); if ( a!=null ) return a; } AttributeDict properties = getPredefinedScope(LabelType.RULE_LABEL); return properties.get(x); }
public static AttributeDict parse(ActionAST action, String s, char separator, Grammar g) { AttributeDict dict = new AttributeDict(); List<Pair<String, Integer>> decls = splitDecls(s, separator); for (Pair<String, Integer> decl : decls) { // System.out.println("decl="+decl); if ( decl.a.trim().length()>0 ) { Attribute a = parseAttributeDef(action, decl, g); dict.add(a); } } return dict; }
protected void checkLocalConflictingDeclarations(@NotNull Rule r, @Nullable AttributeDict attributes, @Nullable AttributeDict referenceAttributes, @NotNull ErrorType errorType) { if (attributes == null || referenceAttributes == null) { return; } Set<String> conflictingKeys = attributes.intersection(referenceAttributes); for (String key : conflictingKeys) { errMgr.grammarError( errorType, g.fileName, attributes.get(key).token != null ? attributes.get(key).token : ((GrammarAST)r.ast.getChild(0)).token, key, r.name); } }