Ejemplo n.º 1
0
 private IRTSDefine.Error onBuild(IRTSEngine lib)
 {
     mReader.fixCharsOffset();
     if (mReader.hasNext())
     {
         string     src       = mReader.nextWord(lib);
         IRTSLinker newLinker = lib.newLinker(src);
         IRTSLinker right     = newLinker;
         IRTSLinker left      = getPriorityRoot(mTempLinker, right);
         if (left.isPriority(right))
         {
             if (!right.appendLeftChild(left))
             {
                 mTempLinker = left;
                 return(IRTSDefine.Error.Compiling_InvalidLinkerL);
             }
             mTempLinker = right;
         }
         else
         {
             IRTSLinker replace = left.appendRightChild(right);
             if (replace == null)
             {
                 mTempLinker = right;
             }
             else if (replace == left)
             {
                 mTempLinker = left;
             }
             else if (replace == right)
             {
                 mTempLinker = right;
                 return(IRTSDefine.Error.Compiling_InvalidLinkerR);
             }
             else
             {
                 mTempLinker = right;
                 if (!right.appendLeftChild(replace))
                 {
                     mTempLinker = replace;
                     return(IRTSDefine.Error.Compiling_InvalidLinkerL_rep);
                 }
             }
         }
         return(0);
     }
     else
     {
         mBuild     = false;
         mExeLinker = getDeepRoot(mTempLinker);
         if (mExeLinker != null)
         {
             mCompileList.add(mExeLinker);
         }
         return(0);
     }
 }
Ejemplo n.º 2
0
        private IRTSLinker getPriorityRoot(IRTSLinker left, IRTSLinker right)
        {
            IRTSLinker l = left;

            while (l != null && l.isPriority(right))
            {
                IRTSLinker l1 = l.getSuper();
                if (l1 == null)
                {
                    break;
                }
                else
                {
                    l = l1;
                }
            }
            return(l);
        }