Beispiel #1
0
        static public ITokenCollection create()
        {
            Semi rtn = new Semi();

            rtn.toker = new Toker();
            return(rtn);
        }
        //----< make copy of semi >--------------------------------------

        public ITokenCollection clone()
        {
            var theClone = new Semi();
            foreach (var token in toks)
                theClone.add(token);
            return theClone;
        }
    //----< make copy of semi >--------------------------------------

    public ITokenCollection clone()
    {
      Semi theClone = new Semi();
      foreach (string token in toks)
        theClone.add(token);
      return theClone;
    }
Beispiel #4
0
    //----< fold >---------------------------------------------------

    void fold()
    {
      if(hasSequence("for", "(", ";"))
      {
        Semi temp = new Semi(toks);
        get();  // get i<N;
        temp.addRange(this);
        get();
        temp.addRange(this);  // get ++i) .. {
        toks = temp.toks;
      }
    }
        //----< extract contiguous subset of tokens >--------------------

        public ITokenCollection getFunctionParams()
        {
            var subset = new Semi();
            int start, end;
            if (find("(", out start))
            {
                if (!find(")", out end))
                    return subset;
            }
            else
            {
                return subset;
            }

            for (var i = start + 1; i < end; ++i) subset.add(toks[i]);
            subset.add(";");
            return subset;
        }
 public static ITokenCollection create()
 {
     var rtn = new Semi();
     rtn.toker = new Toker();
     return rtn;
 }