Take a string of source code and preprocess it into a list of tokens.
| 1816 | |
| 1817 | // Take a string of source code and preprocess it into a list of tokens. |
| 1818 | TokenList PreprocessSource( |
| 1819 | CoreLib::String const& source, |
| 1820 | CoreLib::String const& fileName, |
| 1821 | DiagnosticSink* sink, |
| 1822 | IncludeHandler* includeHandler) |
| 1823 | { |
| 1824 | Preprocessor preprocessor; |
| 1825 | InitializePreprocessor(&preprocessor, sink); |
| 1826 | |
| 1827 | preprocessor.includeHandler = includeHandler; |
| 1828 | |
| 1829 | // create an initial input stream based on the provided buffer |
| 1830 | preprocessor.inputStream = CreateInputStreamForSource(&preprocessor, source, fileName); |
| 1831 | |
| 1832 | TokenList tokens = ReadAllTokens(&preprocessor); |
| 1833 | |
| 1834 | FinalizePreprocessor(&preprocessor); |
| 1835 | |
| 1836 | return tokens; |
| 1837 | } |
| 1838 | |
| 1839 | TokenList PreprocessSource( |
| 1840 | CoreLib::String const& source, |
no test coverage detected