Package edu.mit.csail.sdg.alloy4

Examples of edu.mit.csail.sdg.alloy4.OurTabbedSyntaxWidget


        if (arg.startsWith("POS: ")) { // POS: x1 y1 x2 y2 filename
            Scanner s=new Scanner(arg.substring(5));
            int x1=s.nextInt(), y1=s.nextInt(), x2=s.nextInt(), y2=s.nextInt();
            String f=s.nextLine();
            if (f.length()>0 && f.charAt(0)==' ') f=f.substring(1); // Get rid of the space after Y2
            Pos p=new Pos(Util.canon(f), x1, y1, x2, y2);
            text.shade(p);
        }
        if (arg.startsWith("CNF: ")) { // CNF: filename
            String filename=Util.canon(arg.substring(5));
            try { String text=Util.readAll(filename); OurDialog.showtext("Text Viewer", text); }
View Full Code Here


   }

   /** {@inheritDoc} */
   public Object do_action(Object sender, Event e, Object arg) {
      if (sender instanceof OurTree && e==Event.CLICK && arg instanceof Browsable) {
        Pos p = ((Browsable)arg).pos();
        if (p==Pos.UNKNOWN) p = ((Browsable)arg).span();
        text.shade(p);
      }
      return true;
   }
View Full Code Here

    private Field parseField(String id) throws IOException, Err {
       final XMLNode node = nmap.get(id);
       if (node==null) throw new IOException("Unknown FieldID "+id+" encountered.");
       if (!node.is("field")) throw new IOException("ID "+id+" is not a field.");
       String label  = label(node);
       Pos isPrivate = yes(node,"private") ? Pos.UNKNOWN : null;
       Pos isMeta = yes(node,"meta") ? Pos.UNKNOWN : null;
       Expr type = null;
       for(XMLNode sub:node) if (sub.is("types")) { Expr t=parseType(sub); if (type==null) type=t; else type=type.plus(t); }
       int arity;
       if (type==null || (arity=type.type().arity())<2) throw new IOException("Field "+label+" is maltyped.");
       String parentID = node.getAttribute("parentID");
View Full Code Here

   //============================================================================================================//

   /** {@inheritDoc} */
   @Override public Pos span() {
      Pos p = span;
      if (p==null) span = (p = pos.merge(closingBracket).merge(right.span()).merge(left.span()));
      return p;
   }
View Full Code Here

    //============================================================================================================//

    /** {@inheritDoc} */
    @Override public Pos span() {
        Pos p=span;
        if (p==null) { if (op==Op.NOOP && pos!=Pos.UNKNOWN) span=(p=pos); else span=(p=pos.merge(sub.span())); }
        return p;
    }
View Full Code Here

    /** Caches the span() result. */
    private Pos span;

    /** Returns a Pos object representing the entire span of this expression and all its subexpressions. */
    public Pos span() {
       Pos p = span;
       if (p == null) {
          p = expr.span().merge(disjoint).merge(disjoint2);
          for(ExprHasName n: names) p = p.merge(n.span());
          span = p;
       }
       return p;
    }
View Full Code Here

    //============================================================================================================//

    /** {@inheritDoc} */
    @Override public Pos span() {
        Pos p=span;
        if (p==null) {
            p=pos;
            for(Expr a:choices) p=p.merge(a.span());
            span=p;
        }
        return p;
    }
View Full Code Here

            if (array[0].equals("warnings")) {
                if (warnings.size()==0) span.setLength(len2);
                else if (warnings.size()>1) span.logBold("Note: There were "+warnings.size()+" compilation warnings. Please scroll up to see them.\n\n");
                else span.logBold("Note: There was 1 compilation warning. Please scroll up to see them.\n\n");
                if (warnings.size()>0 && Boolean.FALSE.equals(array[1])) {
                   Pos e = warnings.iterator().next().pos;
                   gui.doVisualize("POS: "+e.x+" "+e.y+" "+e.x2+" "+e.y2+" "+e.filename);
                   span.logBold("Warnings often indicate errors in the model.\n"
                     +"Some warnings can affect the soundness of the analysis.\n"
                     +"To proceed despite the warnings, go to the Options menu.\n");
                }
            }
            if (array[0].equals("warning")) {
                ErrorWarning e = (ErrorWarning)(array[1]);
                if (!warnings.add(e)) return;
                Pos p=e.pos;
                span.logLink("Warning #"+warnings.size(), "POS: "+p.x+" "+p.y+" "+p.x2+" "+p.y2+" "+p.filename);
                span.log("\n"); span.logIndented(e.msg.trim()); span.log("\n\n");
            }
            if (array[0].equals("sat")) {
                boolean chk = Boolean.TRUE.equals(array[1]);
View Full Code Here

    //============================================================================================================//

    /** {@inheritDoc} */
    @Override public Pos span() {
        Pos p=span;
        if (p==null) {
            p=pos.merge(closingBracket);
            for(Expr a:args) p=p.merge(a.span());
            span=p;
        }
        return p;
    }
View Full Code Here

    @Override public List<? extends Browsable> getSubnodes() {
        if (args.size()==0) {
            Expr b = fun.getBody();
            return Util.asList(make(b.pos(), b.span(), b.getDescription(), b.getSubnodes()));
        }
        Pos p = pos;
        if (p == Pos.UNKNOWN) p = span();
        Browsable f = make(p, p, (fun.isPred ? "<b>pred</b> " : "<b>fun</b> ")+fun.label , fun.getSubnodes());
        Browsable a = make(span(), span(), "<b>" + args.size() + " argument" + (args.size()==1 ? "</b>" : "s</b>"), args);
        return Util.asList(f, a);
    }
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4.OurTabbedSyntaxWidget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.