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); }
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); }