public XElement ComputeFeedbackRegexp(XElement regexCorrectDesc, XElement regexAttemptDesc, XElement alphabet, XElement feedbackLevel, XElement enabledFeedbacks, XElement maxGrade) { CharSetSolver solver = new CharSetSolver(BitWidth.BV64); try { var dfaCorrectPair = DFAUtilities.parseRegexFromXML(regexCorrectDesc, alphabet, solver); var dfaAttemptPair = DFAUtilities.parseRegexFromXML(regexAttemptDesc, alphabet, solver); var level = (FeedbackLevel)Enum.Parse(typeof(FeedbackLevel), feedbackLevel.Value, true); var enabList = (enabledFeedbacks.Value).Split(',').ToList <String>(); bool dfaedit = false, moseledit = false, density = true; int maxG = int.Parse(maxGrade.Value); var feedbackGrade = DFAGrading.GetGrade(dfaCorrectPair.Second, dfaAttemptPair.Second, dfaCorrectPair.First, solver, 1500, maxG, level, dfaedit, moseledit, density); var feedString = "<ul>"; foreach (var feed in feedbackGrade.Second) { feedString += string.Format("<li>{0}</li>", feed); } feedString += "</ul>"; return(XElement.Parse(string.Format("<div><grade>{0}</grade><feedback>{1}</feedback></div>", feedbackGrade.First, feedString))); } catch (PDLException pdlex) { return(XElement.Parse(string.Format("<div>Error: {0} </div>", pdlex.Message))); } }
public void ParseRegex() { try { CharSetSolver solver = new CharSetSolver(BitWidth.BV64); var al = new HashSet <char>(new char[] { 'a', 'b' }); DFAUtilities.parseRegexFromXML(XElement.Parse("<reg>-?</reg>"), XElement.Parse("<alphabet><symbol>a</symbol><symbol>b</symbol></alphabet>"), solver); } catch (PDLException e) { Console.WriteLine(e.Message); } }
public XElement CheckRegexp(XElement regexDesc, XElement alphabet) { CharSetSolver solver = new CharSetSolver(BitWidth.BV64); try { var dfaCorrectPair = DFAUtilities.parseRegexFromXML(regexDesc, alphabet, solver); return(XElement.Parse(string.Format("<div>CorrectRegex</div>"))); } catch (PDLException pdlex) { return(XElement.Parse(string.Format("<div>Error: {0} </div>", pdlex.Message))); } }