示例#1
0
        public virtual ITokenSource Edit(ITokenSource tokens)
        {
            CommonTokenStream s      = new CommonTokenStream(tokens);
            JsParser          parser = new JsParser(s);

            s.Fill();

            var program = parser.program();

            visitor.Visit(program, s.GetTokens());

            var source = new ListTokenSource(visitor.GetResult());

            source.TokenFactory = tokens.TokenFactory;
            return(source);
        }
示例#2
0
        public ITokenSource Edit(ITokenSource tokens)
        {
            CommonTokenStream s      = new CommonTokenStream(tokens);
            JsParser          parser = new JsParser(s);

            s.Fill();
            IVisitorTree v = new JsVisitorChangeLiteralString(factoryNames, tokens.TokenFactory);

            var program = parser.program();

            v.Visit(program, s.GetTokens());

            var source = new ListTokenSource(v.GetResult());

            source.TokenFactory = tokens.TokenFactory;
            return(source);
        }