Esempio n. 1
0
        public (string name, int id) AddDefinition(StringConst str)
        {
            string name;
            int    state;

            try
            {
                if (str == null)
                {
                    throw new ArgumentNullException(nameof(str));
                }
                var text = str.Value;

                state = graph.FindState(text);
                if (state == -1)
                {
                    name = CreateName(str.Value);
                    var g = graph.Create(text);
                    state = g.MarkEnd(name, text);
                    graph.Union(g);
                }
                else
                {
                    graph.Machine.AcceptingStates.TryGetName(state, out name);
                }
                return(name, state);
            }
            catch (Exception ex)
            {
                logger.LogError($"Uncaught exception: {ex.Message}",
                                str);
                throw;
            }
        }
Esempio n. 2
0
 public StringTokenProd(StringConst text)
     : base(text)
 {
     this.text = text;
 }