public static bool HideAnonymousFunctions(Hierarchy <CodeNode> hierachy, JavascriptParserSettings settings) { if (settings.SkipAnonymousFuntions) { if (hierachy.HasChildren) { hierachy.Children.RemoveAll(child => HideAnonymousFunctions(child, settings)); } if (hierachy.HasChildren) { return(false); } if (hierachy.Item.NodeType == CodeNodeType.AnonymousFunction) { return(true); } } return(false); }
public static bool HideAnonymousFunctions(Hierarchy<CodeNode> hierachy, JavascriptParserSettings settings) { if (settings.SkipAnonymousFuntions) { if (hierachy.HasChildren) { hierachy.Children.RemoveAll(child => HideAnonymousFunctions(child, settings)); } if (hierachy.HasChildren) { return false; } if (hierachy.Item.NodeType == CodeNodeType.AnonymousFunction) { return true; } } return false; }
public JSParserResult Process(ICodeProvider codeProvider, bool skipHashCheck = false) { Code = codeProvider; string docName = Path.Combine(Code.Path, Code.Name); if (!CheckExt(docName)) { return null; } var code = Code.LoadCode(); var hash = Convert.ToBase64String(MD5.Create().ComputeHash(Encoding.Default.GetBytes(code))); if (!skipHashCheck && _loadedCodeHash == hash) { return new JSParserResult(); } _loadedCodeHash = hash; var parserSettings = new JavascriptParserSettings { MaxParametersLength = _settings.MaxParametersLength, MaxParametersLengthInFunctionChain = _settings.MaxParametersLengthInFunctionChain, SkipAnonymousFuntions = _settings.HideAnonymousFunctions, Filename = docName, ScriptStripEnabled = _settings.ScriptStripEnabled, ScriptStripExtensions = _settings.ScriptStripExtensions.OfType<string>().ToArray(), ToDoKeyWords = _settings.ToDoKeywords.OfType<string>().ToArray(), FixAspNetTags = _settings.FixAspNetTags, FixAspNetTagsExtensions = _settings.FixAspNetTagsExtensions.OfType<string>().ToArray(), FixRazorSyntax = _settings.FixRazorSyntax, FixRazorSyntaxExtensions = _settings.FixRazorSyntaxExtensions.OfType<string>().ToArray(), }; var result = (new JavascriptParser(parserSettings)).Parse(code); result.FileName = docName; return result; }
public JavascriptStructureParserV2(JavascriptParserSettings settings) { _settings = settings; }
public JavascriptParser(JavascriptParserSettings settings) { _settings = settings; }