PageRenderTime 54ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/ecj-svm/lib/ecj/docs/classdocs/ec/util/Lexer.html

https://bitbucket.org/tomzet/kernel-gp-mirror
HTML | 385 lines | 317 code | 44 blank | 24 comment | 0 complexity | 603fde347307bacb559cc6b295d12b29 MD5 | raw file
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!--NewPage-->
  3. <HTML>
  4. <HEAD>
  5. <!-- Generated by javadoc (build 1.5.0_26) on Fri Dec 17 11:41:36 EST 2010 -->
  6. <TITLE>
  7. Lexer
  8. </TITLE>
  9. <META NAME="keywords" CONTENT="ec.util.Lexer class">
  10. <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
  11. <SCRIPT type="text/javascript">
  12. function windowTitle()
  13. {
  14. parent.document.title="Lexer";
  15. }
  16. </SCRIPT>
  17. <NOSCRIPT>
  18. </NOSCRIPT>
  19. </HEAD>
  20. <BODY BGCOLOR="white" onload="windowTitle();">
  21. <!-- ========= START OF TOP NAVBAR ======= -->
  22. <A NAME="navbar_top"><!-- --></A>
  23. <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
  24. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  25. <TR>
  26. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  27. <A NAME="navbar_top_firstrow"><!-- --></A>
  28. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  29. <TR ALIGN="center" VALIGN="top">
  30. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  31. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  32. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  33. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  34. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  35. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  36. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  37. </TR>
  38. </TABLE>
  39. </TD>
  40. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  41. </EM>
  42. </TD>
  43. </TR>
  44. <TR>
  45. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  46. &nbsp;<A HREF="../../ec/util/DecodeReturn.html" title="class in ec.util"><B>PREV CLASS</B></A>&nbsp;
  47. &nbsp;<A HREF="../../ec/util/LocalHost.html" title="class in ec.util"><B>NEXT CLASS</B></A></FONT></TD>
  48. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  49. <A HREF="../../index.html?ec/util/Lexer.html" target="_top"><B>FRAMES</B></A> &nbsp;
  50. &nbsp;<A HREF="Lexer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  51. &nbsp;<SCRIPT type="text/javascript">
  52. <!--
  53. if(window==top) {
  54. document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
  55. }
  56. //-->
  57. </SCRIPT>
  58. <NOSCRIPT>
  59. <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
  60. </NOSCRIPT>
  61. </FONT></TD>
  62. </TR>
  63. <TR>
  64. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  65. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  66. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  67. DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  68. </TR>
  69. </TABLE>
  70. <A NAME="skip-navbar_top"></A>
  71. <!-- ========= END OF TOP NAVBAR ========= -->
  72. <HR>
  73. <!-- ======== START OF CLASS DATA ======== -->
  74. <H2>
  75. <FONT SIZE="-1">
  76. ec.util</FONT>
  77. <BR>
  78. Class Lexer</H2>
  79. <PRE>
  80. java.lang.Object
  81. <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>ec.util.Lexer</B>
  82. </PRE>
  83. <HR>
  84. <DL>
  85. <DT><PRE>public class <B>Lexer</B><DT>extends java.lang.Object</DL>
  86. </PRE>
  87. <P>
  88. A simple line-by-line String tokenizer. You provide Lexer with a String or other
  89. CharSequence as input, plus an array of regular expressions. Each time you call
  90. nextToken(...), the Lexer matches the next token against the regular expressions
  91. and returns it. The regular expressions are checked in order, and the first one
  92. that matches is the winner.
  93. <P>
  94. <P>
  95. <HR>
  96. <P>
  97. <!-- =========== FIELD SUMMARY =========== -->
  98. <A NAME="field_summary"><!-- --></A>
  99. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  100. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  101. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  102. <B>Field Summary</B></FONT></TH>
  103. </TR>
  104. <TR BGCOLOR="white" CLASS="TableRowColor">
  105. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  106. <CODE>static&nbsp;int</CODE></FONT></TD>
  107. <TD><CODE><B><A HREF="../../ec/util/Lexer.html#FAILURE">FAILURE</A></B></CODE>
  108. <BR>
  109. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;An index which indicates that no further tokens were found.</TD>
  110. </TR>
  111. </TABLE>
  112. &nbsp;
  113. <!-- ======== CONSTRUCTOR SUMMARY ======== -->
  114. <A NAME="constructor_summary"><!-- --></A>
  115. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  116. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  117. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  118. <B>Constructor Summary</B></FONT></TH>
  119. </TR>
  120. <TR BGCOLOR="white" CLASS="TableRowColor">
  121. <TD><CODE><B><A HREF="../../ec/util/Lexer.html#Lexer(java.lang.CharSequence, java.lang.String[])">Lexer</A></B>(java.lang.CharSequence&nbsp;input,
  122. java.lang.String[]&nbsp;regexps)</CODE>
  123. <BR>
  124. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Builds a Lexer for the given input with the provided regular expressions.</TD>
  125. </TR>
  126. </TABLE>
  127. &nbsp;
  128. <!-- ========== METHOD SUMMARY =========== -->
  129. <A NAME="method_summary"><!-- --></A>
  130. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  131. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  132. <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
  133. <B>Method Summary</B></FONT></TH>
  134. </TR>
  135. <TR BGCOLOR="white" CLASS="TableRowColor">
  136. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  137. <CODE>&nbsp;int</CODE></FONT></TD>
  138. <TD><CODE><B><A HREF="../../ec/util/Lexer.html#getMatchingIndex()">getMatchingIndex</A></B>()</CODE>
  139. <BR>
  140. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index of the regular expression which matched the most recent token.</TD>
  141. </TR>
  142. <TR BGCOLOR="white" CLASS="TableRowColor">
  143. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  144. <CODE>&nbsp;int</CODE></FONT></TD>
  145. <TD><CODE><B><A HREF="../../ec/util/Lexer.html#getMatchingPosition()">getMatchingPosition</A></B>()</CODE>
  146. <BR>
  147. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the position in the String just beyond the most recent token.</TD>
  148. </TR>
  149. <TR BGCOLOR="white" CLASS="TableRowColor">
  150. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  151. <CODE>&nbsp;java.lang.String</CODE></FONT></TD>
  152. <TD><CODE><B><A HREF="../../ec/util/Lexer.html#getMatchingRule()">getMatchingRule</A></B>()</CODE>
  153. <BR>
  154. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the regular expression which matched the most recent token.</TD>
  155. </TR>
  156. <TR BGCOLOR="white" CLASS="TableRowColor">
  157. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  158. <CODE>&nbsp;java.lang.String</CODE></FONT></TD>
  159. <TD><CODE><B><A HREF="../../ec/util/Lexer.html#nextToken()">nextToken</A></B>()</CODE>
  160. <BR>
  161. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the next token as a string.</TD>
  162. </TR>
  163. <TR BGCOLOR="white" CLASS="TableRowColor">
  164. <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
  165. <CODE>&nbsp;java.lang.String</CODE></FONT></TD>
  166. <TD><CODE><B><A HREF="../../ec/util/Lexer.html#nextToken(boolean)">nextToken</A></B>(boolean&nbsp;trim)</CODE>
  167. <BR>
  168. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the next token as a string.</TD>
  169. </TR>
  170. </TABLE>
  171. &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
  172. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  173. <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
  174. <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
  175. </TR>
  176. <TR BGCOLOR="white" CLASS="TableRowColor">
  177. <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
  178. </TR>
  179. </TABLE>
  180. &nbsp;
  181. <P>
  182. <!-- ============ FIELD DETAIL =========== -->
  183. <A NAME="field_detail"><!-- --></A>
  184. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  185. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  186. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  187. <B>Field Detail</B></FONT></TH>
  188. </TR>
  189. </TABLE>
  190. <A NAME="FAILURE"><!-- --></A><H3>
  191. FAILURE</H3>
  192. <PRE>
  193. public static final int <B>FAILURE</B></PRE>
  194. <DL>
  195. <DD>An index which indicates that no further tokens were found. This could be due to the end of the string or due to a bad
  196. string. You'll need to check the index to determine for sure.
  197. <P>
  198. <DL>
  199. <DT><B>See Also:</B><DD><A HREF="../../constant-values.html#ec.util.Lexer.FAILURE">Constant Field Values</A></DL>
  200. </DL>
  201. <!-- ========= CONSTRUCTOR DETAIL ======== -->
  202. <A NAME="constructor_detail"><!-- --></A>
  203. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  204. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  205. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  206. <B>Constructor Detail</B></FONT></TH>
  207. </TR>
  208. </TABLE>
  209. <A NAME="Lexer(java.lang.CharSequence, java.lang.String[])"><!-- --></A><H3>
  210. Lexer</H3>
  211. <PRE>
  212. public <B>Lexer</B>(java.lang.CharSequence&nbsp;input,
  213. java.lang.String[]&nbsp;regexps)</PRE>
  214. <DL>
  215. <DD>Builds a Lexer for the given input with the provided regular expressions. The regular expressions
  216. will be checked in order against the input, and the first one which matches will be assumed to be the token.
  217. <P>
  218. </DL>
  219. <!-- ============ METHOD DETAIL ========== -->
  220. <A NAME="method_detail"><!-- --></A>
  221. <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
  222. <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
  223. <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
  224. <B>Method Detail</B></FONT></TH>
  225. </TR>
  226. </TABLE>
  227. <A NAME="nextToken(boolean)"><!-- --></A><H3>
  228. nextToken</H3>
  229. <PRE>
  230. public java.lang.String <B>nextToken</B>(boolean&nbsp;trim)</PRE>
  231. <DL>
  232. <DD>Returns the next token as a string. If *trim* is true, then the string is first trimmed of whitespace.
  233. <P>
  234. <DD><DL>
  235. </DL>
  236. </DD>
  237. </DL>
  238. <HR>
  239. <A NAME="nextToken()"><!-- --></A><H3>
  240. nextToken</H3>
  241. <PRE>
  242. public java.lang.String <B>nextToken</B>()</PRE>
  243. <DL>
  244. <DD>Returns the next token as a string. The string is first trimmed of whitespace.
  245. <P>
  246. <DD><DL>
  247. </DL>
  248. </DD>
  249. </DL>
  250. <HR>
  251. <A NAME="getMatchingIndex()"><!-- --></A><H3>
  252. getMatchingIndex</H3>
  253. <PRE>
  254. public int <B>getMatchingIndex</B>()</PRE>
  255. <DL>
  256. <DD>Returns the index of the regular expression which matched the most recent token.
  257. <P>
  258. <DD><DL>
  259. </DL>
  260. </DD>
  261. </DL>
  262. <HR>
  263. <A NAME="getMatchingRule()"><!-- --></A><H3>
  264. getMatchingRule</H3>
  265. <PRE>
  266. public java.lang.String <B>getMatchingRule</B>()</PRE>
  267. <DL>
  268. <DD>Returns the regular expression which matched the most recent token.
  269. <P>
  270. <DD><DL>
  271. </DL>
  272. </DD>
  273. </DL>
  274. <HR>
  275. <A NAME="getMatchingPosition()"><!-- --></A><H3>
  276. getMatchingPosition</H3>
  277. <PRE>
  278. public int <B>getMatchingPosition</B>()</PRE>
  279. <DL>
  280. <DD>Returns the position in the String just beyond the most recent token.
  281. <P>
  282. <DD><DL>
  283. </DL>
  284. </DD>
  285. </DL>
  286. <!-- ========= END OF CLASS DATA ========= -->
  287. <HR>
  288. <!-- ======= START OF BOTTOM NAVBAR ====== -->
  289. <A NAME="navbar_bottom"><!-- --></A>
  290. <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
  291. <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
  292. <TR>
  293. <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
  294. <A NAME="navbar_bottom_firstrow"><!-- --></A>
  295. <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  296. <TR ALIGN="center" VALIGN="top">
  297. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  298. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  299. <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  300. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  301. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  302. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  303. <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  304. </TR>
  305. </TABLE>
  306. </TD>
  307. <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
  308. </EM>
  309. </TD>
  310. </TR>
  311. <TR>
  312. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  313. &nbsp;<A HREF="../../ec/util/DecodeReturn.html" title="class in ec.util"><B>PREV CLASS</B></A>&nbsp;
  314. &nbsp;<A HREF="../../ec/util/LocalHost.html" title="class in ec.util"><B>NEXT CLASS</B></A></FONT></TD>
  315. <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  316. <A HREF="../../index.html?ec/util/Lexer.html" target="_top"><B>FRAMES</B></A> &nbsp;
  317. &nbsp;<A HREF="Lexer.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
  318. &nbsp;<SCRIPT type="text/javascript">
  319. <!--
  320. if(window==top) {
  321. document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
  322. }
  323. //-->
  324. </SCRIPT>
  325. <NOSCRIPT>
  326. <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
  327. </NOSCRIPT>
  328. </FONT></TD>
  329. </TR>
  330. <TR>
  331. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  332. SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
  333. <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  334. DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
  335. </TR>
  336. </TABLE>
  337. <A NAME="skip-navbar_bottom"></A>
  338. <!-- ======== END OF BOTTOM NAVBAR ======= -->
  339. <HR>
  340. </BODY>
  341. </HTML>