Ejemplo n.º 1
0
 private bool DoParseModelLine(string[] words)
 {
     if (words[words.Length - 2] != "->")
     {
         return(false);
     }
     if (currentFun != null)
     {
         if (words[0] == "else")
         {
             return(true);
         }
         FunApp fapp = new FunApp();
         fapp.Args = new Partition[words.Length - 2];
         for (int i = 0; i < fapp.Args.Length; ++i)
         {
             fapp.Args[i] = model.PartitionByName(words[i]);
         }
         fapp.Value = model.PartitionByName(words[words.Length - 1]);
         fapp.Fun   = currentFun;
         currentFun.Apps.Add(fapp);
         fapp.Value.Values.Add(fapp);
         return(true);
     }
     else if (words.Length == 3)
     {
         FunSymbol fs = model.FunSymbolByName(words[0]);
         if (words[2] == "{")
         {
             currentFun = fs;
         }
         else
         {
             FunApp fapp = new FunApp();
             fapp.Args  = new Partition[0];
             fapp.Fun   = fs;
             fapp.Value = model.PartitionByName(words[words.Length - 1]);
             fs.Apps.Add(fapp);
             fapp.Value.Values.Add(fapp);
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        private bool ParseModelLine(string[] words)
        {
            if (words.Length == 1)
            {
                switch (words[0])
                {
                case "}":
                    currentFun = null;
                    return(true);

                case "partitions:": // V1
                case "Counterexample:":
                    model.NewModel();
                    return(true);

                case ".":
                case "END_OF_MODEL":
                    eofSeen++;
                    return(true);
                }
                if (model.IsV1Part(words[0]))
                {
                    return(true);
                }
                return(false);
            }

            if (words[0] == "***")
            {
                switch (words[1])
                {
                case "MODEL":
                    model.NewModel();
                    return(true);

                case "END_MODEL":
                    eofSeen++;
                    modelInState = false;
                    return(true);

                case "STATE":
                    modelInState = true;
                    return(true);
                }
            }

            if (modelInState)
            {
                return(true);
            }

            switch (words[0])
            {
            case "labels:":
            case "Z3":
            case "function":
                return(true);
            }

            if (currentFun == null && model.IsV1Part(words[0]) && (words.Length < 3 || words[2] != "{"))
            {
                return(ParseV1ModelLine(words));
            }

            if (words.Length < 3)
            {
                return(false);
            }
            return(DoParseModelLine(words));
        }