Merge pull request #875 from parrt/fix-TokenStreamRewriter-doc-getText
Fixes #819. fix-TokenStreamRewriter-doc-getText
This commit is contained in:
commit
1374896a16
|
@ -92,7 +92,7 @@ import java.util.Map;
|
||||||
* ...
|
* ...
|
||||||
* rewriter.insertAfter(t, "text to put after t");}
|
* rewriter.insertAfter(t, "text to put after t");}
|
||||||
* rewriter.insertAfter(u, "text after u");}
|
* rewriter.insertAfter(u, "text after u");}
|
||||||
* System.out.println(rewriter.toString());
|
* System.out.println(rewriter.getText());
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -104,8 +104,8 @@ import java.util.Map;
|
||||||
* <pre>
|
* <pre>
|
||||||
* rewriter.insertAfter("pass1", t, "text to put after t");}
|
* rewriter.insertAfter("pass1", t, "text to put after t");}
|
||||||
* rewriter.insertAfter("pass2", u, "text after u");}
|
* rewriter.insertAfter("pass2", u, "text after u");}
|
||||||
* System.out.println(rewriter.toString("pass1"));
|
* System.out.println(rewriter.getText("pass1"));
|
||||||
* System.out.println(rewriter.toString("pass2"));
|
* System.out.println(rewriter.getText("pass2"));
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -371,6 +371,13 @@ public class TokenStreamRewriter {
|
||||||
return getText(DEFAULT_PROGRAM_NAME, Interval.of(0,tokens.size()-1));
|
return getText(DEFAULT_PROGRAM_NAME, Interval.of(0,tokens.size()-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return the text from the original tokens altered per the
|
||||||
|
* instructions given to this rewriter in programName.
|
||||||
|
*/
|
||||||
|
public String getText(String programName) {
|
||||||
|
return getText(programName, Interval.of(0,tokens.size()-1));
|
||||||
|
}
|
||||||
|
|
||||||
/** Return the text associated with the tokens in the interval from the
|
/** Return the text associated with the tokens in the interval from the
|
||||||
* original token stream but with the alterations given to this rewriter.
|
* original token stream but with the alterations given to this rewriter.
|
||||||
* The interval refers to the indexes in the original token stream.
|
* The interval refers to the indexes in the original token stream.
|
||||||
|
|
Loading…
Reference in New Issue