comunic/3rdparty/luminous/docs/html/classScanner.html
2016-11-19 12:08:12 +01:00

1029 lines
54 KiB
HTML
Executable File

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Luminous: Scanner Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">Luminous
&#160;<span id="projectnumber">git-master</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class&#160;List</span></a></li>
<li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="classScanner-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Scanner Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Base string scanning class.
<a href="classScanner.html#details">More...</a></p>
<div class="dynheader">
Inheritance diagram for Scanner:</div>
<div class="dyncontent">
<div class="center"><img src="classScanner__inherit__graph.png" border="0" usemap="#Scanner_inherit__map" alt="Inheritance graph"/></div>
<map name="Scanner_inherit__map" id="Scanner_inherit__map">
</map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a36dc435076406066ee020bea8b3f46b2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a36dc435076406066ee020bea8b3f46b2"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a36dc435076406066ee020bea8b3f46b2">__construct</a> ($src=null)</td></tr>
<tr class="memdesc:a36dc435076406066ee020bea8b3f46b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">constructor <br/></td></tr>
<tr class="memitem:a4cb6935d759ee0c75fa01b75e2d0ec04"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a4cb6935d759ee0c75fa01b75e2d0ec04">add_pattern</a> ($name, $pattern)</td></tr>
<tr class="memdesc:a4cb6935d759ee0c75fa01b75e2d0ec04"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allows the caller to add a predefined named pattern. <a href="#a4cb6935d759ee0c75fa01b75e2d0ec04"></a><br/></td></tr>
<tr class="memitem:a77abc2d2de424e73d1ee659fd9001e4a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a77abc2d2de424e73d1ee659fd9001e4a">bol</a> ()</td></tr>
<tr class="memdesc:a77abc2d2de424e73d1ee659fd9001e4a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Beginning of line? <a href="#a77abc2d2de424e73d1ee659fd9001e4a"></a><br/></td></tr>
<tr class="memitem:ae483fc35eae064c75f8b5ca105826757"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#ae483fc35eae064c75f8b5ca105826757">check</a> ($pattern)</td></tr>
<tr class="memdesc:ae483fc35eae064c75f8b5ca105826757"><td class="mdescLeft">&#160;</td><td class="mdescRight">Non-consuming lookahead. <a href="#ae483fc35eae064c75f8b5ca105826757"></a><br/></td></tr>
<tr class="memitem:a8ad6032d3a1f955608905c10a864aee6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a8ad6032d3a1f955608905c10a864aee6">eol</a> ()</td></tr>
<tr class="memdesc:a8ad6032d3a1f955608905c10a864aee6"><td class="mdescLeft">&#160;</td><td class="mdescRight">End of line? <a href="#a8ad6032d3a1f955608905c10a864aee6"></a><br/></td></tr>
<tr class="memitem:a23543739aee09e2e1961a556a9672c7d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a23543739aee09e2e1961a556a9672c7d">eos</a> ()</td></tr>
<tr class="memdesc:a23543739aee09e2e1961a556a9672c7d"><td class="mdescLeft">&#160;</td><td class="mdescRight">End of string? <a href="#a23543739aee09e2e1961a556a9672c7d"></a><br/></td></tr>
<tr class="memitem:a154d424c925ed0d58e033f1e71ceef03"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a154d424c925ed0d58e033f1e71ceef03">get</a> ($n=1)</td></tr>
<tr class="memdesc:a154d424c925ed0d58e033f1e71ceef03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Consume a given number of bytes. <a href="#a154d424c925ed0d58e033f1e71ceef03"></a><br/></td></tr>
<tr class="memitem:ac8beec743c18d54cec51273b3bb7f3b5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#ac8beec743c18d54cec51273b3bb7f3b5">get_next</a> ($patterns)</td></tr>
<tr class="memdesc:ac8beec743c18d54cec51273b3bb7f3b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Look for the next occurrence of a set of patterns. <a href="#ac8beec743c18d54cec51273b3bb7f3b5"></a><br/></td></tr>
<tr class="memitem:a21f59cd38d7ed3ccd43955386b6aa14e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a21f59cd38d7ed3ccd43955386b6aa14e">get_next_named</a> ($patterns)</td></tr>
<tr class="memdesc:a21f59cd38d7ed3ccd43955386b6aa14e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find the index of the next occurrence of a named pattern. <a href="#a21f59cd38d7ed3ccd43955386b6aa14e"></a><br/></td></tr>
<tr class="memitem:a57774c7a298bb43c1c4406a830d386a6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a57774c7a298bb43c1c4406a830d386a6">get_next_strpos</a> ($patterns)</td></tr>
<tr class="memdesc:a57774c7a298bb43c1c4406a830d386a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Look for the next occurrence of a set of substrings. <a href="#a57774c7a298bb43c1c4406a830d386a6"></a><br/></td></tr>
<tr class="memitem:a90bacd70c30eb1d76659c0586f0683d2"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a90bacd70c30eb1d76659c0586f0683d2">index</a> ($pattern)</td></tr>
<tr class="memdesc:a90bacd70c30eb1d76659c0586f0683d2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find the index of the next occurrence of a pattern. <a href="#a90bacd70c30eb1d76659c0586f0683d2"></a><br/></td></tr>
<tr class="memitem:a17ac6e2abcb54a6dfaa9abaf95ed839e"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a17ac6e2abcb54a6dfaa9abaf95ed839e">match</a> ()</td></tr>
<tr class="memdesc:a17ac6e2abcb54a6dfaa9abaf95ed839e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the result of the most recent match operation. <a href="#a17ac6e2abcb54a6dfaa9abaf95ed839e"></a><br/></td></tr>
<tr class="memitem:aa933ee80eb310785c75ab7b03ed01885"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#aa933ee80eb310785c75ab7b03ed01885">match_group</a> ($g=0)</td></tr>
<tr class="memdesc:aa933ee80eb310785c75ab7b03ed01885"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a group from the most recent match operation. <a href="#aa933ee80eb310785c75ab7b03ed01885"></a><br/></td></tr>
<tr class="memitem:a9271f0acf8d19f83fa45ee3ee1d3eab5"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a9271f0acf8d19f83fa45ee3ee1d3eab5">match_groups</a> ()</td></tr>
<tr class="memdesc:a9271f0acf8d19f83fa45ee3ee1d3eab5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the match groups of the most recent match operation. <a href="#a9271f0acf8d19f83fa45ee3ee1d3eab5"></a><br/></td></tr>
<tr class="memitem:aa5520e0fc7df54d7a25d75037e6cdc8a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#aa5520e0fc7df54d7a25d75037e6cdc8a">match_pos</a> ()</td></tr>
<tr class="memdesc:aa5520e0fc7df54d7a25d75037e6cdc8a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the position (offset) of the most recent match. <a href="#aa5520e0fc7df54d7a25d75037e6cdc8a"></a><br/></td></tr>
<tr class="memitem:a5e03667fd1cdc1d1fd40a4bc15570b12"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a5e03667fd1cdc1d1fd40a4bc15570b12">next_match</a> ($consume_and_log=true)</td></tr>
<tr class="memdesc:a5e03667fd1cdc1d1fd40a4bc15570b12"><td class="mdescLeft">&#160;</td><td class="mdescRight">Automation function: returns the next occurrence of any known patterns. <a href="#a5e03667fd1cdc1d1fd40a4bc15570b12"></a><br/></td></tr>
<tr class="memitem:a3028e787442cf1ed9252397ed029b223"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a3028e787442cf1ed9252397ed029b223">peek</a> ($n=1)</td></tr>
<tr class="memdesc:a3028e787442cf1ed9252397ed029b223"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lookahead into the string a given number of bytes. <a href="#a3028e787442cf1ed9252397ed029b223"></a><br/></td></tr>
<tr class="memitem:a546cafdcfc3adeb19959ae14dff10996"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a546cafdcfc3adeb19959ae14dff10996">pos</a> ($new_pos=null)</td></tr>
<tr class="memdesc:a546cafdcfc3adeb19959ae14dff10996"><td class="mdescLeft">&#160;</td><td class="mdescRight">Getter and setter for the current position (string pointer). <a href="#a546cafdcfc3adeb19959ae14dff10996"></a><br/></td></tr>
<tr class="memitem:a947d15fe4bd13b64afd5eaba8d4d3819"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a947d15fe4bd13b64afd5eaba8d4d3819">pos_shift</a> ($offset)</td></tr>
<tr class="memdesc:a947d15fe4bd13b64afd5eaba8d4d3819"><td class="mdescLeft">&#160;</td><td class="mdescRight">Moves the string pointer by a given offset. <a href="#a947d15fe4bd13b64afd5eaba8d4d3819"></a><br/></td></tr>
<tr class="memitem:a79c559549e2dd73c3f1892e7609e84a6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a79c559549e2dd73c3f1892e7609e84a6">remove_pattern</a> ($name)</td></tr>
<tr class="memdesc:a79c559549e2dd73c3f1892e7609e84a6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allows the caller to remove a named pattern. <a href="#a79c559549e2dd73c3f1892e7609e84a6"></a><br/></td></tr>
<tr class="memitem:a89d1448f666d1be3d5037c69f24eb516"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a89d1448f666d1be3d5037c69f24eb516">reset</a> ()</td></tr>
<tr class="memdesc:a89d1448f666d1be3d5037c69f24eb516"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reset the scanner. <a href="#a89d1448f666d1be3d5037c69f24eb516"></a><br/></td></tr>
<tr class="memitem:aeae50ecaf6b98a0b76f47c3d04b8deb3"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#aeae50ecaf6b98a0b76f47c3d04b8deb3">rest</a> ()</td></tr>
<tr class="memdesc:aeae50ecaf6b98a0b76f47c3d04b8deb3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the remaining string. <a href="#aeae50ecaf6b98a0b76f47c3d04b8deb3"></a><br/></td></tr>
<tr class="memitem:a78ddb203c30c2f9e69755ec00c341add"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a78ddb203c30c2f9e69755ec00c341add">scan</a> ($pattern)</td></tr>
<tr class="memdesc:a78ddb203c30c2f9e69755ec00c341add"><td class="mdescLeft">&#160;</td><td class="mdescRight">Scans at the current pointer. <a href="#a78ddb203c30c2f9e69755ec00c341add"></a><br/></td></tr>
<tr class="memitem:aa0e261d4b0c2fce43ba3c264036afd72"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#aa0e261d4b0c2fce43ba3c264036afd72">scan_until</a> ($pattern)</td></tr>
<tr class="memdesc:aa0e261d4b0c2fce43ba3c264036afd72"><td class="mdescLeft">&#160;</td><td class="mdescRight">Scans until the start of a pattern. <a href="#aa0e261d4b0c2fce43ba3c264036afd72"></a><br/></td></tr>
<tr class="memitem:a577a70297f4d3da0aa2ce4decc66eeea"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a577a70297f4d3da0aa2ce4decc66eeea">string</a> ($s=null)</td></tr>
<tr class="memdesc:a577a70297f4d3da0aa2ce4decc66eeea"><td class="mdescLeft">&#160;</td><td class="mdescRight">Getter and setter for the source string. <a href="#a577a70297f4d3da0aa2ce4decc66eeea"></a><br/></td></tr>
<tr class="memitem:a185d6e780752848cb282add6d9f936bb"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a185d6e780752848cb282add6d9f936bb">terminate</a> ()</td></tr>
<tr class="memdesc:a185d6e780752848cb282add6d9f936bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Ends scanning of a string. <a href="#a185d6e780752848cb282add6d9f936bb"></a><br/></td></tr>
<tr class="memitem:a6f6665b8df561788b1b2dea40bb394ae"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a6f6665b8df561788b1b2dea40bb394ae">unscan</a> ()</td></tr>
<tr class="memdesc:a6f6665b8df561788b1b2dea40bb394ae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Revert the most recent scanning operation. <a href="#a6f6665b8df561788b1b2dea40bb394ae"></a><br/></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr class="memitem:ad1d5baf8c44c848eb7625ccf71d2e98b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#ad1d5baf8c44c848eb7625ccf71d2e98b">__check</a> ($pattern, $instant=true, $consume=true, $consume_match=true, $log=true)</td></tr>
<tr class="memdesc:ad1d5baf8c44c848eb7625ccf71d2e98b"><td class="mdescLeft">&#160;</td><td class="mdescRight">The real scanning function. <a href="#ad1d5baf8c44c848eb7625ccf71d2e98b"></a><br/></td></tr>
<tr class="memitem:ad2854d57ce631547fca7d250a67dfb5d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#ad2854d57ce631547fca7d250a67dfb5d">__consume</a> ($<a class="el" href="classScanner.html#a546cafdcfc3adeb19959ae14dff10996">pos</a>, $consume_match, $match_data)</td></tr>
<tr class="memdesc:ad2854d57ce631547fca7d250a67dfb5d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper function to consume a match. <a href="#ad2854d57ce631547fca7d250a67dfb5d"></a><br/></td></tr>
<tr class="memitem:a3b0b80f32a1dfd96c8cd9b7fe7f3f759"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a3b0b80f32a1dfd96c8cd9b7fe7f3f759">__log_match</a> ($<a class="el" href="classScanner.html#a90bacd70c30eb1d76659c0586f0683d2">index</a>, $<a class="el" href="classScanner.html#aa5520e0fc7df54d7a25d75037e6cdc8a">match_pos</a>, $match_data)</td></tr>
<tr class="memdesc:a3b0b80f32a1dfd96c8cd9b7fe7f3f759"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper function to log a match into the history. <a href="#a3b0b80f32a1dfd96c8cd9b7fe7f3f759"></a><br/></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:a1df8db865da4a56e83848e66c2fdd86c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1df8db865da4a56e83848e66c2fdd86c"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a1df8db865da4a56e83848e66c2fdd86c">$index</a></td></tr>
<tr class="memdesc:a1df8db865da4a56e83848e66c2fdd86c"><td class="mdescLeft">&#160;</td><td class="mdescRight">The current scan pointer (AKA the offset or index) <br/></td></tr>
<tr class="memitem:a7ffc9d830a0a2a0468f23e6150f662ab"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a7ffc9d830a0a2a0468f23e6150f662ab">$match_history</a> = array(null, null)</td></tr>
<tr class="memdesc:a7ffc9d830a0a2a0468f23e6150f662ab"><td class="mdescLeft">&#160;</td><td class="mdescRight">Match history. <a href="#a7ffc9d830a0a2a0468f23e6150f662ab"></a><br/></td></tr>
<tr class="memitem:ae07cbb19db97a18f93090e761243d890"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae07cbb19db97a18f93090e761243d890"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#ae07cbb19db97a18f93090e761243d890">$patterns</a> = array()</td></tr>
<tr class="memdesc:ae07cbb19db97a18f93090e761243d890"><td class="mdescLeft">&#160;</td><td class="mdescRight">Caller defined patterns used by <a class="el" href="classScanner.html#a5e03667fd1cdc1d1fd40a4bc15570b12" title="Automation function: returns the next occurrence of any known patterns.">next_match()</a> <br/></td></tr>
<tr class="memitem:a289bba9fedd00d7e2219d30f547ac392"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a289bba9fedd00d7e2219d30f547ac392"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a289bba9fedd00d7e2219d30f547ac392">$src</a></td></tr>
<tr class="memdesc:a289bba9fedd00d7e2219d30f547ac392"><td class="mdescLeft">&#160;</td><td class="mdescRight">Our local copy of the input string to be scanned. <br/></td></tr>
<tr class="memitem:a3d1a7f67acfa79b0ea574418e4a478a7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3d1a7f67acfa79b0ea574418e4a478a7"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a3d1a7f67acfa79b0ea574418e4a478a7">$src_len</a></td></tr>
<tr class="memdesc:a3d1a7f67acfa79b0ea574418e4a478a7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Length of input string (cached for performance) <br/></td></tr>
<tr class="memitem:a26970234bb2dde880548b084a0ade5e2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a26970234bb2dde880548b084a0ade5e2"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classScanner.html#a26970234bb2dde880548b084a0ade5e2">$ss</a></td></tr>
<tr class="memdesc:a26970234bb2dde880548b084a0ade5e2"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="classLuminousStringSearch.html" title="A basic preg_match wrapper which caches its results.">LuminousStringSearch</a> instance (caches preg_* results) <br/></td></tr>
</table>
<a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Base string scanning class. </p>
<p>The <a class="el" href="classScanner.html" title="Base string scanning class.">Scanner</a> class is the base class which handles traversing a string while searching for various different tokens. It is loosely based on Ruby's StringScanner.</p>
<p>The rough idea is we keep track of the position (a string pointer) and use <a class="el" href="classScanner.html#a78ddb203c30c2f9e69755ec00c341add" title="Scans at the current pointer.">scan()</a> to see what matches at the current position.</p>
<p>It also provides some automation methods, but it's fairly low-level as regards string scanning.</p>
<p><a class="el" href="classScanner.html" title="Base string scanning class.">Scanner</a> is abstract as far as Luminous is concerned. <a class="el" href="classLuminousScanner.html" title="the base class for all scanners">LuminousScanner</a> extends <a class="el" href="classScanner.html" title="Base string scanning class.">Scanner</a> significantly with some methods which are useful for recording highlighting related data.</p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classLuminousScanner.html" title="the base class for all scanners">LuminousScanner</a> </dd></dl>
</div><h2>Member Function Documentation</h2>
<a class="anchor" id="ad1d5baf8c44c848eb7625ccf71d2e98b"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Scanner::__check </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$pattern</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$instant</em> = <code>true</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$consume</em> = <code>true</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$consume_match</em> = <code>true</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$log</em> = <code>true</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>The real scanning function. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$pattern</td><td>The pattern to scan for </td></tr>
<tr><td class="paramname">$instant</td><td>Whether or not the only legal match is at the current scan pointer or whether one beyond the scan pointer is also legal. </td></tr>
<tr><td class="paramname">$consume</td><td>Whether or not to consume string as a result of matching </td></tr>
<tr><td class="paramname">$consume_match</td><td>Whether or not to consume the actual matched string. This only has effect if $consume is <code>TRUE</code>. If $instant is <code>TRUE</code>, $consume is true and $consume_match is <code>FALSE</code>, the intermediate substring is consumed and the scan pointer moved to the beginning of the match, and the substring is recorded as a single-group match. </td></tr>
<tr><td class="paramname">$log</td><td>whether or not to log the matches into the match_register </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The matched string or null. This is subsequently equivalent to <a class="el" href="classScanner.html#a17ac6e2abcb54a6dfaa9abaf95ed839e" title="Get the result of the most recent match operation.">match()</a> or <a class="el" href="classScanner.html#a9271f0acf8d19f83fa45ee3ee1d3eab5" title="Get the match groups of the most recent match operation.">match_groups()</a>[0] or match_group(0). </dd></dl>
</div>
</div>
<a class="anchor" id="ad2854d57ce631547fca7d250a67dfb5d"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Scanner::__consume </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$pos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$consume_match</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$match_data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Helper function to consume a match. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$pos</td><td>(int) The match position </td></tr>
<tr><td class="paramname">$consume_match</td><td>(bool) Whether or not to consume the actual matched text </td></tr>
<tr><td class="paramname">$match_data</td><td>The matching groups, as returned by PCRE. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a3b0b80f32a1dfd96c8cd9b7fe7f3f759"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Scanner::__log_match </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$index</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$match_pos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$match_data</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Helper function to log a match into the history. </p>
</div>
</div>
<a class="anchor" id="a4cb6935d759ee0c75fa01b75e2d0ec04"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::add_pattern </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$pattern</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allows the caller to add a predefined named pattern. </p>
<p>Adds a predefined pattern which is visible to next_match.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$name</td><td>A name for the pattern. This does not have to be unique. </td></tr>
<tr><td class="paramname">$pattern</td><td>A regular expression pattern. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a77abc2d2de424e73d1ee659fd9001e4a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::bol </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Beginning of line? </p>
<dl class="section return"><dt>Returns</dt><dd><code>TRUE</code> if the scan pointer is at the beginning of a line (i.e. immediately following a newline character), or at the beginning of the string, else <code>FALSE</code> </dd></dl>
</div>
</div>
<a class="anchor" id="ae483fc35eae064c75f8b5ca105826757"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::check </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$pattern</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Non-consuming lookahead. </p>
<p>Looks for the given pattern at the current index and logs it if it is found, but does not consume it. This is a look-ahead. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$pattern</td><td>the pattern to search for </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>null</code> if not found, else the matched string. </dd></dl>
</div>
</div>
<a class="anchor" id="a8ad6032d3a1f955608905c10a864aee6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::eol </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>End of line? </p>
<dl class="section return"><dt>Returns</dt><dd><code>TRUE</code> if the scan pointer is at the end of a line (i.e. immediately preceding a newline character), or at the end of the string, else <code>FALSE</code> </dd></dl>
</div>
</div>
<a class="anchor" id="a23543739aee09e2e1961a556a9672c7d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::eos </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>End of string? </p>
<dl class="section return"><dt>Returns</dt><dd><code>TRUE</code> if the scan pointer at the end of the string, else <code>FALSE</code>. </dd></dl>
</div>
</div>
<a class="anchor" id="a154d424c925ed0d58e033f1e71ceef03"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::get </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$n</em> = <code>1</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Consume a given number of bytes. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$n</td><td>The number of bytes. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The given number of bytes from the string from the current scan pointer onwards. The returned string will be at most n bytes long, it may be shorter or the empty string if the scanner is in the termination position.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This method is identitical to <a class="el" href="classScanner.html#a3028e787442cf1ed9252397ed029b223" title="Lookahead into the string a given number of bytes.">peek()</a>, but it does consume the string. </dd>
<dd>
neither get nor peek logs its matches into the match history. </dd></dl>
</div>
</div>
<a class="anchor" id="ac8beec743c18d54cec51273b3bb7f3b5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::get_next </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$patterns</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Look for the next occurrence of a set of patterns. </p>
<p>Finds the next match of the given patterns and returns it. The string is not consumed or logged. Convenience function. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$patterns</td><td>an array of regular expressions </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>an array of (0=&gt;index, 1=&gt;match_groups). The index may be -1 if no pattern is found. </dd></dl>
</div>
</div>
<a class="anchor" id="a21f59cd38d7ed3ccd43955386b6aa14e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::get_next_named </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$patterns</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Find the index of the next occurrence of a named pattern. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$patterns</td><td>A map of $name=&gt;$pattern </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>An array: ($name, $index, $matches). If there is no next match, name will be null, index will be -1 and matches will be null.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>consider using this method to build a transition table </dd></dl>
</div>
</div>
<a class="anchor" id="a57774c7a298bb43c1c4406a830d386a6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::get_next_strpos </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$patterns</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Look for the next occurrence of a set of substrings. </p>
<p>Like <a class="el" href="classScanner.html#ac8beec743c18d54cec51273b3bb7f3b5" title="Look for the next occurrence of a set of patterns.">get_next()</a> but uses strpos instead of preg_* </p>
<dl class="section return"><dt>Returns</dt><dd>An array: 0 =&gt; index 1 =&gt; substring. If the substring is not found, index is -1 and substring is null </dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classScanner.html#ac8beec743c18d54cec51273b3bb7f3b5" title="Look for the next occurrence of a set of patterns.">get_next()</a> </dd></dl>
</div>
</div>
<a class="anchor" id="a90bacd70c30eb1d76659c0586f0683d2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::index </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$pattern</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Find the index of the next occurrence of a pattern. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$pattern</td><td>the pattern to search for </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The next index of the pattern, or -1 if it is not found </dd></dl>
</div>
</div>
<a class="anchor" id="a17ac6e2abcb54a6dfaa9abaf95ed839e"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::match </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the result of the most recent match operation. </p>
<dl class="section return"><dt>Returns</dt><dd>The return value is either a string or <code>NULL</code> depending on whether or not the most recent scanning function matched anything.</dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname">Exception</td><td>if no matches have been recorded. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="aa933ee80eb310785c75ab7b03ed01885"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::match_group </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$g</em> = <code>0</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get a group from the most recent match operation. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$g</td><td>the group's numerical index or name, in the case of named subpatterns. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A string represeting the group's contents.</dd></dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classScanner.html#a9271f0acf8d19f83fa45ee3ee1d3eab5" title="Get the match groups of the most recent match operation.">match_groups()</a></dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname">Exception</td><td>if no matches have been recorded. </td></tr>
<tr><td class="paramname">Exception</td><td>if matches have been recorded, but the group does not exist. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a9271f0acf8d19f83fa45ee3ee1d3eab5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::match_groups </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the match groups of the most recent match operation. </p>
<dl class="section return"><dt>Returns</dt><dd>The return value is either an array/map or <code>NULL</code> depending on whether or not the most recent scanning function was successful. The map is the same as PCRE returns, i.e. group_name =&gt; match_string, where group_name may be a string or numerical index.</dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname">Exception</td><td>if no matches have been recorded. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="aa5520e0fc7df54d7a25d75037e6cdc8a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::match_pos </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the position (offset) of the most recent match. </p>
<dl class="section return"><dt>Returns</dt><dd>The position, as integer. This is a standard zero-indexed offset into the string. It is independent of the scan pointer.</dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname">Exception</td><td>if no matches have been recorded. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="a5e03667fd1cdc1d1fd40a4bc15570b12"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::next_match </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$consume_and_log</em> = <code>true</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Automation function: returns the next occurrence of any known patterns. </p>
<p>Iterates over the predefined patterns array (add_pattern) and consumes/logs the nearest match, skipping unrecognised segments of string. </p>
<dl class="section return"><dt>Returns</dt><dd>An array: 0 =&gt; pattern name (as given to add_pattern) 1 =&gt; match index (although the scan pointer will have progressed to the end of the match if the pattern is consumed). When no more matches are found, return value is <code>NULL</code> and nothing is logged.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$consume_and_log</td><td>If this is <code>FALSE</code>, the pattern is not consumed or logged.</td></tr>
</table>
</dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd>this method is not the same as get_next. This does not return the match groups, instead it returns a name. The ordering of the return array is also different, but the array does in fact hold different data. </dd></dl>
</div>
</div>
<a class="anchor" id="a3028e787442cf1ed9252397ed029b223"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::peek </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$n</em> = <code>1</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Lookahead into the string a given number of bytes. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$n</td><td>The number of bytes. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The given number of bytes from the string from the current scan pointer onwards. The returned string will be at most n bytes long, it may be shorter or the empty string if the scanner is in the termination position.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This method is identitical to <a class="el" href="classScanner.html#a154d424c925ed0d58e033f1e71ceef03" title="Consume a given number of bytes.">get()</a>, but it does not consume the string. </dd>
<dd>
neither get nor peek logs its matches into the match history. </dd></dl>
</div>
</div>
<a class="anchor" id="a546cafdcfc3adeb19959ae14dff10996"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::pos </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$new_pos</em> = <code>null</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Getter and setter for the current position (string pointer). </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$new_pos</td><td>The new position (leave <code>NULL</code> to use as a getter), note that this will be clipped to a legal string index if you specify a negative number or an index greater than the string's length. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the current string pointer </dd></dl>
</div>
</div>
<a class="anchor" id="a947d15fe4bd13b64afd5eaba8d4d3819"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::pos_shift </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$offset</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Moves the string pointer by a given offset. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$offset</td><td>the offset by which to move the pointer. This can be positve or negative, but using a negative offset is currently generally unsafe. You should use <a class="el" href="classScanner.html#a6f6665b8df561788b1b2dea40bb394ae" title="Revert the most recent scanning operation.">unscan()</a> to revert the last operation. </td></tr>
</table>
</dd>
</dl>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classScanner.html#a546cafdcfc3adeb19959ae14dff10996" title="Getter and setter for the current position (string pointer).">pos</a> </dd>
<dd>
<a class="el" href="classScanner.html#a6f6665b8df561788b1b2dea40bb394ae" title="Revert the most recent scanning operation.">unscan</a> </dd></dl>
</div>
</div>
<a class="anchor" id="a79c559549e2dd73c3f1892e7609e84a6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::remove_pattern </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$name</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allows the caller to remove a named pattern. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$name</td><td>the name of the pattern to remove, this should be as it was supplied to <a class="el" href="classScanner.html#a4cb6935d759ee0c75fa01b75e2d0ec04" title="Allows the caller to add a predefined named pattern.">add_pattern()</a>. </td></tr>
</table>
</dd>
</dl>
<dl class="section warning"><dt>Warning</dt><dd>If there are multiple patterns with the same name, they will all be removed. </dd></dl>
</div>
</div>
<a class="anchor" id="a89d1448f666d1be3d5037c69f24eb516"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::reset </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reset the scanner. </p>
<p>Resets the scanner: sets the scan pointer to 0 and clears the match history. </p>
</div>
</div>
<a class="anchor" id="aeae50ecaf6b98a0b76f47c3d04b8deb3"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::rest </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets the remaining string. </p>
<dl class="section return"><dt>Returns</dt><dd>The rest of the string, which has not yet been consumed </dd></dl>
</div>
</div>
<a class="anchor" id="a78ddb203c30c2f9e69755ec00c341add"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::scan </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$pattern</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Scans at the current pointer. </p>
<p>Looks for the given pattern at the current index and consumes and logs it if it is found. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$pattern</td><td>the pattern to search for </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>null</code> if not found, else the full match. </dd></dl>
</div>
</div>
<a class="anchor" id="aa0e261d4b0c2fce43ba3c264036afd72"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::scan_until </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$pattern</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Scans until the start of a pattern. </p>
<p>Looks for the given pattern anywhere beyond the current index and advances the scan pointer to the start of the pattern. The match is logged.</p>
<p>The match itself is not consumed.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$pattern</td><td>the pattern to search for </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The substring between here and the given pattern, or <code>null</code> if it is not found. </dd></dl>
</div>
</div>
<a class="anchor" id="a577a70297f4d3da0aa2ce4decc66eeea"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::string </td>
<td>(</td>
<td class="paramtype">&#160;</td>
<td class="paramname"><em>$s</em> = <code>null</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Getter and setter for the source string. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">$s</td><td>The new source string (leave as <code>NULL</code> to use this method as a getter) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The current source string</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This method triggers a <a class="el" href="classScanner.html#a89d1448f666d1be3d5037c69f24eb516" title="Reset the scanner.">reset()</a> </dd>
<dd>
Any strings passed into this method are converted to Unix line endings, i.e. <code>\n</code> </dd></dl>
<p>Reimplemented in <a class="el" href="classLuminousEmbeddedWebScript.html#a468d0f77b948817731d32f866b360586">LuminousEmbeddedWebScript</a>.</p>
</div>
</div>
<a class="anchor" id="a185d6e780752848cb282add6d9f936bb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::terminate </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Ends scanning of a string. </p>
<p>Moves the scan pointer to the end of the string, terminating the current scan. </p>
</div>
</div>
<a class="anchor" id="a6f6665b8df561788b1b2dea40bb394ae"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Scanner::unscan </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Revert the most recent scanning operation. </p>
<p>Unscans the most recent match. The match is removed from the history, and the scan pointer is moved to where it was before the match.</p>
<p>Calls to <a class="el" href="classScanner.html#a154d424c925ed0d58e033f1e71ceef03" title="Consume a given number of bytes.">get()</a>, and <a class="el" href="classScanner.html#a3028e787442cf1ed9252397ed029b223" title="Lookahead into the string a given number of bytes.">peek()</a> are not logged and are therefore not unscannable.</p>
<dl class="section warning"><dt>Warning</dt><dd>Do not call unscan more than once before calling a scanning function. This is not currently defined. </dd></dl>
</div>
</div>
<h2>Member Data Documentation</h2>
<a class="anchor" id="a7ffc9d830a0a2a0468f23e6150f662ab"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">Scanner::$match_history = array(null, null)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Match history. </p>
<p>History of matches. This is an array (queue), which should have at most two elements. Each element consists of an array:</p>
<p>0 =&gt; Scan pointer when the match was found, 1 =&gt; Match index (probably the same as scan pointer, but not necessarily), 2 =&gt; Match data (match groups, as map, as returned by PCRE)</p>
<dl class="section note"><dt>Note</dt><dd>Numerical indices are used for performance. </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>src/core/<a class="el" href="scanner_8class_8php.html">scanner.class.php</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sat Jan 12 2013 16:03:51 for Luminous by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>