Package frege.compiler.types.Global

Examples of frege.compiler.types.Global.TGlobal


  private TGlobal prev = null;
  @Override
  public void visitTree(Object root) {
    if (root == null || !(root instanceof TGlobal))
      return;
    TGlobal global = (TGlobal) root;
    if (prev == null || FregeParseController.achievement(prev) <=  FregeParseController.achievement(global))
      prev = global;
    else global = prev;
   
    // fModelRoot = createTopItem(global, ModelTreeNode.DEFAULT_CATEGORY);
View Full Code Here


  /**
   * Get the target for the given source node in the AST produced by the
   * given Parse Controller.
   */
  public Object getLinkTarget(Object node, IParseController controller) {
    TGlobal g = null;
   
    if (controller != null) {
      Object o = controller.getCurrentAst();
      if (o != null && o instanceof TGlobal) g = (TGlobal) o;
    }
View Full Code Here

 
  public Object findNode(Object ast, int startOffset, int endOffset) {
    System.err.print("findNode( " + ast + ", " + startOffset + ", " +  endOffset + " ) called: ");
    if (ast != null && ast instanceof TGlobal) {
      // find out the token we are working with
      TGlobal global = (TGlobal) ast;
      TToken[] arr  = TSubSt.toks( TGlobal.sub(global) );
      int at = binsearch(arr, startOffset, endOffset);
      TToken res = tokenAt(arr, at);
      if (res == null)
        System.err.println(" no such token");
View Full Code Here

    conAttribute     = new TextAttribute(dconColor,  null, SWT.NORMAL);
    iconAttribute    = new TextAttribute(dconColor,  null, italic ? SWT.ITALIC : SWT.NORMAL);
  }
 
  public TextAttribute getKind(FregeParseController controller, TToken tok, TextAttribute normalAttribute) {
    TGlobal g = controller.getCurrentAst();
    final TMaybe mb = TGlobal.resolved(g, tok);
    final TMaybe.DJust just = mb._Just();
    if (just == null) return normalAttribute;
    final TEither et = Delayed.<TEither>forced( just.mem1 );
    final DRight right = et._Right();
View Full Code Here

//          || src.hashCode() != parser.getHash()) {
//      return result.toArray(new ICompletionProposal[result.size()]);    // buffer dirty, return previous result
//    }

    List<ICompletionProposal> result = new ArrayList<ICompletionProposal>();
    final TGlobal g = parser.getGoodAst();
    final TToken[] tokens = TSubSt.toks(TGlobal.sub(g))
     
    if (g != null) {
      int inx = FregeSourcePositionLocator.previous(tokens, offset);
     
View Full Code Here

        try {
          if (!editor.isEditable()) return;
          IParseController pc = editor.getParseController();
          if (pc == null || !(pc instanceof FregeParseController)) return;
          final FregeParseController fpc = (FregeParseController) pc;
          TGlobal global = fpc.getCurrentAst();
              if (global == null) return;
              // global.mem$sub.mem$cache.put(TTree.DNil.it);
              // fpc.global = FregeParseController.runSTG(action, global);
             
              final IDocument document= editor.
View Full Code Here

      ISourceProject sourceProject = ModelFactory.open(file.getProject());
      parseController.initialize(file.getProjectRelativePath(),
          sourceProject, markerCreator);

      String contents = BuilderUtils.getFileContents(file);
      final TGlobal result = parseController.parse(contents, new CompProgress());
      if (FregeParseController.errors(result) == 0) {
        // run the eclipse java compiler
        final String target = Main.targetPath(result, ".java");
       
        getPlugin().writeInfoMsg("built: " + target);
View Full Code Here

        index++;
        passes = pass.mem2.<TList>forced();
        final TTuple2 adx = Delayed.<TTuple2>forced( pass.mem1 );
        final Lazy action = index == 1 ? Main.lexPassIDE(contents) : Delayed.delayed(adx.mem1);
        final String   desc   = Delayed.<String>forced(adx.mem2);
        final TGlobal g = runSTIO(action, global);
        te = System.nanoTime();
        System.err.println(desc + " took "
          + (te-t1)/1000000 + "ms, cumulative "
          + (te-t0)/1000000 + "ms");
       
        monitor.worked(1);
        global = runSTG(Utilities.passDone, g);
      }
      if (achievement(global) >= achievement(goodglobal))
        goodglobal = global;      // when opening a file with errors
      else {
        // update token array in goodglobal
        TToken[] toks = TSubSt.toks(TGlobal.sub(global));
        goodglobal = TGlobal.upd$sub(goodglobal, TSubSt.upd$toks(
            TGlobal.sub(goodglobal), toks));
      }
//      Array gtoks = TSubSt.toks(TGlobal.sub(global));
//      System.err.println("global.toks==good.toks is " + (toks == gtoks));
    }
   
    int needed = (int) ((te-t0) / 1000000);
       
    if (scanOnly && timeout - needed > 0 && errors(global) == 0 && !monitor.isCanceled())
      try { Thread.sleep(timeout - needed); } catch (InterruptedException e) {}
    t0 = System.nanoTime() - (te-t0);

   
    while (!monitor.isCanceled()
          && errors(global) == 0
          && (pass = passes._Cons()) != null) {      // do the rest unsynchronized
        t1 = System.nanoTime();
        passes = pass.mem2.<TList>forced();
        index++;
        final TTuple2 adx = Delayed.<TTuple2>forced( pass.mem1 );
        final Lazy action = Delayed.delayed(adx.mem1);
        final String   desc   = Delayed.<String>forced(adx.mem2);
        final TGlobal g = runSTIO(action, global);
        te = System.nanoTime();
        System.err.println(desc + " took "
          + (te-t1)/1000000 + "ms, cumulative "
          + (te-t0)/1000000 + "ms");
       
View Full Code Here

  public TGlobal parse(String input, IProgressMonitor monitor) {
    MarkerCreatorWithBatching mcwb = msgHandler instanceof MarkerCreatorWithBatching ?
        (MarkerCreatorWithBatching) msgHandler : null;
    // when we build, we'll get a MarkerCreatorWithBatching
    // Hence, if we do not have one, we just scan&parse, otherwise we do a full compile
    TGlobal g = parse(input, mcwb == null, monitor);
    int u = TGlobal.unique(g);
    System.err.printf("frege parse: done, unique=%d, adding errors ", u);
    tokensIteratorDone = false;
    TList msgs = PreludeList.reverse(TSubSt.messages(TGlobal.sub(g)));
    int maxmsgs = 9;
View Full Code Here

TOP

Related Classes of frege.compiler.types.Global.TGlobal

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.