blob: 8cf1564e9b878748e034839f7c26d75b0ffaf13b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_191) on Sat Feb 27 13:52:04 CET 2021 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>CharStream (Apache Velocity 2.3 API)</title>
<meta name="date" content="2021-02-27">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CharStream (Apache Velocity 2.3 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CharStream.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../../../../org/apache/velocity/runtime/parser/LogContext.html" title="class in org.apache.velocity.runtime.parser"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/velocity/runtime/parser/CharStream.html" target="_top">Frames</a></li>
<li><a href="CharStream.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.velocity.runtime.parser</div>
<h2 title="Interface CharStream" class="title">Interface CharStream</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../../org/apache/velocity/runtime/parser/VelocityCharStream.html" title="class in org.apache.velocity.runtime.parser">VelocityCharStream</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">CharStream</span></pre>
<div class="block">This interface describes a character stream that maintains line and
column number positions of the characters. It also has the capability
to backup the stream to some extent. An implementation of this
interface is used in the TokenManager implementation generated by
JavaCCParser.
All the methods except backup can be implemented in any fashion. backup
needs to be implemented correctly for the correct operation of the lexer.
Rest of the methods are all used to get information like line number,
column number and the String that constitutes a token and are not used
by the lexer. Hence their implementation won't affect the generated lexer's
operation.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#backup-int-">backup</a></span>(int&nbsp;amount)</code>
<div class="block">Backs up the input stream by amount steps.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>char</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#BeginToken--">BeginToken</a></span>()</code>
<div class="block">Returns the next character that marks the beginning of the next token.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#Done--">Done</a></span>()</code>
<div class="block">The lexer calls this function to indicate that it is done with the stream
and hence implementations can free any resources held by this class.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#getBeginColumn--">getBeginColumn</a></span>()</code>
<div class="block">Returns the column number of the first character for current token (being
matched after the last call to BeginTOken).</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#getBeginLine--">getBeginLine</a></span>()</code>
<div class="block">Returns the line number of the first character for current token (being
matched after the last call to BeginTOken).</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#getEndColumn--">getEndColumn</a></span>()</code>
<div class="block">Returns the column number of the last character for current token (being
matched after the last call to BeginTOken).</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#getEndLine--">getEndLine</a></span>()</code>
<div class="block">Returns the line number of the last character for current token (being
matched after the last call to BeginTOken).</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#GetImage--">GetImage</a></span>()</code>
<div class="block">Returns a string made up of characters from the marked token beginning
to the current buffer position.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>char[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#GetSuffix-int-">GetSuffix</a></span>(int&nbsp;len)</code>
<div class="block">Returns an array of characters that make up the suffix of length 'len' for
the currently matched token.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>char</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../org/apache/velocity/runtime/parser/CharStream.html#readChar--">readChar</a></span>()</code>
<div class="block">Returns the next character from the selected input.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="readChar--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>readChar</h4>
<pre>char&nbsp;readChar()
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Returns the next character from the selected input. The method
of selecting the input is the responsibility of the class
implementing this interface. Can throw any java.io.IOException.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>read char</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="getEndColumn--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEndColumn</h4>
<pre>int&nbsp;getEndColumn()</pre>
<div class="block">Returns the column number of the last character for current token (being
matched after the last call to BeginTOken).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ending column number</dd>
</dl>
</li>
</ul>
<a name="getEndLine--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEndLine</h4>
<pre>int&nbsp;getEndLine()</pre>
<div class="block">Returns the line number of the last character for current token (being
matched after the last call to BeginTOken).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ending line number</dd>
</dl>
</li>
</ul>
<a name="getBeginColumn--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBeginColumn</h4>
<pre>int&nbsp;getBeginColumn()</pre>
<div class="block">Returns the column number of the first character for current token (being
matched after the last call to BeginTOken).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>starting column number</dd>
</dl>
</li>
</ul>
<a name="getBeginLine--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBeginLine</h4>
<pre>int&nbsp;getBeginLine()</pre>
<div class="block">Returns the line number of the first character for current token (being
matched after the last call to BeginTOken).</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>starting line number</dd>
</dl>
</li>
</ul>
<a name="backup-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>backup</h4>
<pre>void&nbsp;backup(int&nbsp;amount)</pre>
<div class="block">Backs up the input stream by amount steps. Lexer calls this method if it
had already read some characters, but could not use them to match a
(longer) token. So, they will be used again as the prefix of the next
token and it is the implemetation's responsibility to do this right.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>amount</code> - </dd>
</dl>
</li>
</ul>
<a name="BeginToken--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>BeginToken</h4>
<pre>char&nbsp;BeginToken()
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">Returns the next character that marks the beginning of the next token.
All characters must remain in the buffer between two successive calls
to this method to implement backup correctly.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>next token start char</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="GetImage--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>GetImage</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;GetImage()</pre>
<div class="block">Returns a string made up of characters from the marked token beginning
to the current buffer position. Implementations have the choice of returning
anything that they want to. For example, for efficiency, one might decide
to just return null, which is a valid implementation.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>token image</dd>
</dl>
</li>
</ul>
<a name="GetSuffix-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>GetSuffix</h4>
<pre>char[]&nbsp;GetSuffix(int&nbsp;len)</pre>
<div class="block"><p>Returns an array of characters that make up the suffix of length 'len' for
the currently matched token. This is used to build up the matched string
for use in actions in the case of MORE. A simple and inefficient
implementation of this is as follows :</p>
<pre><code>
{
String t = GetImage();
return t.substring(t.length() - len, t.length()).toCharArray();
}
</code></pre></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>len</code> - suffix len</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>suffix</dd>
</dl>
</li>
</ul>
<a name="Done--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Done</h4>
<pre>void&nbsp;Done()</pre>
<div class="block">The lexer calls this function to indicate that it is done with the stream
and hence implementations can free any resources held by this class.
Again, the body of this function can be just empty and it will not
affect the lexer's operation.</div>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/CharStream.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev&nbsp;Class</li>
<li><a href="../../../../../org/apache/velocity/runtime/parser/LogContext.html" title="class in org.apache.velocity.runtime.parser"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/velocity/runtime/parser/CharStream.html" target="_top">Frames</a></li>
<li><a href="CharStream.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2000&#x2013;2021 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>