示例#1
0
        public void setNoTerminal(String noTerminal, token nextToken)
        {
            String  tokenRequired = nextToken.getName();
            String  nameLastNode  = nodesWaited[nodesWaited.Count - 1].getName();
            Boolean isError       = true;

            foreach (RowSA row in this.tableSA)
            {
                String nameNoTerminal = row.getRow();
                String column         = row.getCol();
                if (column == tokenRequired && nameNoTerminal == noTerminal && nameNoTerminal == nameLastNode)
                {
                    NodeTree nodeToUse         = new NodeTree(codeUsing.ToString(), nameNoTerminal);
                    NodeTree nodeParentFromUse = nodesWaited[nodesWaited.Count - 1].getParent();
                    nodeParentFromUse.setNewChild(nodeToUse);
                    nodeToUse.setNodeParent(nodeParentFromUse);
                    this.nodeUsing = nodeToUse;
                    String values = row.getVal();
                    setTokensToWait(values);
                    this.codeUsing++;
                    isError = false;
                    break;
                }
            }
            if (isError == true && nameLastNode.Equals("Q'"))
            {
                nodesWaited.RemoveAt(nodesWaited.Count - 1);
                setNoTerminal(noTerminal, nextToken);
            }
        }
示例#2
0
        public void addNodeTree(token tokenSet, NodeWaited nodeInsert)
        {
            codeUsing++;
            NodeTree parent = nodeInsert.getParent();
            String   name   = nodeInsert.getName();

            if (this.nodeWaitValue.Contains(nodeInsert.getName()))
            {
                String newName = tokenSet.getVal();
                name = newName;
            }
            NodeTree newNode = new NodeTree("node" + codeUsing.ToString(), name);

            newNode.setNodeParent(parent);
            parent.setNewChild(newNode);
            nodesWaited.RemoveAt(nodesWaited.Count - 1);
        }