public RegexNodeAlternation(RegexNode expression1, RegexNode expression2) { if (expression1 == null || expression2 == null) { throw new ArgumentNullException(string.Empty, "Expressions cannot be null"); } expressions = new[] { expression1, expression2 }; }
public static RegexNode Add(RegexNode node1, RegexNode node2) { if (node1 == null || node2 == null) { throw new ArgumentException("Both nodes must be not null."); } RegexNodeConcatenation node1AsConcatenation = node1 as RegexNodeConcatenation; RegexNodeConcatenation node2AsConcatenation = node2 as RegexNodeConcatenation; if (node1AsConcatenation != null && node2AsConcatenation != null) { List<RegexNode> newChildNodes = new List<RegexNode>(); newChildNodes.AddRange(node1AsConcatenation.ChildNodes); newChildNodes.AddRange(node2AsConcatenation.ChildNodes); RegexNodeConcatenation result = new RegexNodeConcatenation(newChildNodes); return result; } if (node1AsConcatenation != null) { List<RegexNode> newChildNodes = new List<RegexNode>(node1AsConcatenation.ChildNodes); newChildNodes.Add(node2); RegexNodeConcatenation result = new RegexNodeConcatenation(newChildNodes); return result; } if (node2AsConcatenation != null) { List<RegexNode> newChildNodes = new List<RegexNode>(); newChildNodes.Add(node1); newChildNodes.AddRange(node2AsConcatenation.ChildNodes); RegexNodeConcatenation result = new RegexNodeConcatenation(newChildNodes); return result; } return new RegexNodeConcatenation(node1, node2); }
public RegexNodeConditionalMatch(string conditionGroupName, RegexNode trueMatchExpression, RegexNode falseMatchExpression) { ConditionGroupName = conditionGroupName; TrueMatchExpression = trueMatchExpression; FalseMatchExpression = falseMatchExpression; }
public RegexNodeConditionalMatch(RegexNode conditionExpression, RegexNode trueMatchExpression, RegexNode falseMatchExpression) { ConditionExpression = conditionExpression; TrueMatchExpression = trueMatchExpression; FalseMatchExpression = falseMatchExpression; }
public RegexNodeLookAround(RegexLookAround lookAroundType, RegexNode lookAroundExpression, RegexNode matchExpression) { LookAroundType = lookAroundType; LookAroundExpression = lookAroundExpression; MatchExpression = matchExpression; }
public RegexNodeBacktrackingSuppression(RegexNode innerExpression) { InnerExpression = innerExpression; }
public RegexNodeGroup(RegexNode innerExpression, string name) { InnerExpression = innerExpression; IsCapturing = true; Name = name; }
public RegexNodeGroup(RegexNode innerExpression, bool isCapturing) { InnerExpression = innerExpression; IsCapturing = isCapturing; }
public RegexNodeGroup(RegexNode innerExpression) { InnerExpression = innerExpression; IsCapturing = true; }