| <!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.6.0_30) on Wed Jan 25 19:03:56 CST 2012 --> | |
| <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <TITLE> | |
| Prettify.CreateSimpleLexer (Java Prettify) | |
| </TITLE> | |
| <META NAME="date" CONTENT="2012-01-25"> | |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> | |
| <SCRIPT type="text/javascript"> | |
| function windowTitle() | |
| { | |
| if (location.href.indexOf('is-external=true') == -1) { | |
| parent.document.title="Prettify.CreateSimpleLexer (Java Prettify)"; | |
| } | |
| } | |
| </SCRIPT> | |
| <NOSCRIPT> | |
| </NOSCRIPT> | |
| </HEAD> | |
| <BODY BGCOLOR="white" onload="windowTitle();"> | |
| <HR> | |
| <!-- ========= 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="class-use/Prettify.CreateSimpleLexer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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="../../prettify/parser/Prettify.html" title="class in prettify.parser"><B>PREV CLASS</B></A> | |
| <A HREF="../../prettify/parser/Util.html" title="class in prettify.parser"><B>NEXT CLASS</B></A></FONT></TD> | |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
| <A HREF="../../index.html?prettify/parser/Prettify.CreateSimpleLexer.html" target="_top"><B>FRAMES</B></A> | |
| <A HREF="Prettify.CreateSimpleLexer.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"> | |
| prettify.parser</FONT> | |
| <BR> | |
| Class Prettify.CreateSimpleLexer</H2> | |
| <PRE> | |
| java.lang.Object | |
| <IMG SRC="../../resources/inherit.gif" ALT="extended by "><B>prettify.parser.Prettify.CreateSimpleLexer</B> | |
| </PRE> | |
| <DL> | |
| <DT><B>Enclosing class:</B><DD><A HREF="../../prettify/parser/Prettify.html" title="class in prettify.parser">Prettify</A></DD> | |
| </DL> | |
| <HR> | |
| <DL> | |
| <DT><PRE>public class <B>Prettify.CreateSimpleLexer</B><DT>extends java.lang.Object</DL> | |
| </PRE> | |
| <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>protected java.util.List<java.util.List<java.lang.Object>></CODE></FONT></TD> | |
| <TD><CODE><B><A HREF="../../prettify/parser/Prettify.CreateSimpleLexer.html#fallthroughStylePatterns">fallthroughStylePatterns</A></B></CODE> | |
| <BR> | |
| </TD> | |
| </TR> | |
| <TR BGCOLOR="white" CLASS="TableRowColor"> | |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
| <CODE>protected int</CODE></FONT></TD> | |
| <TD><CODE><B><A HREF="../../prettify/parser/Prettify.CreateSimpleLexer.html#nPatterns">nPatterns</A></B></CODE> | |
| <BR> | |
| </TD> | |
| </TR> | |
| <TR BGCOLOR="white" CLASS="TableRowColor"> | |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
| <CODE>protected java.util.Map<java.lang.Character,java.util.List<java.lang.Object>></CODE></FONT></TD> | |
| <TD><CODE><B><A HREF="../../prettify/parser/Prettify.CreateSimpleLexer.html#shortcuts">shortcuts</A></B></CODE> | |
| <BR> | |
| </TD> | |
| </TR> | |
| <TR BGCOLOR="white" CLASS="TableRowColor"> | |
| <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
| <CODE>protected java.util.regex.Pattern</CODE></FONT></TD> | |
| <TD><CODE><B><A HREF="../../prettify/parser/Prettify.CreateSimpleLexer.html#tokenizer">tokenizer</A></B></CODE> | |
| <BR> | |
| </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 ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> | |
| <CODE>protected </CODE></FONT></TD> | |
| <TD><CODE><B><A HREF="../../prettify/parser/Prettify.CreateSimpleLexer.html#Prettify.CreateSimpleLexer(java.util.List, java.util.List)">Prettify.CreateSimpleLexer</A></B>(java.util.List<java.util.List<java.lang.Object>> shortcutStylePatterns, | |
| java.util.List<java.util.List<java.lang.Object>> fallthroughStylePatterns)</CODE> | |
| <BR> | |
| Given triples of [style, pattern, context] returns a lexing function, | |
| The lexing function interprets the patterns to find token boundaries and | |
| returns a decoration list of the form | |
| [index_0, style_0, index_1, style_1, ..., index_n, style_n] | |
| where index_n is an index into the sourceCode, and style_n is a style | |
| constant like PR_PLAIN.</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> void</CODE></FONT></TD> | |
| <TD><CODE><B><A HREF="../../prettify/parser/Prettify.CreateSimpleLexer.html#decorate(prettify.parser.Job)">decorate</A></B>(<A HREF="../../prettify/parser/Job.html" title="class in prettify.parser">Job</A> job)</CODE> | |
| <BR> | |
| Lexes job.sourceCode and produces an output array job.decorations of | |
| style classes preceded by the position at which they start in | |
| job.sourceCode in order.</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="fallthroughStylePatterns"><!-- --></A><H3> | |
| fallthroughStylePatterns</H3> | |
| <PRE> | |
| protected java.util.List<java.util.List<java.lang.Object>> <B>fallthroughStylePatterns</B></PRE> | |
| <DL> | |
| <DL> | |
| </DL> | |
| </DL> | |
| <HR> | |
| <A NAME="shortcuts"><!-- --></A><H3> | |
| shortcuts</H3> | |
| <PRE> | |
| protected java.util.Map<java.lang.Character,java.util.List<java.lang.Object>> <B>shortcuts</B></PRE> | |
| <DL> | |
| <DL> | |
| </DL> | |
| </DL> | |
| <HR> | |
| <A NAME="tokenizer"><!-- --></A><H3> | |
| tokenizer</H3> | |
| <PRE> | |
| protected java.util.regex.Pattern <B>tokenizer</B></PRE> | |
| <DL> | |
| <DL> | |
| </DL> | |
| </DL> | |
| <HR> | |
| <A NAME="nPatterns"><!-- --></A><H3> | |
| nPatterns</H3> | |
| <PRE> | |
| protected int <B>nPatterns</B></PRE> | |
| <DL> | |
| <DL> | |
| </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="Prettify.CreateSimpleLexer(java.util.List, java.util.List)"><!-- --></A><H3> | |
| Prettify.CreateSimpleLexer</H3> | |
| <PRE> | |
| protected <B>Prettify.CreateSimpleLexer</B>(java.util.List<java.util.List<java.lang.Object>> shortcutStylePatterns, | |
| java.util.List<java.util.List<java.lang.Object>> fallthroughStylePatterns) | |
| throws java.lang.Exception</PRE> | |
| <DL> | |
| <DD>Given triples of [style, pattern, context] returns a lexing function, | |
| The lexing function interprets the patterns to find token boundaries and | |
| returns a decoration list of the form | |
| [index_0, style_0, index_1, style_1, ..., index_n, style_n] | |
| where index_n is an index into the sourceCode, and style_n is a style | |
| constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to | |
| all characters in sourceCode[index_n-1:index_n]. | |
| The stylePatterns is a list whose elements have the form | |
| [style : string, pattern : RegExp, DEPRECATED, shortcut : string]. | |
| Style is a style constant like PR_PLAIN, or can be a string of the | |
| form 'lang-FOO', where FOO is a language extension describing the | |
| language of the portion of the token in $1 after pattern executes. | |
| E.g., if style is 'lang-lisp', and group 1 contains the text | |
| '(hello (world))', then that portion of the token will be passed to the | |
| registered lisp handler for formatting. | |
| The text before and after group 1 will be restyled using this decorator | |
| so decorators should take care that this doesn't result in infinite | |
| recursion. For example, the HTML lexer rule for SCRIPT elements looks | |
| something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match | |
| '<script>foo()<\/script>', which would cause the current decorator to | |
| be called with '<script>' which would not match the same rule since | |
| group 1 must not be empty, so it would be instead styled as PR_TAG by | |
| the generic tag rule. The handler registered for the 'js' extension would | |
| then be called with 'foo()', and finally, the current decorator would | |
| be called with '<\/script>' which would not match the original rule and | |
| so the generic tag rule would identify it as a tag. | |
| Pattern must only match prefixes, and if it matches a prefix, then that | |
| match is considered a token with the same style. | |
| Context is applied to the last non-whitespace, non-comment token | |
| recognized. | |
| Shortcut is an optional string of characters, any of which, if the first | |
| character, gurantee that this pattern and only this pattern matches. | |
| <P> | |
| <DL> | |
| <DT><B>Parameters:</B><DD><CODE>shortcutStylePatterns</CODE> - patterns that always start with | |
| a known character. Must have a shortcut string.<DD><CODE>fallthroughStylePatterns</CODE> - patterns that will be tried in | |
| order if the shortcut ones fail. May have shortcuts. | |
| <DT><B>Throws:</B> | |
| <DD><CODE>java.lang.Exception</CODE></DL> | |
| </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="decorate(prettify.parser.Job)"><!-- --></A><H3> | |
| decorate</H3> | |
| <PRE> | |
| public void <B>decorate</B>(<A HREF="../../prettify/parser/Job.html" title="class in prettify.parser">Job</A> job)</PRE> | |
| <DL> | |
| <DD>Lexes job.sourceCode and produces an output array job.decorations of | |
| style classes preceded by the position at which they start in | |
| job.sourceCode in order. | |
| <P> | |
| <DD><DL> | |
| <DT><B>Parameters:</B><DD><CODE>job</CODE> - an object like <pre>{ | |
| sourceCode: {string} sourceText plain text, | |
| basePos: {int} position of job.sourceCode in the larger chunk of | |
| sourceCode. | |
| }</pre></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="class-use/Prettify.CreateSimpleLexer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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="../../prettify/parser/Prettify.html" title="class in prettify.parser"><B>PREV CLASS</B></A> | |
| <A HREF="../../prettify/parser/Util.html" title="class in prettify.parser"><B>NEXT CLASS</B></A></FONT></TD> | |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> | |
| <A HREF="../../index.html?prettify/parser/Prettify.CreateSimpleLexer.html" target="_top"><B>FRAMES</B></A> | |
| <A HREF="Prettify.CreateSimpleLexer.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> |