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); }
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); }
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); }