MCPcopy Create free account
hub / github.com/csyonghe/Spire / CreateInputStreamForSource

Function CreateInputStreamForSource

Source/SpireCore/Preprocessor.cpp:193–204  ·  view source on GitHub ↗

Create an input stream to represent a pre-tokenized input file. TODO(tfoley): pre-tokenizing files isn't going to work in the long run.

Source from the content-addressed store, hash-verified

191// Create an input stream to represent a pre-tokenized input file.
192// TODO(tfoley): pre-tokenizing files isn't going to work in the long run.
193static PreprocessorInputStream* CreateInputStreamForSource(Preprocessor* preprocessor, CoreLib::String const& source, CoreLib::String const& fileName)
194{
195 SourceTextInputStream* inputStream = new SourceTextInputStream();
196 InitializeInputStream(preprocessor, inputStream);
197
198 // Use existing `Lexer` to generate a token stream.
199 Lexer lexer;
200 inputStream->lexedTokens = lexer.Parse(fileName, source, GetSink(preprocessor));
201 inputStream->tokenReader = TokenReader(inputStream->lexedTokens);
202
203 return inputStream;
204}
205
206
207

Callers 3

AdvanceTokenFunction · 0.85
HandleIncludeDirectiveFunction · 0.85
PreprocessSourceFunction · 0.85

Calls 4

InitializeInputStreamFunction · 0.85
GetSinkFunction · 0.85
TokenReaderClass · 0.70
ParseMethod · 0.45

Tested by

no test coverage detected