public AutomAutomat(string s)
            : base(s, 0)
        {
            /*
             * An AutomAutomat has the syntax
             * {List of AutomLetter separated by ','}
             */

            // Let's skip possible leading spaces
            int pos = 0;

            pos = GetNextChar(pos);
            // The char at pos must be an {
            Debug.Assert(s[pos] == '{', String.Format(BaseConfig.cultF, "La pos {0} de {1} n'est pas un AutomAutomat, on attend un \'{{\' en début d'automate.",
                                                      pos - start, s.Substring(start, (pos + 1) - start)));

            // Let's load the list of AutomLetters
            automLetters = new Dictionary <char, AutomLetter>(44); // there are 44 letters in our automata
            pos          = GetNextChar(pos + 1);
            while (s[pos] != '}')
            {
                AutomLetter al = new AutomLetter(s, ref pos);
                automLetters.Add(al.Letter, al);
                pos = GetNextChar(pos + 1);
                // it is either ',' or '}'
                Debug.Assert(((s[pos] == ',') || (s[pos] == '}')), string.Format(BaseConfig.cultF, "La pos {0} de {1} n'est pas un AutomAutomat, on attend une \',\' ou un \'}}\' après une lettre.",
                                                                                 pos - start, s.Substring(start, (pos + 1) - start)));
                if (s[pos] == ',')
                {
                    pos = GetNextChar(pos + 1);
                }
            } // while
            end = pos;
        }     // Constructor public AutomAutomat(string s, ref int pos)
Esempio n. 2
0
 static public void InitAutomat()
 {
     logger.ConditionalDebug("InitAutomat");
     AutomLetter.InitAutomat();
     autom = new AutomAutomat(theAutomat);
 }