Search in sources :

Example 6 with Member

use of ast.Expression.ClassB.Member in project L42 by ElvisResearchGroup.

the class ToFormattedText method formatMembers.

private void formatMembers(List<Member> ms) {
    for (Member m : ms) {
        m.match(nestedClass -> {
            nl();
            c(nestedClass.getName().toString());
            c(":");
            formatDoc(nestedClass.getDoc());
            return nestedClass.getInner().accept(this);
        }, methImpl -> {
            nl();
            c("method ");
            formatMs(methImpl.getS());
            return methImpl.getInner().accept(this);
        }, methT -> {
            nl();
            formatMts(methT);
            if (methT.getInner().isPresent()) {
                methT.getInner().get().accept(this);
            }
            return null;
        });
    }
}
Also used : Member(ast.Expression.ClassB.Member)

Example 7 with Member

use of ast.Expression.ClassB.Member in project L42 by ElvisResearchGroup.

the class ToFormattedText method ofCompact.

public static String ofCompact(Expression e, boolean inline) {
    ToFormattedText tft = new ToFormattedText() {

        public Void visit(ClassB cb) {
            //String res="";
            String wb = "";
            for (Member m : cb.getMs()) {
                if (m instanceof NestedClass) {
                    NestedClass nc = (NestedClass) m;
                    if (nc.getInner() instanceof WalkBy) {
                        wb = nc.getName() + ":##";
                    }
                }
            }
            return c("{.." + wb + "..}");
        }
    };
    e.accept(tft);
    String res = tft.result.toString();
    if (inline) {
        res = res.replace("\n", " ");
    }
    //if(res.length()>80){ res=res.substring(0, 34)+" ... "+res.substring(res.length()-34); }
    return res;
}
Also used : NestedClass(ast.Expression.ClassB.NestedClass) Member(ast.Expression.ClassB.Member) ClassB(ast.Expression.ClassB) WalkBy(ast.Expression.WalkBy)

Aggregations

Member (ast.Expression.ClassB.Member)7 ClassB (ast.Expression.ClassB)4 Header (ast.Ast.Header)3 MethodType (ast.Ast.MethodType)3 Type (ast.Ast.Type)3 ExpCore (ast.ExpCore)3 ArrayList (java.util.ArrayList)3 Ast (ast.Ast)2 ConcreteHeader (ast.Ast.ConcreteHeader)2 Doc (ast.Ast.Doc)2 FieldDec (ast.Ast.FieldDec)2 Mdf (ast.Ast.Mdf)2 MethodSelector (ast.Ast.MethodSelector)2 Path (ast.Ast.Path)2 Position (ast.Ast.Position)2 VarDec (ast.Ast.VarDec)2 VarDecXE (ast.Ast.VarDecXE)2 Expression (ast.Expression)2 ClassReuse (ast.Expression.ClassReuse)2 Visitor (coreVisitors.Visitor)2