예제 #1
0
        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);
        }
예제 #2
0
        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;
        }
예제 #3
0
        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;
        }
예제 #4
0
 public JavascriptStructureParserV2(JavascriptParserSettings settings)
 {
     _settings = settings;
 }
 public JavascriptStructureParserV2(JavascriptParserSettings settings)
 {
     _settings = settings;
 }
예제 #6
0
 public JavascriptParser(JavascriptParserSettings settings)
 {
     _settings = settings;
 }
예제 #7
0
 public JavascriptParser(JavascriptParserSettings settings)
 {
     _settings = settings;
 }