private static List<TokenWithSpan> ReadTokens(string code, bool collectWarnings, params ErrorInfo[] errors) { CollectingErrorSink errorSink = new CollectingErrorSink(collectWarnings); var scanner = new JSScanner(code, errorSink, new CodeSettings() { AllowShebangLine = true }); var tokens = scanner.ReadTokens(Int32.MaxValue); errorSink.CheckErrors(errors); return tokens; }
private static List<TokenWithSpan> ScanTokens(string code, bool collectWarnings, params ErrorInfo[] errors) { CollectingErrorSink errorSink = new CollectingErrorSink(collectWarnings); var scanner = new JSScanner(code, errorSink, new CodeSettings() { AllowShebangLine = true }); List<TokenWithSpan> tokens = new List<TokenWithSpan>(); for (TokenWithSpan curToken = scanner.ScanNextTokenWithSpan(true); curToken.Token != JSToken.EndOfFile; curToken = scanner.ScanNextTokenWithSpan(true)) { tokens.Add(curToken); } errorSink.CheckErrors(errors); return tokens; }