anchor.diff:                  currentN := currentContext.Value.Ast 
                   currentR := dummyAST
                   functions.[!currentLabel] !currentIndex !currentGSSNode !currentR !currentN
  -                      
  -        match !resultAST with
  -            | None -> Error ("String was not parsed")
  -            | Some res -> 
  -                    drawDot parser tokens "gss.dot" gss
  -                    let r1 = new Tree<_> (tokens, res, parser.rules)
  -                    Success (r1)       
  +
  +    member this.Pop = pop
  +    member this.AddContext = addContext
  +    member this.Create = create
  +    member this.Test = test
  +    member this.GetNodeT = getNodeT
  +    member this.GetNodeP = getNodeP   
  +   
  +//                      
  +//        match !resultAST with
  +//            | None -> Error ("String was not parsed")
  +//            | Some res -> 
  +//                    drawDot parser tokens "gss.dot" gss
  +//                    let r1 = new Tree<_> (tokens, res, parser.rules)
  +//                    Success (r1)       
  
positive.code:     | Success of Tree<'TokenType>
      | Error of string
  
  type SourceFile<'TokenType>(tokens : seq<'TokenType>, parser : ParserSource2<'TokenType>) =
      let tokens = Seq.toArray tokens
      let length = Seq.length tokens
      let resultAST = ref None
      let setR = new Queue<Context>()   
      let setP = new System.Collections.Generic.Dictionary<int64<vertex>,ResizeArray<ExtensionTree>> ()
      let astDictionary = new System.Collections.Generic.Dictionary<int64<key>,AST> ()
      let setU = Array.init (length + 1) (fun _ -> new Dictionary<_*_, ResizeArray<INode>>())
              
      let currentIndex = ref 0
  
  
negative.code:                     setU.[index].Add (key, t)
                  setR.Enqueue(cntxt)  
          
      let getNodeP label (left : ExtensionTree) (right : ExtensionTree) =      
          let rExt = right.extension
          let condTemp = right.tree = null
          let mutable result = dummyAST
          if left.tree <> null
          then
              let lExt = left.extension
              if condTemp
              then
                  result <- new ExtensionTree(packExtension (getLeftExtension lExt) (getRightExtension lExt), (new IntermidiateNode(left.tree, right.tree, label)))
              else 
                  result <- new ExtensionTree(packExtension (getLeftExtension lExt) (getRightExtension rExt), (new IntermidiateNode(left.tree, right.tree, label)))
          else 
              result <- new ExtensionTree(packExtension (getLeftExtension rExt) (getRightExtension rExt), (new IntermidiateNode(left.tree, right.tree, label)))
          result
                  
              
      let getNodeT index =
          if terminalNodes.Item index = Unchecked.defaultof<ExtensionTree>
          then
              let tree = new TerminalNode(index)
              let result = new ExtensionTree(packExtension index (index + 1), tree)
              terminalNodes.Set index result
              result
          else terminalNodes.Item index            
              
      let containsGSSNode l i =  
          let curLevel = gss.[i]
          let index = curLevel.FindIndex (fun v -> v.Label = l)
          if index = -1
          then
                     
              curLevel.Add <| new Vertex(i, l)   
              packVertex i (curLevel.Count - 1)
          else packVertex i index
  
      let containsEdge (b : int64<vertex>) (e : int64<vertex>) (ast : INode) =
          let edges = gss.[getIndex2Vertex b].[getIndex1Vertex b].OutEdges
          edges.first <> Unchecked.defaultof<_> && (edges.first.Dest = e || (edges.other <> null && edges.other |> Array.exists (fun edge ->  edge.Dest = e)))
  
      let findTree prod extension (family : Family) =            
          let result = 
              if astDictionary.ContainsKey extension
              then
                  let a = astDictionary.[extension]
                  let eq (fam : Family) =
                      fam.prod = family.prod
                      && obj.ReferenceEquals(fam.node, family.node)                    
                      
                  if not (eq a.first || (a.other <> null && a.other |> Array.exists eq))
                  then
                      if a.other <> null
                      then a.other <- Array.append a.other [|family|]
                      else a.other <- [|family|]
                  a
              else
                  let value = new AST(family, null)
                  astDictionary.Add(extension, value)
                  value
              
          result
  
      let create label (u : int64<vertex>) (index : int) (ast : ExtensionTree) = 
          let v = containsGSSNode label index
          if not (containsEdge v u ast.tree)
          then
              let newEdge = new Edge(u, ast)
              // edges.[gss.[getIndex2Vertex v].[getIndex1Vertex v].Level,gss.[getIndex2Vertex u].[getIndex1Vertex u].Level].Add(newEdge)
              if setP.ContainsKey v
              then
                  let trees = setP.[v]
                  let handleTree ast2 =
                          
                      let y = getNodeP label ast ast2
                      addContext label (getRightExtension ast2.extension) u y      
                  trees |> ResizeArray.iter handleTree
              let vertex = gss.[getIndex2Vertex v].[getIndex1Vertex v]     
              if vertex.OutEdges.first <> Unchecked.defaultof<_>
              then
                  if vertex.OutEdges.other <> null
                  then vertex.OutEdges.other <- Array.append vertex.OutEdges.other [|newEdge|]
                  else vertex.OutEdges.other <- [|newEdge|]
              else vertex.OutEdges.first <- newEdge
          v
  
      let pop (u : int64<vertex>) (i : int) (z : AST) extension =
          let temp = 0
          if not (u = dummyGSSNode)
          then
              let vertex = gss.[getIndex2Vertex u].[getIndex1Vertex u]
              let temp = new ExtensionTree(extension, z)
              let label = vertex.Label
              if setP.ContainsKey u           //вот тут можно попробовать какой-нибудь tryGet
              then
                  setP.[u].Add(temp)
              else 
                  let value = new ResizeArray<ExtensionTree>(5)
                  value.Add(temp)
                  setP.Add(u, value)
              let processEdge (edge : Edge) =
                  if not <| obj.ReferenceEquals(edge.Ast, dummyAST)
                  then
                      let y1 = getNodeP label edge.Ast temp
                      addContext label i edge.Dest y1
                  else addContext label i edge.Dest (new ExtensionTree(extension, z))  
              processEdge vertex.OutEdges.first
              if vertex.OutEdges.other <> null 
              then vertex.OutEdges.other |> Array.iter processEdge
     
      let getIndex nTerm term = 
          let mutable index = nTerm
          index <- (index * (parser.IndexatorFullCount - parser.NonTermCount))
          index <- index + term - parser.NonTermCount
          index
      
      let curToken = parser.TokenToNumber tokens.[!currentIndex]
      let table = parser.Table
      
      let test nonTerm funName =
          if Array.exists (fun e -> e = funName) table.[getIndex nonTerm curToken]
          then
              true
          else false
  
      let start =
          gss.[!currentIndex].Add dummyGSSNode
  
          while setR.Count <> 0 do
                  currentContext := setR.Dequeue()
                  currentIndex := currentContext.Value.Index
  