4
4
import com .igormaznitsa .jcp .exceptions .FilePositionInfo ;
5
5
6
6
/**
7
- * Custom processor to detect and process uncommenting text line or text block
8
- * defined through //$ and //$$ directives. It can return the same value or
9
- * changed one. The processor is called after ext prepared for injection into preprocessed source.
10
- * If activated merge block mode for preprocessor so sequentially
11
- * situated lines started with """ will be merged into single text block (and """ will be removed)
7
+ * A custom processor for detecting and handling uncommenting directives in source text.
8
+ * This processor recognizes lines or blocks marked with `//$` and `//$$` and can either
9
+ * return them unchanged or modify them as needed. It is invoked after the external text
10
+ * is prepared for injection into the preprocessed source.
11
+ * If block merging is enabled, consecutive lines beginning with `"""` will be merged
12
+ * into a single text block, and the `"""` markers will be removed.
12
13
*
13
14
* @since 7.2.0
14
15
*/
15
16
public interface CommentTextProcessor extends PreprocessorContextListener {
16
17
17
18
/**
18
- * Process uncommented text detected in //$ or //$$ sections. If processing not needed then the provided text must be returned.
19
+ * Processes uncommented text detected in `//$` or `//$$` sections.
20
+ * If no transformation is needed, the original text must be returned unchanged.
19
21
*
20
- * @param recommendedIndent indent to be recommended for the processed text if it will be processed
21
- * @param uncommentedText the text which was uncommented and needs processing, must not be null
22
- * @param fileContainer the source file info container calling the processor, must not be null
23
- * @param positionInfo position of the uncommented line or the first line of the uncommented text block, must not be null
24
- * @param context the current preprocessor context, must not be null
25
- * @param state the current preprocess state, must not be null
26
- * @return must return value as the same text or as the changed one.
22
+ * @param recommendedIndent the suggested indentation level for the processed text, if any modifications are applied
23
+ * @param uncommentedText the text that was uncommented and is subject to processing; must not be null
24
+ * @param fileContainer the container holding metadata about the source file invoking the processor; must not be null
25
+ * @param positionInfo the position of the uncommented line or the first line of the uncommented block; must not be null
26
+ * @param context the current preprocessor context; must not be null
27
+ * @param state the current preprocessor state; must not be null
28
+ * @return the processed text, which may be unchanged or modified
27
29
* @since 7.2.1
28
30
*/
29
31
String processUncommentedText (
@@ -35,10 +37,16 @@ String processUncommentedText(
35
37
PreprocessingState state );
36
38
37
39
/**
38
- * Returns flag that the preprocessor is allowed and can be called. It gets full info about current context and file so can make decision on fly.
39
- * It will be called before every processor call.
40
+ * Indicates whether the preprocessor is allowed to run in the current context.
41
+ * This method is invoked before each call to the processor and receives complete
42
+ * information about the current context and source file, enabling it to make a
43
+ * dynamic decision.
40
44
*
41
- * @return true if the preprocessor allowed, false if not
45
+ * @param fileContainer the container holding metadata about the source file invoking the processor; must not be null
46
+ * @param positionInfo the position of the uncommented line or the first line of the uncommented block; must not be null
47
+ * @param context the current preprocessor context; must not be null
48
+ * @param state the current preprocessor state; must not be null
49
+ * @return {@code true} if the preprocessor is permitted to run; {@code false} otherwise
42
50
* @since 7.2.1
43
51
*/
44
52
boolean isAllowed (
0 commit comments