public Match_SharpKit Match(string input, int start) { input = input.Substring(start); JsRegExpResult result = m_JSRegex.exec(input); Match_SharpKit ret = new Match_SharpKit(result); return(ret); }
private void resolveParentClassFromDefinition(JsString qualifiedClassName, JsString classDefinition) { //\$Inherit\(net.digitalprimates.service.LabelService,([\w\W]*?)\) JsString inheritString = @"\$Inherit\("; inheritString += qualifiedClassName; inheritString += @",\s*(.*?)\)"; JsRegExpResult inheritResult = classDefinition.match(inheritString); //Do we inherit from anything? if (inheritResult != null) { //Resolve the parent class first resolveClassName(inheritResult[1]); } }
void parseResult(JsString responseText) { //get each line JsRegExp eachLine = new JsRegExp(@"[\w\W]+?[\n\r]+", "g"); JsRegExpResult eachLineResult = responseText.match(eachLine); this.fileLoaded = true; if (eachLineResult != null) { for (int i = 0; i < eachLineResult.length; i++) { parseLine(eachLineResult[i]); } } }
void parseLine(JsString line) { if (line.length == 0) { //empty line, bail return; } JsRegExp isComment = new JsRegExp(@"^[#!]"); JsRegExpResult isCommentResult = line.match(isComment); if (isCommentResult != null) { //its a comment, bail return; } JsRegExp tokenize = new JsRegExp(@"^(\w+)\s?=\s?([\w\W]+?)[\n\r]+"); JsRegExpResult tokenizeResult = line.match(tokenize); JsString key; JsString strValue; dynamic value; if (tokenizeResult != null && tokenizeResult.length == 3) { key = tokenizeResult[1]; value = tokenizeResult[2]; strValue = value; if (strValue.indexOf(",") != -1) { //this is an array, tokenize it value = strValue.split(','); } keyValuePairs[key] = value; } }
public Match_SharpKit(JsRegExpResult res) { m_JSResult = res; }