Commit 73000d4c authored by eckhart's avatar eckhart

- StepByStepGuide: minor corrections

parent 76941898
......@@ -208,9 +208,9 @@ class StringView(collections.abc.Sized):
def match(self, regex, flags=0):
"""Executes `regex.match` on the StringView object and returns the
result, which is either a match-object or None.
WARNING: match.end(), match.span() etc. are mapped to the underlying text,
not the StringView-object!!!
result, which is either a match-object or None. Keep in mind that
match.end(), match.span() etc. are mapped to the underlying text,
not the StringView-object!!!
"""
return regex.match(self.text, pos=self.begin, endpos=self.end)
......@@ -236,17 +236,16 @@ class StringView(collections.abc.Sized):
def search(self, regex):
"""Executes regex.search on the StringView object and returns the
result, which is either a match-object or None.
WARNING: match.end(), match.span() etc. are mapped to the underlying text,
not the StringView-object!!!
result, which is either a match-object or None. Keep in mind that
match.end(), match.span() etc. are mapped to the underlying text,
not the StringView-object!!!
"""
return regex.search(self.text, pos=self.begin, endpos=self.end)
def finditer(self, regex):
"""Executes regex.finditer on the StringView object and returns the
iterator of match objects.
WARNING: match.end(), match.span() etc. are mapped to the underlying text,
not the StringView-object!!!
iterator of match objects. Keep in mind that match.end(), match.span()
etc. are mapped to the underlying text, not the StringView-object!!!
"""
return regex.finditer(self.text, pos=self.begin, endpos=self.end)
......
......@@ -920,4 +920,3 @@ def forbid(context: List[Node], child_tags: AbstractSet[str]):
if child.tag_name in child_tags:
context[0].new_error(node, 'Element "%s" cannot be nested inside "%s".' %
(child.parser.name, node.parser.name))
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: a864fbe9973eb04d25fc99fca3d8ce3e
tags: 645f666f9bcd5a90fca523b33c5a78b7
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DHParser User’s Guide &mdash; DHParser 0.8 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="DHParser Reference Manual" href="ReferenceManual.html" />
<link rel="prev" title="DHParser’s Step by Step Guide" href="StepByStepGuide.html" />
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> DHParser
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="StepByStepGuide.html">DHParser’s Step by Step Guide</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">DHParser User’s Guide</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#introduction">Introduction</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="ReferenceManual.html">DHParser Reference Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="ModuleReference.html">Module Reference</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">DHParser</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li>DHParser User’s Guide</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/UserGuide.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="dhparser-user-s-guide">
<h1>DHParser User’s Guide<a class="headerlink" href="#dhparser-user-s-guide" title="Permalink to this headline"></a></h1>
<p>This user’s guide explains how to use create, test and employ a domain
specific language with DHParser for encoding text or data in a Digital
Humanities Project.</p>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>Most Digital Humanities projects or least most text-centered DH projects
involve in some way or other the entering and encoding of annotated text or
data into a computer. And the systems that scientists use for that purpose
consist of an input surface (or “redactation system”) for entering the data, a
storage system to keep the data and a presentation system for providing the
data and possibly also functionality for working with the data to human or
machine receipients. A typical example of this type of system is Berlin’
Ediarum-System, which consists of an XML-Editor for entering data, an
XML-Database for storing the data and a web application for providing the data
to human readers or other web services via an application programming
interface (API). Ediarum is also typical, because like many DH-projects it
assumes an XML-based workflow.</p>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="ReferenceManual.html" class="btn btn-neutral float-right" title="DHParser Reference Manual" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="StepByStepGuide.html" class="btn btn-neutral" title="DHParser’s Step by Step Guide" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2018, Eckhart Arnold.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'0.8',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enableSticky();
});
</script>
</body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Overview: module code &mdash; DHParser 0.8 documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="../index.html" class="icon icon-home"> DHParser
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../StepByStepGuide.html">DHParser’s Step by Step Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../UserGuide.html">DHParser User’s Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ReferenceManual.html">DHParser Reference Manual</a></li>
<li class="toctree-l1"><a class="reference internal" href="../ModuleReference.html">Module Reference</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">DHParser</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> &raquo;</li>
<li>Overview: module code</li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<h1>All modules for which code is available</h1>
<ul><li><a href="DHParser/stringview.html">DHParser.stringview</a></li>
<li><a href="DHParser/syntaxtree.html">DHParser.syntaxtree</a></li>
<li><a href="compile.html">compile</a></li>
<li><a href="dsl.html">dsl</a></li>
<li><a href="ebnf.html">ebnf</a></li>
<li><a href="error.html">error</a></li>
<li><a href="log.html">log</a></li>
<li><a href="parse.html">parse</a></li>
<li><a href="preprocess.html">preprocess</a></li>
<li><a href="syntaxtree.html">syntaxtree</a></li>
<li><a href="testing.html">testing</a></li>
<li><a href="toolkit.html">toolkit</a></li>
<li><a href="transform.html">transform</a></li>
<li><a href="typing.html">typing</a></li>
</ul>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2018, Eckhart Arnold.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'0.8',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enableSticky();
});
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
****************
Module Reference
****************
DHParser is split into a number of modules plus one command line utility
(``dhparser.py``, which will not be described here.)
Usually, the user or "importer" of DHParser does not need to worry
about its internal module structure, because DHParser provides a flat
namespace form which all of its symbols can be imported, e.g.::
from DHParser import *
or::
from DHParser import recompile_grammar, grammar_suite, compile_source
However, in order to add or change the source code of DHParser, its module
structure must be understood. DHParser's modules can roughly be sorted into
three different categories:
1. Modules that contain the basic functionality for packrat-parsing,
AST-transformation and the skeleton for a DSL-compilers.
2. Modules for EBNF-Grammars and DSL compilation.
3. Support or "toolkit"-modules that contain different helpful functions
The import-order of DHParser's modules runs across these categories. In the
following list the modules further below in the list may import one or
more of the modules further above in the list, but not the other way round:
- versionnumber.py -- contains the verison number of DHParser
- toolkit.py -- utility functions for DHParser
- stringview.py -- a string class where slices are views not copies as
with the standard Python strings.
- preprocess.py -- preprocessing of source files for DHParser
- error.py -- error handling for DHParser
- syntaxtree.py -- syntax tree classes for DHParser
- transform.py -- transformation functions for converting the concrete
into the abstract syntax tree
- logging.py -- logging and debugging for DHParser
- parse.py -- parser combinators for for DHParser
- compile.py -- abstract base class for compilers that transform an AST
into something useful
- ebnf.py -- EBNF -> Python-Parser compilation for DHParser
- dsl.py -- Support for domain specific notations for DHParser
- testing.py -- test support for DHParser based grammars and compilers
Main Modules Reference
======================
The core of DHParser are the modules containing the functionality
for the parsing and compiling process. The modules ``preprocess``,
``parse``, ``transform`` and ``compile`` represent particular stages of the
parsing/compiling process, while ``syntaxtree`` and ``error`` define
classes for syntax trees and parser/compiler errors, respectively.
Module ``preprocess``
---------------------
.. automodule:: preprocess
:members:
Module ``syntaxtree``
---------------------
.. automodule:: syntaxtree
:members:
Module ``parse``
----------------
.. automodule:: parse
:members:
Module ``transform``
--------------------
.. automodule:: transform
:members:
Module ``compile``
--------------------
.. automodule:: compile
:members:
Module ``error``
----------------
.. automodule:: error
:members:
Domain Specific Language Modules Reference
==========================================
DHParser contains additional support for domain specific languages.
Module ``ebnf`` provides a self-hosting parser for EBNF-Grammars as
well as an EBNF-compiler that compiles an EBNF-Grammar into a
DHParser based Grammar class that can be executed to parse source text
conforming to this grammar into contrete syntax trees.
Module ``dsl`` contains additional functions to support the compilation
of arbitrary domain specific languages (DSL).
One very indispensable part of the systematic construction of domain
specific languages is testing. DHParser supports unit testing of
smaller as well as larger components of the Grammar of a DSL.
Module ``ebnf``
---------------
.. automodule:: ebnf
:members:
Module ``dsl``
--------------
.. automodule:: dsl
:members:
Module ``testing``
------------------
.. automodule:: testing
:members:
Supporting Modules Reference
============================
Finally, DHParser comprises a number of "toolkit"-modules which
define helpful functions and classes that will are used at different
places throughout the other DHParser-modules.
Module ``toolkit``
------------------
.. automodule:: toolkit
:members:
Module ``log``
--------------
.. automodule:: log
:members:
Module ``stringview``
---------------------
.. automodule:: stringview
:members:
Module ``versionnumber``