/ecj-svm/lib/ecj/docs/classdocs/ec/util/Lexer.html
HTML | 385 lines | 317 code | 44 blank | 24 comment | 0 complexity | 603fde347307bacb559cc6b295d12b29 MD5 | raw file
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <!--NewPage-->
- <HTML>
- <HEAD>
- <!-- Generated by javadoc (build 1.5.0_26) on Fri Dec 17 11:41:36 EST 2010 -->
- <TITLE>
- Lexer
- </TITLE>
- <META NAME="keywords" CONTENT="ec.util.Lexer class">
- <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">
- <SCRIPT type="text/javascript">
- function windowTitle()
- {
- parent.document.title="Lexer";
- }
- </SCRIPT>
- <NOSCRIPT>
- </NOSCRIPT>
- </HEAD>
- <BODY BGCOLOR="white" onload="windowTitle();">
- <!-- ========= START OF TOP NAVBAR ======= -->
- <A NAME="navbar_top"><!-- --></A>
- <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
- <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
- <TR>
- <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
- <A NAME="navbar_top_firstrow"><!-- --></A>
- <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
- <TR ALIGN="center" VALIGN="top">
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
- <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
- </TR>
- </TABLE>
- </TD>
- <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
- </EM>
- </TD>
- </TR>
- <TR>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../ec/util/DecodeReturn.html" title="class in ec.util"><B>PREV CLASS</B></A>
- <A HREF="../../ec/util/LocalHost.html" title="class in ec.util"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../index.html?ec/util/Lexer.html" target="_top"><B>FRAMES</B></A>
- <A HREF="Lexer.html" target="_top"><B>NO FRAMES</B></A>
- <SCRIPT type="text/javascript">
- <!--
- if(window==top) {
- document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
- }
- //-->
- </SCRIPT>
- <NOSCRIPT>
- <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
- </NOSCRIPT>
- </FONT></TD>
- </TR>
- <TR>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
- </TR>
- </TABLE>
- <A NAME="skip-navbar_top"></A>
- <!-- ========= END OF TOP NAVBAR ========= -->
- <HR>
- <!-- ======== START OF CLASS DATA ======== -->
- <H2>
- <FONT SIZE="-1">
- ec.util</FONT>
- <BR>
- Class Lexer</H2>
- <PRE>
- java.lang.Object
- <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>ec.util.Lexer</B>
- </PRE>
- <HR>
- <DL>
- <DT><PRE>public class <B>Lexer</B><DT>extends java.lang.Object</DL>
- </PRE>
- <P>
- A simple line-by-line String tokenizer. You provide Lexer with a String or other
- CharSequence as input, plus an array of regular expressions. Each time you call
- nextToken(...), the Lexer matches the next token against the regular expressions
- and returns it. The regular expressions are checked in order, and the first one
- that matches is the winner.
- <P>
- <P>
- <HR>
- <P>
- <!-- =========== FIELD SUMMARY =========== -->
- <A NAME="field_summary"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
- <B>Field Summary</B></FONT></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE>static int</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../ec/util/Lexer.html#FAILURE">FAILURE</A></B></CODE>
- <BR>
- An index which indicates that no further tokens were found.</TD>
- </TR>
- </TABLE>
-
- <!-- ======== CONSTRUCTOR SUMMARY ======== -->
- <A NAME="constructor_summary"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
- <B>Constructor Summary</B></FONT></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD><CODE><B><A HREF="../../ec/util/Lexer.html#Lexer(java.lang.CharSequence, java.lang.String[])">Lexer</A></B>(java.lang.CharSequence input,
- java.lang.String[] regexps)</CODE>
- <BR>
- Builds a Lexer for the given input with the provided regular expressions.</TD>
- </TR>
- </TABLE>
-
- <!-- ========== METHOD SUMMARY =========== -->
- <A NAME="method_summary"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
- <B>Method Summary</B></FONT></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> int</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../ec/util/Lexer.html#getMatchingIndex()">getMatchingIndex</A></B>()</CODE>
- <BR>
- Returns the index of the regular expression which matched the most recent token.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> int</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../ec/util/Lexer.html#getMatchingPosition()">getMatchingPosition</A></B>()</CODE>
- <BR>
- Returns the position in the String just beyond the most recent token.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> java.lang.String</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../ec/util/Lexer.html#getMatchingRule()">getMatchingRule</A></B>()</CODE>
- <BR>
- Returns the regular expression which matched the most recent token.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> java.lang.String</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../ec/util/Lexer.html#nextToken()">nextToken</A></B>()</CODE>
- <BR>
- Returns the next token as a string.</TD>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
- <CODE> java.lang.String</CODE></FONT></TD>
- <TD><CODE><B><A HREF="../../ec/util/Lexer.html#nextToken(boolean)">nextToken</A></B>(boolean trim)</CODE>
- <BR>
- Returns the next token as a string.</TD>
- </TR>
- </TABLE>
- <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
- <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
- </TR>
- <TR BGCOLOR="white" CLASS="TableRowColor">
- <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
- </TR>
- </TABLE>
-
- <P>
- <!-- ============ FIELD DETAIL =========== -->
- <A NAME="field_detail"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
- <B>Field Detail</B></FONT></TH>
- </TR>
- </TABLE>
- <A NAME="FAILURE"><!-- --></A><H3>
- FAILURE</H3>
- <PRE>
- public static final int <B>FAILURE</B></PRE>
- <DL>
- <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
- string. You'll need to check the index to determine for sure.
- <P>
- <DL>
- <DT><B>See Also:</B><DD><A HREF="../../constant-values.html#ec.util.Lexer.FAILURE">Constant Field Values</A></DL>
- </DL>
- <!-- ========= CONSTRUCTOR DETAIL ======== -->
- <A NAME="constructor_detail"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
- <B>Constructor Detail</B></FONT></TH>
- </TR>
- </TABLE>
- <A NAME="Lexer(java.lang.CharSequence, java.lang.String[])"><!-- --></A><H3>
- Lexer</H3>
- <PRE>
- public <B>Lexer</B>(java.lang.CharSequence input,
- java.lang.String[] regexps)</PRE>
- <DL>
- <DD>Builds a Lexer for the given input with the provided regular expressions. The regular expressions
- will be checked in order against the input, and the first one which matches will be assumed to be the token.
- <P>
- </DL>
- <!-- ============ METHOD DETAIL ========== -->
- <A NAME="method_detail"><!-- --></A>
- <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
- <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
- <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
- <B>Method Detail</B></FONT></TH>
- </TR>
- </TABLE>
- <A NAME="nextToken(boolean)"><!-- --></A><H3>
- nextToken</H3>
- <PRE>
- public java.lang.String <B>nextToken</B>(boolean trim)</PRE>
- <DL>
- <DD>Returns the next token as a string. If *trim* is true, then the string is first trimmed of whitespace.
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="nextToken()"><!-- --></A><H3>
- nextToken</H3>
- <PRE>
- public java.lang.String <B>nextToken</B>()</PRE>
- <DL>
- <DD>Returns the next token as a string. The string is first trimmed of whitespace.
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getMatchingIndex()"><!-- --></A><H3>
- getMatchingIndex</H3>
- <PRE>
- public int <B>getMatchingIndex</B>()</PRE>
- <DL>
- <DD>Returns the index of the regular expression which matched the most recent token.
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getMatchingRule()"><!-- --></A><H3>
- getMatchingRule</H3>
- <PRE>
- public java.lang.String <B>getMatchingRule</B>()</PRE>
- <DL>
- <DD>Returns the regular expression which matched the most recent token.
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <HR>
- <A NAME="getMatchingPosition()"><!-- --></A><H3>
- getMatchingPosition</H3>
- <PRE>
- public int <B>getMatchingPosition</B>()</PRE>
- <DL>
- <DD>Returns the position in the String just beyond the most recent token.
- <P>
- <DD><DL>
- </DL>
- </DD>
- </DL>
- <!-- ========= END OF CLASS DATA ========= -->
- <HR>
- <!-- ======= START OF BOTTOM NAVBAR ====== -->
- <A NAME="navbar_bottom"><!-- --></A>
- <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
- <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
- <TR>
- <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
- <A NAME="navbar_bottom_firstrow"><!-- --></A>
- <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
- <TR ALIGN="center" VALIGN="top">
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
- <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
- <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
- </TR>
- </TABLE>
- </TD>
- <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
- </EM>
- </TD>
- </TR>
- <TR>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../ec/util/DecodeReturn.html" title="class in ec.util"><B>PREV CLASS</B></A>
- <A HREF="../../ec/util/LocalHost.html" title="class in ec.util"><B>NEXT CLASS</B></A></FONT></TD>
- <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
- <A HREF="../../index.html?ec/util/Lexer.html" target="_top"><B>FRAMES</B></A>
- <A HREF="Lexer.html" target="_top"><B>NO FRAMES</B></A>
- <SCRIPT type="text/javascript">
- <!--
- if(window==top) {
- document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');
- }
- //-->
- </SCRIPT>
- <NOSCRIPT>
- <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>
- </NOSCRIPT>
- </FONT></TD>
- </TR>
- <TR>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
- <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
- DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
- </TR>
- </TABLE>
- <A NAME="skip-navbar_bottom"></A>
- <!-- ======== END OF BOTTOM NAVBAR ======= -->
- <HR>
- </BODY>
- </HTML>