Beispiel #1
0
     public ADocument(
         IList _sexp_
 )
     {
         this._sexp_ = new TypedList(new Sexp_Cast(this));
         this._sexp_.Clear();
         this._sexp_.AddAll(_sexp_);
     }
Beispiel #2
0
 ArrayList New9()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode2 = new TypedList();
     PSexp psexpNode1 = (PSexp)nodeArrayList1[0];
     if ( psexpNode1 != null )
     {
     listNode2.Add(psexpNode1);
     }
     nodeList.Add(listNode2);
     return nodeList;
 }
Beispiel #3
0
 ArrayList New2()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList3 = (ArrayList) Pop();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode4 = new TypedList();
     TTParenopen ttparenopenNode2 = (TTParenopen)nodeArrayList1[0];
     TypedList listNode3 = (TypedList)nodeArrayList2[0];
     if ( listNode3 != null )
     {
     listNode4.AddAll(listNode3);
     }
     AListSexp psexpNode1 = new AListSexp (
       ttparenopenNode2,
       listNode4
     );
     nodeList.Add(psexpNode1);
     return nodeList;
 }
Beispiel #4
0
 ArrayList New10()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode3 = new TypedList();
     TypedList listNode1 = (TypedList)nodeArrayList1[0];
     PSexp psexpNode2 = (PSexp)nodeArrayList2[0];
     if ( listNode1 != null )
     {
     listNode3.AddAll(listNode1);
     }
     if ( psexpNode2 != null )
     {
     listNode3.Add(psexpNode2);
     }
     nodeList.Add(listNode3);
     return nodeList;
 }
Beispiel #5
0
 ArrayList New1()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList2 = (ArrayList) Pop();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode3 = new TypedList();
     TTParenopen ttparenopenNode2 = (TTParenopen)nodeArrayList1[0];
     AListSexp psexpNode1 = new AListSexp (
       ttparenopenNode2,
       listNode3
     );
     nodeList.Add(psexpNode1);
     return nodeList;
 }
Beispiel #6
0
 ArrayList New0()
 {
     ArrayList nodeList = new ArrayList();
     ArrayList nodeArrayList1 = (ArrayList) Pop();
     TypedList listNode3 = new TypedList();
     TypedList listNode2 = (TypedList)nodeArrayList1[0];
     if ( listNode2 != null )
     {
     listNode3.AddAll(listNode2);
     }
     ADocument pdocumentNode1 = new ADocument (
       listNode3
     );
     nodeList.Add(pdocumentNode1);
     return nodeList;
 }
Beispiel #7
0
        public Start Parse()
        {
            Push(0, null);

            IList ign = null;
            while(true)
            {
            while(Index(lexer.Peek()) == -1)
            {
                if(ign == null)
                {
                    ign = new TypedList(NodeCast.Instance);
                }

                ign.Add(lexer.Next());
            }

            if(ign != null)
            {
                ignoredTokens.SetIn(lexer.Peek(), ign);
                ign = null;
            }

            last_pos = lexer.Peek().Pos;
            last_line = lexer.Peek().Line;
            last_token = lexer.Peek();

            int index = Index(lexer.Peek());
            action[0] = actionTable[State()][0][1];
            action[1] = actionTable[State()][0][2];

            int low = 1;
            int high = actionTable[State()].Length - 1;

            while(low <= high)
            {
                int middle = (low + high) / 2;

                if(index < actionTable[State()][middle][0])
                {
                    high = middle - 1;
                }
                else if(index > actionTable[State()][middle][0])
                {
                    low = middle + 1;
                }
                else
                {
                    action[0] = actionTable[State()][middle][1];
                    action[1] = actionTable[State()][middle][2];
                    break;
                }
            }

            switch(action[0])
            {
                case SHIFT:
            {
            ArrayList list = new ArrayList();
            list.Add(lexer.Next());
                        Push(action[1], list);
                        last_shift = action[1];
                    }
            break;
                case REDUCE:
                    switch(action[1])
                    {
                    case 0:
            {
              ArrayList list = New0();
              Push(GoTo(0), list);
            }
            break;
                    case 1:
            {
              ArrayList list = New1();
              Push(GoTo(1), list);
            }
            break;
                    case 2:
            {
              ArrayList list = New2();
              Push(GoTo(1), list);
            }
            break;
                    case 3:
            {
              ArrayList list = New3();
              Push(GoTo(2), list);
            }
            break;
                    case 4:
            {
              ArrayList list = New4();
              Push(GoTo(2), list);
            }
            break;
                    case 5:
            {
              ArrayList list = New5();
              Push(GoTo(2), list);
            }
            break;
                    case 6:
            {
              ArrayList list = New6();
              Push(GoTo(2), list);
            }
            break;
                    case 7:
            {
              ArrayList list = New7();
              Push(GoTo(2), list);
            }
            break;
                    case 8:
            {
              ArrayList list = New8();
              Push(GoTo(2), list);
            }
            break;
                    case 9:
            {
              ArrayList list = New9();
              Push(GoTo(3), list);
            }
            break;
                    case 10:
            {
              ArrayList list = New10();
              Push(GoTo(3), list);
            }
            break;
                    }
                    break;
                case ACCEPT:
                    {
                        EOF node2 = (EOF) lexer.Next();
                        PDocument node1 = (PDocument) ((ArrayList)Pop())[0];
                        Start node = new Start(node1, node2);
                        return node;
                    }
                case ERROR:
                    throw new ParserException(last_token,
                        "[" + last_line + "," + last_pos + "] " +
                        errorMessages[errors[action[1]]]);
            }
            }
        }
Beispiel #8
0
     public AListSexp(
         TTParenopen _t_parenopen_,
         IList _sexp_
 )
     {
         SetTParenopen (_t_parenopen_);
         this._sexp_ = new TypedList(new Sexp_Cast(this));
         this._sexp_.Clear();
         this._sexp_.AddAll(_sexp_);
     }
Beispiel #9
0
 public AListSexp()
 {
     this._sexp_ = new TypedList(new Sexp_Cast(this));
 }
Beispiel #10
0
 public ADocument()
 {
     this._sexp_ = new TypedList(new Sexp_Cast(this));
 }