@@ -191,14 +191,14 @@ private ExcisionStats ProcessCodeFile(string fileName, string inputPath, EExcisi
191191 var inputStream = new AntlrInputStream ( script ) ;
192192 var lexer = excisionLanguage . CreateLexer ( inputStream ) ;
193193 lexer . AddErrorListener ( new ExcisionLexerErrorListener ( ) ) ;
194- var commonTokenStream = new CommonTokenStream ( lexer ) ;
194+ var commonTokenStream = new CommonTokenStream ( new Preprocessor ( lexer ) ) ;
195195 var parser = excisionLanguage . CreateParser ( commonTokenStream ) ;
196196
197197 IServerCodeVisitor ? visitor = null ;
198198 if ( excisionMode == EExcisionMode . Full )
199199 {
200- injections . Add ( 0 , excisionLanguage . ServerScopeStartString ) ;
201- injections . Add ( script . Length , excisionLanguage . ServerScopeEndString ) ;
200+ injections . Add ( 0 , new Marker ( "A" , true ) ) ;
201+ injections . Add ( script . Length , new Marker ( "A" , false ) ) ;
202202 }
203203 else if ( excisionMode == EExcisionMode . AllFunctions )
204204 {
@@ -232,16 +232,8 @@ private ExcisionStats ProcessCodeFile(string fileName, string inputPath, EExcisi
232232 // First process all server only scopes.
233233 foreach ( ServerOnlyScopeData currentScope in visitor . DetectedServerOnlyScopes )
234234 {
235- if ( string . IsNullOrEmpty ( currentScope . Context ) )
236- {
237- injections . Add ( currentScope . StartLine , excisionLanguage . ServerScopeStartString ) ;
238- injections . Add ( currentScope . StopLine , excisionLanguage . ServerScopeEndString ) ;
239- }
240- else
241- {
242- injections . Add ( currentScope . StartLine , excisionLanguage . ServerScopeStartString + $ " // { currentScope . Context } ") ;
243- injections . Add ( currentScope . StopLine , excisionLanguage . ServerScopeEndString + $ " // { currentScope . Context } ") ;
244- }
235+ injections . Add ( currentScope . StartLine , new Marker ( currentScope . Context , true ) ) ;
236+ injections . Add ( currentScope . StopLine , new Marker ( currentScope . Context , false , currentScope . Opt_ElseContent ) ) ;
245237 }
246238 }
247239
@@ -258,7 +250,7 @@ private ExcisionStats ProcessCodeFile(string fileName, string inputPath, EExcisi
258250
259251 foreach ( var text in injections . Get ( lineIndex ) )
260252 {
261- builder . AddLine ( text ) ;
253+ text . Write ( builder ) ;
262254 }
263255
264256 if ( line . Contains ( "UEmbarkServerEventsSubsystem::Get()" ) && ! builder . IsInScope ( "WITH_SERVER" ) )
@@ -308,3 +300,5 @@ private ExcisionStats ProcessCodeFile(string fileName, string inputPath, EExcisi
308300 }
309301 }
310302}
303+
304+
0 commit comments