private void work_in_twice_quotes(int twiceQuotesPos, int functionTextIndex, ref string findedIdentifier, ref bool finded, ref identifierVisibilityENUM identifierVisibility) { functionText.Remove(twiceQuotesPos, 1); while ((functionText[functionTextIndex] != '\"') && (functionText[functionTextIndex] != '$')) functionTextIndex++; if (functionText[functionTextIndex] == '\"') { functionText.Remove(0, functionTextIndex + 1); finded = false; } else { findedIdentifier = get_identifier(functionTextIndex, ref identifierVisibility); finded = true; } }
private bool findedIdentifierBOOL(ref string findedIdentifier,ref identifierVisibilityENUM identifierVisibility) { bool result = true; int functionTextIndex = 0; int dollarPos = functionText.ToString().IndexOf('$'); int quotesPos = functionText.ToString().IndexOf('\''); int twiceQuotesPos = functionText.ToString().IndexOf('\"'); int insideFunctionPos = functionText.ToString().IndexOf("function "); if ((insideFunctionPos < dollarPos) && (insideFunctionPos != -1)) { int functionEndIndex = CommonMethods.get_function_end_index(insideFunctionPos,functionText); functionText.Remove(insideFunctionPos,functionEndIndex - insideFunctionPos + 1); return false; } else if ((twiceQuotesPos < dollarPos) && (twiceQuotesPos != -1)) { work_in_twice_quotes(twiceQuotesPos, functionTextIndex, ref findedIdentifier, ref result, ref identifierVisibility); return result; } else if((quotesPos < dollarPos) && (quotesPos != -1)) { miss_quotes(quotesPos); return false; } else { findedIdentifier = get_identifier(dollarPos, ref identifierVisibility); return true; } }
private string get_identifier(int functionTextPos, ref identifierVisibilityENUM identifierVisibility) { string identifier = string.Empty; string globalsMassive = "$GLOBALS["; string globalVariable = "global"; int identifierLength; if (functionText.ToString().Substring(functionTextPos, 9) == globalsMassive) { identifierVisibility = identifierVisibilityENUM.GLOBALS; identifierLength = get_identifier_length(functionTextPos + globalsMassive.Length + 1); identifier = functionText.ToString().Substring(functionTextPos + globalsMassive.Length + 1,identifierLength); identifier = '$' + identifier; functionText.Remove(0, functionTextPos + globalsMassive.Length + 1 + identifierLength); } else { identifierLength = get_identifier_length(functionTextPos + 1); identifier = functionText.ToString().Substring(functionTextPos, identifierLength + 1); int textIndexOffset = 1; while ((functionTextPos - textIndexOffset > 0) && (functionText[functionTextPos - textIndexOffset] == ' ')) textIndexOffset++; if (functionTextPos - textIndexOffset - globalVariable.Length + 1 >= 0) if (functionText.ToString().Substring(functionTextPos - textIndexOffset - globalVariable.Length + 1, globalVariable.Length) == globalVariable) identifierVisibility = identifierVisibilityENUM.global; else identifierVisibility = identifierVisibilityENUM.local; else identifierVisibility = identifierVisibilityENUM.local; functionText.Remove(0, functionTextPos + identifierLength + 1); } return identifier; }