예제 #1
0
        public void ShouldParseBundleJs()
        {
            // It contains very diverse unicode regular expression

            var path   = Path.Combine(Fixtures.GetFixturesPath(), "Fixtures", "3rdparty", "bundle.js");
            var source = File.ReadAllText(path);
            var parser = new JavaScriptParser(source, new ParserOptions {
                AdaptRegexp = true
            });

            parser.ParseScript();
        }
예제 #2
0
        public void CanVisitFixtures(string fixture)
        {
            var    jsFilePath = Path.Combine(Fixtures.GetFixturesPath(), "Fixtures", fixture);
            Script program;

            try
            {
                var parser = new JavaScriptParser(File.ReadAllText(jsFilePath), new ParserOptions {
                    Tolerant = true
                });
                program = parser.ParseScript();
            }
            catch (ParserException)
            {
                // OK as we have invalid files to test against
                return;
            }

            var visitor = new AstVisitor();

            visitor.Visit(program);
        }