Package frege.compiler.types.Tokens

Examples of frege.compiler.types.Tokens.TToken


      Object o = controller.getCurrentAst();
      if (o != null && o instanceof TGlobal) g = (TGlobal) o;
    }
   
    if (g != null && node != null && node instanceof TToken) {
      TToken tok = (TToken) node;
      System.err.println("getLinkTarget: " + IShow_Token.show(tok));
      int tid = TToken.tokid(tok);
      if (tid == TTokenID.CHAR && "_".equals(TToken.value(tok))) {
        tid = TTokenID.VARID;
        tok = TToken.upd$tokid(tok, TTokenID.VARID);
View Full Code Here


   
    while (from +2 < to) {
      int it = (from + to) / 2;
      // if (it==from || it == to) break;
      // System.err.println("previous: before=" + before + ", from=" + from + ", to=" + to);
      TToken at = tokenAt(arr, it);
      int off = TToken.offset(at);
      // System.err.println("previous: it=" + it + ", token=" + IShow_Token.show(at));

      if (off >= before) {  // its more left
        to = it; continue;
      }
      from = it;     
    }
    // linear search down
    while (to >= 0) {
      // System.err.println("previous: before=" + before +  ", to=" + to);
      TToken at = tokenAt(arr, to);
      if (at == null || TToken.col(at) == 0) { to--; continue; }    // no inserted ';' and '}'
      // System.err.println("previous: token=" + IShow_Token.show(at));
      if (TToken.offset(at) < before) return to;
      to--;
    }
View Full Code Here

  public static int binsearch(TToken[] arr, int start, int end) {
    int from = 0;
    int to = arr.length;
    while (from < to) {
      int it = (from + to) / 2;
      TToken at = arr[it];
      int off = TToken.offset(at);
      int len = TToken.length(at);
      if (off + len <= start) {  // the searched token is more right
        from = it+1; continue;
      }
View Full Code Here

    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");
      else {
        System.err.println(IShow_Token.show(res));
      }
View Full Code Here

    final TToken[] tokens = TSubSt.toks(TGlobal.sub(g))
     
    if (g != null) {
      int inx = FregeSourcePositionLocator.previous(tokens, offset);
     
      TToken token = FregeSourcePositionLocator.tokenAt(tokens, inx);
      TToken tprev = FregeSourcePositionLocator.tokenAt(tokens, inx-1);
      boolean direct = false;
      boolean inside = false;
      String  id = "none";
      String  idprev = tprev == null ? ""
                : TokenID.IShow_TokenID.show(TToken.tokid(tprev)) + ",";
View Full Code Here

        }
        */
       
        if (!success) {
          TPosition pos = Global.packageStart(result).<TPosition>forced();
          TToken module = TPosition.first(pos);
          int line = TToken.line(module);
          int chStart = TToken.offset(module);
          int chEnd = chStart + TToken.length(module);
          String msg = errs.toString();
          String[] msgs = msg.split(System.getProperty("line.terminator", "\n"));
View Full Code Here

    public TokensIterator(TToken[] it, IRegion reg) {
      toks = it;
      region = reg;
      inx = 0;
      while (inx < toks.length) {
        TToken t = toks[inx];
        if (within(t, reg)) break;
        inx++;
      }
    }
View Full Code Here

TOP

Related Classes of frege.compiler.types.Tokens.TToken

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.