Exemple #1
0
        public LexRole AddRole(string name, int startIndex, params LexCondition[] conditions)
        {
            LexRole role = null;

            if (conditions != null)
            {
                role = new LexRole(name, startIndex, conditions);
            }
            roles.Add(role);
            return(role);
        }
Exemple #2
0
 protected override void OnBufferRead(BufferedReader <Lex, char> sender, Lex[] buffer)
 {
     for (int i = 0; i < roles.Count; i++)
     {
         LexRole role = roles[i];
         if (role.Validate(buffer))
         {
             break;
         }
     }
     base.OnBufferRead(sender, buffer);
 }
Exemple #3
0
        public LexCondition AddSingleConditionRole(string name, int startIndex = 0, char?lex = null, ElementType?type = null, Condition <Lex> .ValidateCallbackHandler callback = null)
        {
            LexCondition condition = new LexCondition {
                Content = lex, Type = type
            };

            if (callback != null)
            {
                condition.ValidateCallback += callback;
            }
            LexRole role = new LexRole(name, startIndex, condition);

            roles.Add(role);
            return(condition);
        }