ProfNode ParseRegex() { ProfNode root = null; while (true) { ProfNode exp = ParseConcatExp(); if (exp == null) { return(exp); } if (root == null) { root = exp; } else { root = new ProfNode('|', root, exp); } if (_cursor.Current == '|') { _cursor.Next(); } else { return(root); } } }
ProfNode ParseCharExp() { if (!char.IsLetterOrDigit(_cursor.Current)) { return(null); } ProfNode node = new ProfNode(_cursor.Current, null, null); return(node); }
public ProfNode Parse() { ProfNode exp = ParseRegex(); if (exp == null) { return(null); } if (_cursor.Current == 0) { return(null); } return(null); }
ProfNode ParseStartExp() { ProfNode exp = ParseStarizableExp(); if (exp == null) { return(null); } if (_cursor.Current == '*') { exp = new ProfNode('*', exp); } return(exp); }
ProfNode ParseParenthesisExp() { if (_cursor.Current != '(') { return(null); } _cursor.Next(); ProfNode exp = ParseRegex(); if (_cursor.Current != ')') { return(null); } _cursor.Next(); return(exp); }
ProfNode ParseConcatExp() { ProfNode root = null; do { ProfNode exp = ParseStartExp(); if (root == null) { root = exp; } else { root = new ProfNode('+', root, exp); } if (exp == null) { return(null); } } while (_cursor.Current == '(' || char.IsLetterOrDigit(_cursor.Current)); return(root); }
public ProfNode(char symbol, ProfNode left) : this(symbol, left, null) { }
public ProfNode(char symbol, ProfNode left, ProfNode right) { _symbol = symbol; _left = left; _right = right; }