Popular recipes tagged "parser" but not "crawler"http://code.activestate.com/recipes/tags/parser-crawler/2013-05-27T05:32:07-07:00ActiveState Code Recipeseasyjson.py - parsing JSON from buffer and from file (Python)
2013-05-27T05:32:07-07:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/578529-easyjsonpy-parsing-json-from-buffer-and-from-file/
<p style="color: grey">
Python
recipe 578529
by <a href="/recipes/users/4174477/">Thomas Lehmann</a>
(<a href="/recipes/tags/json/">json</a>, <a href="/recipes/tags/parser/">parser</a>).
Revision 4.
</p>
<p><strong>JSON Parser</strong>:</p>
<ul>
<li>Refering to <a href="http://www.json.org/" rel="nofollow">http://www.json.org/</a></li>
<li>Just one simple Python file you can integrate where you want to</li>
<li>No imports (very important) -> no dependencies!!!</li>
<li>Should work with really older versions of Python!!!</li>
</ul>
<p><strong>Todo's</strong>:</p>
<ul>
<li>Doesn't cover full number format</li>
<li>...</li>
</ul>
<p><strong>Done</strong></p>
<ul>
<li>Allows string in string (revision 2)</li>
<li>Covers objects in an array (revision 2)</li>
<li>Provides a mechanism to allow other dictionaries (like collections.OrderedDict) (revision 3)</li>
<li>Conversion of numbers to integer or float types (revision 4)</li>
</ul>
slurp.py (Regex based simple parsing engine) (Python)
2013-05-26T18:00:58-07:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/578532-slurppy-regex-based-simple-parsing-engine/
<p style="color: grey">
Python
recipe 578532
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/parser/">parser</a>, <a href="/recipes/tags/regex/">regex</a>, <a href="/recipes/tags/text_processing/">text_processing</a>).
</p>
<p>A parsing engine that allows you to define sets of patterns and callbacks, and process any I/O object in Pyton that has a readline() method.</p>
Parser Keylogger based on a Finite State Machine (Python)
2011-11-21T14:53:52-08:00Filippo Squillacehttp://code.activestate.com/recipes/users/4174931/http://code.activestate.com/recipes/577952-parser-keylogger-based-on-a-finite-state-machine/
<p style="color: grey">
Python
recipe 577952
by <a href="/recipes/users/4174931/">Filippo Squillace</a>
(<a href="/recipes/tags/keylogger/">keylogger</a>, <a href="/recipes/tags/parser/">parser</a>, <a href="/recipes/tags/state_machine/">state_machine</a>).
Revision 3.
</p>
<p>This program parses the logfile given by the execution of the keylogger
command <strong>'script -c "xinput test ID_CODE" | cat LOG_FILE'</strong> and
it is based on a Finite State Machine (FSM) to manage all
the possible combinations of the modifiers that represent the state of the FSM.
The parser gets the mapping between the couple of keycode and modifier typed
and the corresponding char by xmodmap command. The parser is able to manage also extended
combinations such as Control or Super that don't give a real char.
To introduce new possible states that represent new combinations between modifiers,
it's just necessary to update the list of state (<em>mod_keys</em>) and add new rules in the transition function properly.
For example to introduce the Caps Lock state just add it in mod_keys and the data structure transition has to handle
the release event of the corresponding key.
For the dependency of xmodmap the parser works only in X11 based systems.</p>
Evaluator 2.0 (Python)
2010-11-25T18:24:09-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/577469-evaluator-20/
<p style="color: grey">
Python
recipe 577469
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/evaluator/">evaluator</a>, <a href="/recipes/tags/expressions/">expressions</a>, <a href="/recipes/tags/math/">math</a>, <a href="/recipes/tags/parser/">parser</a>).
</p>
<p>This is a complete rewrite of <a href="http://code.activestate.com/recipes/576790/">recipe 576790</a>. While aiming to maintain similar functionality and continuing its implementation for self-academic purposes, a much cleaner parser / tokenizer and operator execution engine were developed. A slightly different math syntax is supported in this version, but it is arguably better and more capable than it previously was. Base prefixes are a feature now supported, and the single downgrade is calculating with integers instead of floats.</p>