org.jastadd.ast.AST.CustomSurveyContribution Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jastadd Show documentation
Show all versions of jastadd Show documentation
A metacompilation framework for Java using attribute grammars.
package org.jastadd.ast.AST;
import org.jastadd.tinytemplate.*;
import org.jastadd.Configuration;
import java.util.*;
import java.io.*;
import org.jastadd.ast.AST.*;
import org.jastadd.jrag.*;
import org.jastadd.jrag.AST.ASTCompilationUnit;
import org.jastadd.jrag.AST.ASTBlock;
import org.jastadd.JastAdd;
import java.util.Collection;
import java.util.LinkedList;
import java.util.regex.*;
import org.jastadd.jrag.AST.ASTExpression;
import java.util.Set;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jastadd.jrag.Unparser;
import org.jastadd.Problem;
import org.jastadd.jrag.AST.ASTAspectMethodDeclaration;
import org.jastadd.jrag.AST.ASTAspectRefineMethodDeclaration;
import org.jastadd.jrag.AST.ASTAspectFieldDeclaration;
import org.jastadd.jrag.ClassBodyObject;
import org.jastadd.ast.AST.Token;
import org.jastadd.ast.AST.SimpleNode;
import java.io.PrintStream;
/**
* @ast class
* @aspect CollectionAttributes
* @declaredat /home/jesper/git/jastadd2/src/jastadd/ast/CollectionAttributes.jrag:249
*/
abstract class CustomSurveyContribution extends java.lang.Object implements SurveyContribution {
protected final String collName;
protected final String collHost;
protected final String fileName;
protected final int startLine;
protected final int endLine;
protected final String comment;
protected final String aspectName;
public CustomSurveyContribution(String collName, String collHost,
String fileName, int startLine, int endLine, String comment,
String aspectName) {
this.collName = collName;
this.collHost = collHost;
this.fileName = fileName;
this.startLine = startLine;
this.endLine = endLine;
this.comment = comment;
this.aspectName = aspectName;
}
public CollDecl lookupCollDecl(Grammar grammar) {
CollDecl decl = grammar.lookupCollDecl(collHost, collName);
if (decl == null) {
throw new Error(String.format(
"%s:%d: Can not add custom survey code for unknown collection attribute: %s.%s()",
fileName, startLine, collHost, collName));
}
return decl;
}
}