001/*license*\
002   Codelet: Copyright (C) 2014, Jeff Epstein (aliteralmind __DASH__ github __AT__ yahoo __DOT__ com)
003
004   This software is dual-licensed under the:
005   - Lesser General Public License (LGPL) version 3.0 or, at your option, any later version;
006   - Apache Software License (ASL) version 2.0.
007
008   Either license may be applied at your discretion. More information may be found at
009   - http://en.wikipedia.org/wiki/Multi-licensing.
010
011   The text of both licenses is available in the root directory of this project, under the names "LICENSE_lgpl-3.0.txt" and "LICENSE_asl-2.0.txt". The latest copies may be downloaded at:
012   - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt
013   - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
014\*license*/
015package  com.github.aliteralmind.codelet;
016   import  com.github.xbn.linefilter.entity.EntityRequired;
017   import  com.github.xbn.linefilter.entity.OutOfRangeResponseWhen;
018   import  com.github.xbn.linefilter.entity.OnOffAbort;
019   import  com.github.xbn.number.NewLengthInRangeFor;
020   import  com.github.xbn.linefilter.entity.PostFilterSelfActiveInOutRange;
021   import  com.github.aliteralmind.codelet.CodeletInstance;
022   import  com.github.xbn.analyze.validate.NewValidResultFilterFor;
023   import  com.github.xbn.analyze.validate.ValidResultFilter;
024   import  com.github.xbn.lang.IllegalArgumentStateException;
025   import  com.github.xbn.linefilter.FilteredLineIterator;
026   import  com.github.xbn.linefilter.KeepUnmatched;
027   import  com.github.xbn.linefilter.Returns;
028   import  com.github.xbn.linefilter.entity.BlockEntity;
029   import  com.github.xbn.util.IncludeJavaDoc;
030   import  com.github.xbn.linefilter.entity.KeepMatched;
031   import  com.github.xbn.linefilter.entity.NewBlockEntityFor;
032   import  com.github.xbn.linefilter.entity.NewSingleLineEntityFor;
033   import  com.github.xbn.linefilter.entity.SingleLineEntity;
034   import  com.github.xbn.linefilter.entity.TextChildEntity;
035   import  com.github.xbn.number.LengthInRange;
036   import  com.github.xbn.regexutil.NewPatternFor;
037   import  com.github.xbn.regexutil.ReplacedInEachInput;
038   import  com.github.xbn.text.CrashIfString;
039   import  com.github.xbn.util.JavaRegexes;
040   import  java.util.ArrayList;
041   import  java.util.List;
042   import  java.util.regex.Pattern;
043   import  java.util.regex.PatternSyntaxException;
044   import  static com.github.aliteralmind.codelet.CodeletBaseConfig.*;
045/**
046   <p>Convenience functions for creating line filters tailored for codelets.</p>
047
048   @see  com.github.xbn.linefilter.FilteredLineIterator
049 * @since  0.1.0
050 * @author  Copyright (C) 2014, Jeff Epstein ({@code aliteralmind __DASH__ github __AT__ yahoo __DOT__ com}), dual-licensed under the LGPL (version 3.0 or later) or the ASL (version 2.0). See source code for details. <a href="http://codelet.aliteralmind.com">{@code http://codelet.aliteralmind.com}</a>, <a href="https://github.com/aliteralmind/codelet">{@code https://github.com/aliteralmind/codelet}</a>
051 **/
052public class NewLineFilterFor  {
053   /**
054      <p>Eliminates all multi-line comments, including the license and JavaDoc blocks.</p>
055
056    * @return  <code>{@link #eliminateAllCmtBlocksAndPackageLine(boolean, Appendable, Appendable, boolean, Appendable, Appendable) eliminateAllCmtBlocksAndPackageLine}(false, null, null, true, dbgJavaMlcs_ifNotNull, dbgAllLines_ifNonNull)</code>
057    */
058   public static final FilteredLineIterator eliminateAllMultiLineComments(Appendable dbgJavaMlcs_ifNotNull, Appendable dbgAllLines_ifNonNull)  {
059      return  eliminateAllCmtBlocksAndPackageLine(false, null, null, true, dbgJavaMlcs_ifNotNull, dbgAllLines_ifNonNull);
060   }
061   /**
062      <p>Eliminates the package declaration line.</p>
063
064    * @return  <code>{@link #eliminateAllCmtBlocksAndPackageLine(boolean, Appendable, Appendable, boolean, Appendable, Appendable) eliminateAllCmtBlocksAndPackageLine}(true, dbgPkgLnValidFilter_ifNonNull, dbgPkgLnVldtr_ifNonNull, false, null, dbgAllLines_ifNonNull)</code>
065    */
066   public static final FilteredLineIterator eliminatePackageLine(Appendable dbgPkgLnValidFilter_ifNonNull, Appendable dbgPkgLnVldtr_ifNonNull, Appendable dbgAllLines_ifNonNull)  {
067      return  eliminateAllCmtBlocksAndPackageLine(true, dbgPkgLnValidFilter_ifNonNull, dbgPkgLnVldtr_ifNonNull, false, null, dbgAllLines_ifNonNull);
068   }
069
070   /**
071      <p>Eliminates the package declaration line and all multi-line comment blocks.</p>
072
073    * @param  doDelete_pkgDecl  If {@code true}, the package declaration line is eliminated. If {@code false}, the alterer is not created ({@code line()} is not called, and both {@code dbgPkgLnValidFilter_ifNonNull} and {@code dbgPkgLnVldtr_ifNonNull} are ignored). At least one boolean parameter must be {@code true}.
074    * @param  doElim_multiLineCmts  If {@code true}, all multi-line comments are deleted. If {@code false}, {@code allJavaMultiLineComments} is not called (and {@code dbgJavaMlcs_ifNotNull} is ignored). Warning: This eliminates <i>entire lines</i>, including any text that happens to be outside of the block:
075      <br/> &nbsp; &nbsp; <code>This text will also be eliminated  /&#42; The start of a comment...</code>)
076    * @see  #eliminateAllCmtBlocksAndPackageLine(CodeletInstance, String, boolean, boolean) eliminateAllCmtBlocksAndPackageLine(CodeletInstance, String, *)
077    * @see  #eliminateAllMultiLineComments(Appendable, Appendable) eliminateAllMultiLineComments
078    * @see  #eliminatePackageLine(Appendable, Appendable, Appendable) eliminatePackageLine
079    */
080   public static final FilteredLineIterator eliminateAllCmtBlocksAndPackageLine(boolean doDelete_pkgDecl, Appendable dbgPkgLnValidFilter_ifNonNull, Appendable dbgPkgLnVldtr_ifNonNull, boolean doElim_multiLineCmts, Appendable dbgJavaMlcs_ifNotNull, Appendable dbgAllLines_ifNonNull)  {
081/*
082      if(!doElim_multiLineCmts  &&  !doDelete_pkgDecl)  {
083         throw  new IllegalArgumentStateException("doElim_multiLineCmts and doDelete_pkgDecl and both false. Nothing to do.");
084      }
085 */
086      List<TextChildEntity> childList = new ArrayList<TextChildEntity>(3);
087
088      if(doDelete_pkgDecl)  {
089         PostFilterSelfActiveInOutRange onOffFilter = new PostFilterSelfActiveInOutRange(
090            NewLengthInRangeFor.maxInclusive(null, 0, null),
091            OnOffAbort.ON, OnOffAbort.OFF,
092            OutOfRangeResponseWhen.IMMEDIATE,
093            null);     //debug
094
095         SingleLineEntity pkgDeclLineEntity = NewSingleLineEntityFor.match(
096            "pkgdecl", KeepMatched.NO, EntityRequired.YES,
097            Pattern.compile(JavaRegexes.PACKAGE_DECL_ONE_LINE_NO_CMTS),
098            null,      //dbgAlter (on:System.out, off:null)
099            onOffFilter,
100            null);     //dbgLineNums
101         childList.add(pkgDeclLineEntity);
102      }
103
104      if(doElim_multiLineCmts)  {
105         BlockEntity javaMlcBlock = NewBlockEntityFor.javaComment_Cfg(
106            "comment", EntityRequired.YES, IncludeJavaDoc.YES,
107            null,      //dbgStart
108            null,      //dbgEnd
109            null,
110            null).     //dbgLineNums
111               keepNone().build();
112         childList.add(javaMlcBlock);
113      }
114
115      if(childList.size() == 0)  {
116         throw  new IllegalArgumentStateException("doElim_multiLineCmts and doDelete_pkgDecl and both false. Nothing to do.");
117      }
118
119      return  new FilteredLineIterator(
120         null, Returns.KEPT, KeepUnmatched.YES,
121         null, null,    //dbgEveryLine and its line-range
122         childList.toArray(new TextChildEntity[childList.size()]));
123   }
124   /**
125      <p>Create a new eliminate-comment-blocks-and-package-line filter with named debuggers.</p>
126
127      <p>{@linkplain com.github.aliteralmind.codelet.CodeletBootstrap#NAMED_DEBUGGERS_CONFIG_FILE Named debuggers} provided to the following {@link #eliminateAllCmtBlocksAndPackageLine(boolean, Appendable, Appendable, boolean, Appendable, Appendable) eliminateAllCmtBlocksAndPackageLine} parameters:<ul>
128         <li><code><i>[named_debugPrefix]</i>.filter</code>: {@code dbgAllLines_ifNonNull}<ul>
129            <li>{@code .packageline}: {@code dbgPkgLnValidFilter_ifNonNull}</li>
130            <li>{@code .packageline.validfilter}: {@code dbgPkgLnVldtr_ifNonNull}</li>
131            <li>{@code .javamlcs}: {@code dbgJavaMlcs_ifNotNull}</li>
132         </ul></li>
133      </ul>All of which must be added to the named-debug-level configuration file:</p>
134
135<blockquote><pre>PREFIX.filter=-1
136PREFIX.filter.packageline=-1
137PREFIX.filter.packageline.validfilter=-1
138PREFIX.filter.javamlcs=-1</pre></blockquote>
139
140    * @param  instance  For determining the current {@linkplain com.github.aliteralmind.codelet.CodeletBaseConfig#getDebugApblIfOn(CodeletInstance, String) debugging level}.
141    * @param  named_debugPrefix  Prepended to all named debuggers. May not be {@code null} or empty.
142    */
143   public static final FilteredLineIterator eliminateAllCmtBlocksAndPackageLine(CodeletInstance instance, String named_debugPrefix, boolean doDelete_pkgDecl, boolean doElim_multiLineCmts)  {
144      CrashIfString.nullEmpty(named_debugPrefix, "named_debugPrefix", null);
145      String prefixFltr = named_debugPrefix + ".filter";
146      Appendable dbgPackageLine = getDebugApblIfOn(instance,
147         prefixFltr + ".packageline");
148      Appendable dbgPackageLineValidFltr = getDebugApblIfOn(instance,
149         prefixFltr + ".packageline.validfilter");
150      Appendable dbgMlcBlkStartEnd = getDebugApblIfOn(instance,
151         prefixFltr + ".javamlcs");
152      Appendable dbgFilter = getDebugApblIfOn(instance, prefixFltr + ".alllines");
153
154      return    eliminateAllCmtBlocksAndPackageLine(doDelete_pkgDecl,
155            dbgPackageLine,           //dbgPkgLnValidFilter_ifNonNull
156            dbgPackageLineValidFltr,  //dbgPkgLnVldtr_ifNonNull
157         doElim_multiLineCmts,
158            dbgMlcBlkStartEnd,        //dbgJavaMlcs_ifNotNull
159            dbgFilter);               //dbgAllLines_ifNonNull
160   }
161   /**
162      <p><i>A code snippet:</i> Keeps all lines in a specific range, based on the text existing in the first and last lines.</p>
163
164    * @param  startAppearance_num  If the start-line search term is found on multiple lines, this is the desired occurance (if two, the second line the term is found on).
165    * @param  is_startLineRegex  If {@code true} {@code startLine_findWhat} is treated as a regular expression. If {@code false}, literal.
166    * @param  startLine_findWhat  The start-line search term. This is the text or pattern that exists in the first line that should be kept. May not be {@code null} or empty.
167    * @param  endAppearance_num  If the end-line search term is found on multiple lines, this is the desired occurance. This is the appearance of the term <i>in the entire document</i>, including any appearances before the start line.
168    * @param  is_endLineRegex  If {@code true} {@code startLine_findWhat} is treated as a regular expression.
169    * @param  endLine_findWhat  The start-line search term.
170    * @return
171<blockquote><pre>new {@link com.github.xbn.linefilter.FilteredLineIterator#FilteredLineIterator(Iterator, Returns, KeepUnmatched, Appendable, LengthInRange, TextChildEntity...) FilteredLineIterator}(
172   null, {@link com.github.xbn.linefilter.Returns}.{@link com.github.xbn.linefilter.Returns#KEPT KEPT}, {@link com.github.xbn.linefilter.KeepUnmatched}.{@link com.github.xbn.linefilter.KeepUnmatched#NO NO},
173   dbgAllLines_ifNonNull, rangeForEveryLineDebug_ifNonNull,
174   snippetBlock)</pre></blockquote>
175      Where {@code snippetBlock} is a
176<blockquote><pre>
177{@link com.github.xbn.linefilter.entity.NewBlockEntityFor}.{@link com.github.xbn.linefilter.entity.NewBlockEntityFor#lineRange(String, KeepMatched, EntityRequired, Pattern, ValidResultFilter, Appendable, Pattern, ValidResultFilter, Appendable, RawOnOffEntityFilter, Appendable) lineRange}(&quot;lineRange&quot;,
178   {@link com.github.xbn.linefilter.entity.KeepMatched}.{@link com.github.xbn.linefilter.entity.KeepMatched#YES YES},
179   startLinePattern, startAppearanceFilter, dbgStart_ifNonNull,
180   endLinePattern, endAppearanceFilter, dbgEnd_ifNonNull,
181   {@link com.github.xbn.linefilter.entity.EntityRequired}.{@link com.github.xbn.linefilter.entity.EntityRequired#YES YES}, null, dbgLineNums_ifNonNull)</pre></blockquote>
182      and {@code startAppearanceFilter} is a
183<blockquote><pre>{@link com.github.xbn.analyze.validate.NewValidResultFilterFor}.{@link com.github.xbn.analyze.validate.NewValidResultFilterFor#exactly(int, String, Appendable) exactly}(
184   startAppearance_num, ..., dbgStartFilter_ifNonNull)</pre></blockquote>
185    * @see  #lineRange(CodeletInstance, String, int, boolean, String, int, boolean, String) lineRange(CodeletInstance, ...)
186    * @see  #lineRangeWithReplace(int, boolean, String, String, ReplacedInEachInput, Appendable, Appendable, int, boolean, String, String, ReplacedInEachInput, Appendable, Appendable, Appendable, Appendable, LengthInRange) lineRangeWithReplace
187    */
188   public static final FilteredLineIterator lineRange(int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, Appendable dbgStartFilter_ifNonNull, Appendable dbgStart_ifNonNull, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat, Appendable dbgEndFilter_ifNonNull, Appendable dbgEnd_ifNonNull, Appendable dbgLineNums_ifNonNull, Appendable dbgAllLines_ifNonNull, LengthInRange rangeForEveryLineDebug_ifNonNull) throws PatternSyntaxException  {
189      Pattern startLinePattern = NewPatternFor.regexIfTrueLiteralIfFalse(is_startLineRegex, startLine_findWhat, "startLine_findWhat");
190      Pattern endLinePattern = NewPatternFor.regexIfTrueLiteralIfFalse(is_endLineRegex, endLine_findWhat, "endLine_findWhat");
191
192      ValidResultFilter startAppearanceFilter = NewValidResultFilterFor.exactly(
193         startAppearance_num, "startAppearance_num",
194         dbgStartFilter_ifNonNull);
195      ValidResultFilter endAppearanceFilter = NewValidResultFilterFor.exactly(
196         endAppearance_num, "endAppearance_num",
197         dbgEndFilter_ifNonNull);
198
199      BlockEntity snippetBlock = NewBlockEntityFor.lineRange("lineRange",
200         KeepMatched.YES, EntityRequired.YES,
201         startLinePattern, startAppearanceFilter, dbgStart_ifNonNull,
202         endLinePattern, endAppearanceFilter, dbgEnd_ifNonNull,
203         null, dbgLineNums_ifNonNull);
204
205      return  new FilteredLineIterator(
206         null, Returns.KEPT, KeepUnmatched.NO,
207         dbgAllLines_ifNonNull, rangeForEveryLineDebug_ifNonNull,
208         snippetBlock);
209   }
210   /**
211      <p>Create a new line-range filter with named debuggers.</p>
212
213      <p>{@linkplain com.github.aliteralmind.codelet.CodeletBootstrap#NAMED_DEBUGGERS_CONFIG_FILE Named debuggers} provided to the following {@link #lineRange(int, boolean, String, Appendable, Appendable, int, boolean, String, Appendable, Appendable, Appendable, Appendable, LengthInRange) lineRange} parameters:<ul>
214         <li><code><i>[named_debugPrefix]</i>.filter</code><ul>
215            <li>{@code .blockstart}: {@code dbgStart_ifNonNull}</li>
216            <li>{@code .blockstart.validfilter}: {@code dbgStartFilter_ifNonNull}</li>
217            <li>{@code .blockend}: {@code dbgEnd_ifNonNull}</li>
218            <li>{@code .blockend.validfilter}: {@code dbgEndFilter_ifNonNull}</li>
219            <li>{@code .linenums}: {@code dbgLineNums_ifNonNull}</li>
220            <li>{@code .alllines}: {@code dbgAllLines_ifNonNull}</li>
221         </ul></li>
222      </ul>All of which must be added to the named-debug-level configuration file:</p>
223
224<blockquote><pre>PREFIX.filter.alllines=-1
225PREFIX.filter.blockend.validfilter=-1
226PREFIX.filter.blockend=-1
227PREFIX.filter.blockstart.validfilter=-1
228PREFIX.filter.blockstart=-1
229PREFIX.filter.linenums=-1</pre></blockquote>
230
231    * @param  instance  For determining the current {@linkplain com.github.aliteralmind.codelet.CodeletBaseConfig#getDebugApblIfOn(CodeletInstance, String) debugging level}.
232    * @param  named_debugPrefix  Prepended to all named debuggers. May not be {@code null} or empty.
233    */
234   public static final FilteredLineIterator lineRange(CodeletInstance instance, String named_debugPrefix, int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat) throws PatternSyntaxException  {
235      CrashIfString.nullEmpty(named_debugPrefix, "named_debugPrefix", null);
236      String prefixFltr = named_debugPrefix + ".filter";
237      Appendable dbgBlkStart = getDebugApblIfOn(instance,
238         prefixFltr + ".blockstart");
239      Appendable dbgBlkStartValidFltr = getDebugApblIfOn(instance,
240         prefixFltr + ".blockstart.validfilter");
241      Appendable dbgBlkEnd = getDebugApblIfOn(instance,
242         prefixFltr + ".blockend");
243      Appendable dbgBlkEndValidFltr = getDebugApblIfOn(instance,
244         prefixFltr + ".blockend.validfilter");
245      Appendable dbgLineNums = getDebugApblIfOn(instance,
246         prefixFltr + ".linenums");
247      Appendable dbgAllLines = getDebugApblIfOn(instance,
248         prefixFltr + ".alllines");
249
250      return  lineRange(
251         startAppearance_num, is_startLineRegex, startLine_findWhat,
252            dbgBlkStartValidFltr, dbgBlkStart,
253         endAppearance_num, is_endLineRegex, endLine_findWhat,
254            dbgBlkEndValidFltr, dbgBlkEnd, dbgLineNums, dbgAllLines, null);
255   }
256   /**
257      <p>Keeps all lines in a specific range, based on the text existing in the first and last lines, making a replacement on the first and last lines only. This is useful when lines must be marked, but those marks should not be seen in the final output.</p>
258
259      <p>For documentation on all other parameters, see {@link #lineRange(int, boolean, String, Appendable, Appendable, int, boolean, String, Appendable, Appendable, Appendable, Appendable, LengthInRange) lineRange}.</p>
260
261    * @param  startLine_rplcWith  The replacement term for the start-line search term ({@code startLine_findWhat}). May not be {@code null} or empty.
262    * @param  startRplcs_notMtchNum  In most cases, this should be set to {@code "FIRST"}. See <code>com.github.xbn.regexutil.{@link com.github.xbn.regexutil.ReplacedInEachInput}</code>.
263    * @param  endLine_rplcWith  The replacement term for the end-line search term ({@code endLine_findWhat}).
264    * @param  endRplcs_notMtchNum  In most cases, this should be set to {@code "FIRST"}.
265    * @return  The same as {@link #lineRange(CodeletInstance, String, int, boolean, String, int, boolean, String) lineRange}, with this alternative block entity:
266<blockquote><pre>{@link com.github.xbn.linefilter.entity.NewBlockEntityFor}.{@link com.github.xbn.linefilter.entity.NewBlockEntityFor#lineRangeWithReplace(String, KeepStartLine, KeepMidLines, KeepEndLine, EntityRequired, Pattern, String, ReplacedInEachInput, ValidResultFilter, Appendable, ValueAlterer, Pattern, String, ReplacedInEachInput, ValidResultFilter, Appendable, RawOnOffEntityFilter, Appendable) lineRangeWithReplace}(
267   &quot;lineRangeWithReplace&quot;, {@link com.github.xbn.linefilter.entity.KeepMatched}.{@link com.github.xbn.linefilter.entity.KeepMatched#YES YES},
268   startLinePattern, startLine_rplcWith, startRplcs_notMtchNum, startAppearanceFilter,
269      dbgStartRplcr_ifNonNull,
270   null,         //No mid alterer
271   endLinePattern, endLine_rplcWith, endRplcs_notMtchNum, endAppearanceFilter,
272      dbgEndRplcr_ifNonNull,
273   {@link com.github.xbn.linefilter.entity.EntityRequired}.{@link com.github.xbn.linefilter.entity.EntityRequired#YES YES}, null, dbgLineNums_ifNonNull)</pre></blockquote>
274    */
275   public static final FilteredLineIterator lineRangeWithReplace(int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, String startLine_rplcWith, ReplacedInEachInput startRplcs_notMtchNum, Appendable dbgStartFilter_ifNonNull, Appendable dbgStartRplcr_ifNonNull, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat, String endLine_rplcWith, ReplacedInEachInput endRplcs_notMtchNum, Appendable dbgEndFilter_ifNonNull, Appendable dbgEndRplcr_ifNonNull, Appendable dbgLineNums_ifNonNull, Appendable dbgAllLines_ifNonNull, LengthInRange rangeForEveryLineDebug_ifNonNull) throws PatternSyntaxException  {
276      Pattern startLinePattern = NewPatternFor.regexIfTrueLiteralIfFalse(is_startLineRegex, startLine_findWhat, "startLine_findWhat");
277      Pattern endLinePattern = NewPatternFor.regexIfTrueLiteralIfFalse(is_endLineRegex, endLine_findWhat, "endLine_findWhat");
278
279      ValidResultFilter startAppearanceFilter = NewValidResultFilterFor.exactly(
280         startAppearance_num, "startAppearance_num",
281         dbgStartFilter_ifNonNull);
282      ValidResultFilter endAppearanceFilter = NewValidResultFilterFor.exactly(
283         endAppearance_num, "endAppearance_num",
284         dbgEndFilter_ifNonNull);
285
286      BlockEntity snippetBlock = NewBlockEntityFor.lineRangeWithReplace(
287         "lineRangeWithReplace", KeepMatched.YES, EntityRequired.YES,
288         startLinePattern, startLine_rplcWith, startRplcs_notMtchNum, startAppearanceFilter,
289            dbgStartRplcr_ifNonNull,
290         null,         //No mid alterer
291         endLinePattern, endLine_rplcWith, endRplcs_notMtchNum, endAppearanceFilter,
292            dbgEndRplcr_ifNonNull,
293         null, dbgLineNums_ifNonNull);
294
295      return  new FilteredLineIterator(
296         null, Returns.KEPT, KeepUnmatched.NO,
297         dbgAllLines_ifNonNull, rangeForEveryLineDebug_ifNonNull,
298         snippetBlock);
299   }
300
301   /**
302      <p>Create a new line-range filter with named debuggers.</p>
303
304      <p>{@linkplain com.github.aliteralmind.codelet.CodeletBootstrap#NAMED_DEBUGGERS_CONFIG_FILE Named debuggers} provided to the following {@link #lineRangeWithReplace(int, boolean, String, String, ReplacedInEachInput, Appendable, Appendable, int, boolean, String, String, ReplacedInEachInput, Appendable, Appendable, Appendable, Appendable, LengthInRange) lineRangeWithReplace} parameters:<ul>
305         <li><code><i>[named_debugPrefix]</i>.filter</code><ul>
306            <li>{@code .blockstart}: {@code dbgStartRplcr_ifNonNull}</li>
307            <li>{@code .blockstart.validfilter}: {@code dbgStartFilter_ifNonNull}</li>
308            <li>{@code .blockend}: {@code dbgEndRplcr_ifNonNull}</li>
309            <li>{@code .blockend.validfilter}: {@code dbgEndFilter_ifNonNull}</li>
310            <li>{@code .linenums}: {@code dbgLineNums_ifNonNull}</li>
311            <li>{@code .alllines}: {@code dbgAllLines_ifNonNull}</li>
312         </ul></li>
313      </ul>All of which must be added to the named-debug-level configuration file:</p>
314
315<blockquote><pre>PREFIX.filter.alllines=-1
316<blockquote><pre>PREFIX.filter.linenums=-1
317PREFIX.filter.blockend.validfilter=-1
318PREFIX.filter.blockend=-1
319PREFIX.filter.blockstart.validfilter=-1
320PREFIX.filter.blockstart=-1</pre></blockquote>
321
322    * @param  instance  For determining the current {@linkplain com.github.aliteralmind.codelet.CodeletBaseConfig#getDebugApblIfOn(CodeletInstance, String) debugging level}.
323    * @param  named_debugPrefix  Prepended to all named debuggers. May not be {@code null} or empty.
324    */
325   public static final FilteredLineIterator lineRangeWithReplace(CodeletInstance instance, String named_debugPrefix, int startAppearance_num, boolean is_startLineRegex, String startLine_findWhat, String startLine_rplcWith, ReplacedInEachInput startRplcs_notMtchNum, int endAppearance_num, boolean is_endLineRegex, String endLine_findWhat, String endLine_rplcWith, ReplacedInEachInput endRplcs_notMtchNum) throws PatternSyntaxException  {
326      CrashIfString.nullEmpty(named_debugPrefix, "named_debugPrefix", null);
327      String prefixFltr = named_debugPrefix + ".filter";
328      Appendable dbgBlkStart = getDebugApblIfOn(instance,
329         prefixFltr + ".blockstart");
330      Appendable dbgBlkStartValidFltr = getDebugApblIfOn(instance,
331         prefixFltr + ".blockstart.validfilter");
332      Appendable dbgBlkEnd = getDebugApblIfOn(instance,
333         prefixFltr + ".blockend");
334      Appendable dbgBlkEndValidFltr = getDebugApblIfOn(instance,
335         prefixFltr + ".blockend.validfilter");
336      Appendable dbgLineNums = getDebugApblIfOn(instance,
337         prefixFltr + ".linenums");
338      Appendable dbgAllLines = getDebugApblIfOn(instance,
339         prefixFltr + ".alllines");
340
341      return  lineRangeWithReplace(
342         startAppearance_num, is_startLineRegex,
343         startLine_findWhat, startLine_rplcWith, startRplcs_notMtchNum,
344            dbgBlkStartValidFltr, dbgBlkStart,
345         endAppearance_num, is_endLineRegex,
346         endLine_findWhat, endLine_rplcWith, endRplcs_notMtchNum,
347            dbgBlkEndValidFltr, dbgBlkEnd,
348            dbgLineNums, dbgAllLines, null);
349   }
350   private NewLineFilterFor()  {
351      throw  new IllegalStateException("Do not instantiate.");
352   }
353}