[Python-modules-commits] [simpleparse] 02/09: Import simpleparse_2.2.0.orig.tar.gz
Vincent Bernat
bernat at moszumanska.debian.org
Sun Dec 25 10:03:51 UTC 2016
This is an automated email from the git hooks/post-receive script.
bernat pushed a commit to branch master
in repository simpleparse.
commit 7d50954124663a123bd913ced1884e97fb87a8a3
Author: Vincent Bernat <bernat at debian.org>
Date: Sun Dec 25 10:38:35 2016 +0100
Import simpleparse_2.2.0.orig.tar.gz
---
MANIFEST.in | 4 +-
PKG-INFO | 7 +-
PKG-INFO => SimpleParse.egg-info/PKG-INFO | 7 +-
SimpleParse.egg-info/SOURCES.txt | 95 +
SimpleParse.egg-info/dependency_links.txt | 1 +
SimpleParse.egg-info/top_level.txt | 1 +
baseparser.py | 66 -
common/calendar_names.py | 102 -
common/chartypes.py | 83 -
common/iso_date.py | 148 --
common/iso_date_loose.py | 136 --
common/numbers.py | 187 --
common/strings.py | 161 --
common/timezone_names.py | 218 --
dispatchprocessor.py | 122 -
doc/index.html | 103 +-
doc/pydoc/__builtin__.html | 2438 --------------------
doc/pydoc/simpleparse.__init__.html | 18 -
doc/pydoc/simpleparse.baseparser.html | 320 ---
doc/pydoc/simpleparse.common.__init__.html | 40 -
doc/pydoc/simpleparse.common.calendar_names.html | 229 --
doc/pydoc/simpleparse.common.chartypes.html | 94 -
doc/pydoc/simpleparse.common.comments.html | 68 -
doc/pydoc/simpleparse.common.html | 240 --
doc/pydoc/simpleparse.common.iso_date.html | 148 --
doc/pydoc/simpleparse.common.iso_date_loose.html | 139 --
doc/pydoc/simpleparse.common.numbers.html | 272 ---
doc/pydoc/simpleparse.common.phonetics.html | 83 -
doc/pydoc/simpleparse.common.strings.html | 175 --
doc/pydoc/simpleparse.common.timezone_names.html | 157 --
doc/pydoc/simpleparse.dispatchprocessor.html | 88 -
doc/pydoc/simpleparse.error.html | 107 -
doc/pydoc/simpleparse.examples.__init__.html | 19 -
.../simpleparse.examples.bad_declaration.html | 36 -
doc/pydoc/simpleparse.examples.findlineset.html | 24 -
doc/pydoc/simpleparse.examples.findliterals.html | 41 -
doc/pydoc/simpleparse.examples.formatvrml.html | 80 -
doc/pydoc/simpleparse.examples.html | 33 -
doc/pydoc/simpleparse.examples.lisp.html | 40 -
doc/pydoc/simpleparse.examples.prebuilt_call.html | 337 ---
doc/pydoc/simpleparse.examples.py_ebnf.html | 76 -
doc/pydoc/simpleparse.examples.simpleexample.html | 31 -
.../simpleparse.examples.simpleexample2_1.html | 31 -
.../simpleparse.examples.simpleexample2_2.html | 38 -
.../simpleparse.examples.simpleexample2_3.html | 34 -
doc/pydoc/simpleparse.examples.transformation.html | 74 -
doc/pydoc/simpleparse.examples.vrml.html | 35 -
doc/pydoc/simpleparse.examples.vrml_erronfail.html | 49 -
doc/pydoc/simpleparse.generator.html | 113 -
doc/pydoc/simpleparse.html | 32 -
doc/pydoc/simpleparse.objectgenerator.html | 1190 ----------
doc/pydoc/simpleparse.parser.html | 298 ---
doc/pydoc/simpleparse.printers.html | 72 -
doc/pydoc/simpleparse.processor.html | 84 -
doc/pydoc/simpleparse.setup.html | 194 --
doc/pydoc/simpleparse.setupstt.html | 2119 -----------------
doc/pydoc/simpleparse.simpleparsegrammar.html | 469 ----
.../simpleparse.stt.TextTools.Constants.Sets.html | 63 -
...pleparse.stt.TextTools.Constants.TagTables.html | 82 -
...mpleparse.stt.TextTools.Constants.__init__.html | 14 -
doc/pydoc/simpleparse.stt.TextTools.Constants.html | 28 -
doc/pydoc/simpleparse.stt.TextTools.TextTools.html | 421 ----
doc/pydoc/simpleparse.stt.TextTools.__init__.html | 271 ---
doc/pydoc/simpleparse.stt.TextTools.html | 268 ---
.../simpleparse.stt.TextTools.mxTextTools.html | 205 --
doc/pydoc/simpleparse.stt.__init__.html | 33 -
doc/pydoc/simpleparse.stt.html | 41 -
doc/pydoc/simpleparse.tests.__init__.html | 20 -
doc/pydoc/simpleparse.tests.genericvalues.html | 63 -
doc/pydoc/simpleparse.tests.html | 34 -
doc/pydoc/simpleparse.tests.mx_flag.html | 441 ----
doc/pydoc/simpleparse.tests.mx_high.html | 441 ----
doc/pydoc/simpleparse.tests.mx_low.html | 485 ----
doc/pydoc/simpleparse.tests.mx_recursive.html | 445 ----
doc/pydoc/simpleparse.tests.mx_special.html | 478 ----
doc/pydoc/simpleparse.tests.mx_test.html | 35 -
doc/pydoc/simpleparse.tests.test.html | 51 -
...arse.tests.test_backup_on_subtable_failure.html | 34 -
.../simpleparse.tests.test_common_chartypes.html | 206 --
.../simpleparse.tests.test_common_comments.html | 197 --
.../simpleparse.tests.test_common_iso_date.html | 206 --
.../simpleparse.tests.test_common_numbers.html | 197 --
.../simpleparse.tests.test_common_strings.html | 197 --
doc/pydoc/simpleparse.tests.test_deep_nesting.html | 36 -
doc/pydoc/simpleparse.tests.test_erroronfail.html | 216 --
.../simpleparse.tests.test_grammarparser.html | 714 ------
.../simpleparse.tests.test_objectgenerator.html | 515 -----
doc/pydoc/simpleparse.tests.test_optimisation.html | 212 --
doc/pydoc/simpleparse.tests.test_printers.html | 382 ---
.../simpleparse.tests.test_printers_garbage.html | 288 ---
.../simpleparse.tests.test_simpleparsegrammar.html | 611 -----
doc/pydoc/simpleparse.tests.test_xml.html | 247 --
doc/pydoc/simpleparse.xml.__init__.html | 23 -
doc/pydoc/simpleparse.xml.html | 37 -
doc/pydoc/simpleparse.xml.xml_parser.html | 58 -
doc/simpleparse_grammars.html | 58 +-
error.py | 55 -
examples/__init__.py | 7 -
examples/bad_declaration.py | 28 -
examples/findlineset.py | 60 -
examples/findliterals.py | 48 -
examples/formatvrml.py | 195 --
examples/lisp.py | 65 -
examples/prebuilt_call.py | 62 -
examples/py_ebnf.py | 90 -
examples/simpleexample.py | 33 -
examples/simpleexample2_1.py | 13 -
examples/simpleexample2_2.py | 37 -
examples/simpleexample2_3.py | 31 -
examples/transformation.py | 103 -
examples/vrml.py | 60 -
examples/vrml_erronfail.py | 97 -
generator.py | 153 --
license.txt | 13 +-
objectgenerator.py | 781 -------
parser.py | 49 -
printers.py | 60 -
processor.py | 49 -
setup.cfg | 5 +
setup.py | 188 +-
__init__.py => simpleparse/__init__.py | 1 +
simpleparse/baseparser.py | 66 +
{common => simpleparse/common}/__init__.py | 2 +-
simpleparse/common/calendar_names.py | 103 +
simpleparse/common/chartypes.py | 83 +
{common => simpleparse/common}/comments.py | 49 +-
simpleparse/common/iso_date.py | 153 ++
simpleparse/common/iso_date_loose.py | 141 ++
simpleparse/common/numbers.py | 190 ++
{common => simpleparse/common}/phonetics.py | 36 +-
simpleparse/common/strings.py | 168 ++
simpleparse/common/timezone_names.py | 218 ++
simpleparse/dispatchprocessor.py | 107 +
simpleparse/error.py | 55 +
simpleparse/generator.py | 152 ++
simpleparse/objectgenerator.py | 783 +++++++
simpleparse/parser.py | 49 +
simpleparse/printers.py | 58 +
simpleparse/processor.py | 49 +
simpleparse/simpleparsegrammar.py | 725 ++++++
{stt => simpleparse/stt}/COPYRIGHT | 0
.../stt}/Doc/eGenix-mx-Extensions.html | 0
{stt => simpleparse/stt}/Doc/mxLicense.html | 0
{stt => simpleparse/stt}/Doc/mxTextTools.html | 0
{stt => simpleparse/stt}/LICENSE | 0
{stt => simpleparse/stt}/TextTools/COPYRIGHT | 0
.../stt}/TextTools/Constants/Sets.py | 2 +-
.../stt}/TextTools/Constants/TagTables.py | 4 +-
.../stt}/TextTools/Constants/__init__.py | 0
{stt => simpleparse/stt}/TextTools/LICENSE | 0
{stt => simpleparse/stt}/TextTools/Makefile.pkg | 0
{stt => simpleparse/stt}/TextTools/README | 0
{stt => simpleparse/stt}/TextTools/TextTools.py | 251 +-
{stt => simpleparse/stt}/TextTools/__init__.py | 21 +-
.../stt}/TextTools/mxTextTools/Makefile.pre.in | 0
.../stt}/TextTools/mxTextTools/__init__.py | 2 +-
.../stt}/TextTools/mxTextTools/highcommands.h | 458 ++--
.../stt}/TextTools/mxTextTools/lowlevelcommands.h | 650 +++---
.../stt}/TextTools/mxTextTools/mx.h | 73 +-
.../stt}/TextTools/mxTextTools/mxTextTools.c | 1259 +++++-----
.../stt/TextTools/mxTextTools/mxTextTools.c.~1~ | 633 ++---
.../stt}/TextTools/mxTextTools/mxTextTools.def | 0
.../stt}/TextTools/mxTextTools/mxTextTools.h | 88 +-
.../stt}/TextTools/mxTextTools/mxbmse.c | 0
.../stt}/TextTools/mxTextTools/mxbmse.h | 0
.../stt}/TextTools/mxTextTools/mxh.h | 0
simpleparse/stt/TextTools/mxTextTools/mxpyapi.h | 43 +
.../stt}/TextTools/mxTextTools/mxstdlib.h | 46 -
.../stt}/TextTools/mxTextTools/mxte.c | 2 +
.../stt}/TextTools/mxTextTools/mxte_impl.h | 66 +-
.../stt}/TextTools/mxTextTools/recursecommands.h | 238 +-
.../stt}/TextTools/mxTextTools/speccommands.h | 0
{stt => simpleparse/stt}/__init__.py | 2 +-
{stt => simpleparse/stt}/mxLicense.html | 0
{xml => simpleparse/xmlparser}/__init__.py | 2 +-
simpleparse/xmlparser/xml_parser.py | 200 ++
simpleparsegrammar.py | 701 ------
stt/TextTools/mxTextTools/Setup.in | 15 -
stt/TextTools/mxTextTools/mcfpyapi.h | 219 --
stt/TextTools/mxTextTools/mxpyapi.h | 468 ----
tests/__init__.py | 2 +-
tests/genericvalues.py | 24 +-
tests/mx_flag.py | 229 +-
tests/mx_high.py | 347 ++-
tests/mx_low.py | 565 +++--
tests/mx_recursive.py | 290 +--
tests/mx_special.py | 413 ++--
tests/mx_test.py | 20 -
tests/test.py | 42 -
tests/test_backup_on_subtable_failure.py | 9 +-
tests/test_common_chartypes.py | 147 +-
tests/test_common_comments.py | 132 +-
tests/test_common_iso_date.py | 234 +-
tests/test_common_numbers.py | 346 +--
tests/test_common_strings.py | 106 +-
tests/test_deep_nesting.py | 43 +-
tests/test_erroronfail.py | 210 +-
tests/test_grammarparser.py | 1674 +++++++-------
tests/test_objectgenerator.py | 733 +++---
tests/test_optimisation.py | 206 +-
tests/test_printers.py | 70 +-
tests/test_simpleparsegrammar.py | 950 ++++----
tests/test_xml.py | 476 ++--
tox.ini | 7 +
xml/xml_parser.py | 200 --
205 files changed, 9116 insertions(+), 29231 deletions(-)
diff --git a/MANIFEST.in b/MANIFEST.in
index 518499b..c7a3936 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,10 +1,12 @@
include MANIFEST.in
include license.txt
+include tox.ini
include setup.py
recursive-include . *.py
-recursive-include stt *
+recursive-include simpleparse/stt *
recursive-include doc *.html
recursive-include doc *.css
+recursive-include tests *.py
prune examples/html.py
prune examples/py*
prune examples/rtf*
diff --git a/PKG-INFO b/PKG-INFO
index 4db8672..38bbca9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: SimpleParse
-Version: 2.1.0a1
+Version: 2.2.0
Summary: A Parser Generator for Python (w/mxTextTools derivative)
Home-page: http://simpleparse.sourceforge.net/
Author: Mike C. Fletcher
@@ -10,12 +10,11 @@ Description: A Parser Generator for Python (w/mxTextTools derivative)
Provides a moderately fast parser generator for use with Python,
includes a forked version of the mxTextTools text-processing library
- modified to eliminate recursive operation and fix a number of
+ modified to eliminate recursive operation and fix a number of
undesirable behaviours.
Converts EBNF grammars directly to single-pass parsers for many
largely deterministic grammars.
-
Keywords: parse,parser,parsing,text,ebnf,grammar,generator
Platform: Any
Classifier: Programming Language :: Python
diff --git a/PKG-INFO b/SimpleParse.egg-info/PKG-INFO
similarity index 94%
copy from PKG-INFO
copy to SimpleParse.egg-info/PKG-INFO
index 4db8672..38bbca9 100644
--- a/PKG-INFO
+++ b/SimpleParse.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: SimpleParse
-Version: 2.1.0a1
+Version: 2.2.0
Summary: A Parser Generator for Python (w/mxTextTools derivative)
Home-page: http://simpleparse.sourceforge.net/
Author: Mike C. Fletcher
@@ -10,12 +10,11 @@ Description: A Parser Generator for Python (w/mxTextTools derivative)
Provides a moderately fast parser generator for use with Python,
includes a forked version of the mxTextTools text-processing library
- modified to eliminate recursive operation and fix a number of
+ modified to eliminate recursive operation and fix a number of
undesirable behaviours.
Converts EBNF grammars directly to single-pass parsers for many
largely deterministic grammars.
-
Keywords: parse,parser,parsing,text,ebnf,grammar,generator
Platform: Any
Classifier: Programming Language :: Python
diff --git a/SimpleParse.egg-info/SOURCES.txt b/SimpleParse.egg-info/SOURCES.txt
new file mode 100644
index 0000000..35560f9
--- /dev/null
+++ b/SimpleParse.egg-info/SOURCES.txt
@@ -0,0 +1,95 @@
+MANIFEST.in
+license.txt
+setup.py
+tox.ini
+/home/mcfletch/OpenGL-dev/simpleparse/simpleparse/stt/TextTools/mxTextTools/mxTextTools.c
+/home/mcfletch/OpenGL-dev/simpleparse/simpleparse/stt/TextTools/mxTextTools/mxbmse.c
+/home/mcfletch/OpenGL-dev/simpleparse/simpleparse/stt/TextTools/mxTextTools/mxte.c
+SimpleParse.egg-info/PKG-INFO
+SimpleParse.egg-info/SOURCES.txt
+SimpleParse.egg-info/dependency_links.txt
+SimpleParse.egg-info/top_level.txt
+doc/common_problems.html
+doc/index.html
+doc/mxLicense.html
+doc/processing_result_trees.html
+doc/scanning_with_simpleparse.html
+doc/simpleparse_grammars.html
+doc/sitestyle.css
+simpleparse/__init__.py
+simpleparse/baseparser.py
+simpleparse/dispatchprocessor.py
+simpleparse/error.py
+simpleparse/generator.py
+simpleparse/objectgenerator.py
+simpleparse/parser.py
+simpleparse/printers.py
+simpleparse/processor.py
+simpleparse/simpleparsegrammar.py
+simpleparse/common/__init__.py
+simpleparse/common/calendar_names.py
+simpleparse/common/chartypes.py
+simpleparse/common/comments.py
+simpleparse/common/iso_date.py
+simpleparse/common/iso_date_loose.py
+simpleparse/common/numbers.py
+simpleparse/common/phonetics.py
+simpleparse/common/strings.py
+simpleparse/common/timezone_names.py
+simpleparse/stt/COPYRIGHT
+simpleparse/stt/LICENSE
+simpleparse/stt/__init__.py
+simpleparse/stt/mxLicense.html
+simpleparse/stt/Doc/eGenix-mx-Extensions.html
+simpleparse/stt/Doc/mxLicense.html
+simpleparse/stt/Doc/mxTextTools.html
+simpleparse/stt/TextTools/COPYRIGHT
+simpleparse/stt/TextTools/LICENSE
+simpleparse/stt/TextTools/Makefile.pkg
+simpleparse/stt/TextTools/README
+simpleparse/stt/TextTools/TextTools.py
+simpleparse/stt/TextTools/__init__.py
+simpleparse/stt/TextTools/Constants/Sets.py
+simpleparse/stt/TextTools/Constants/TagTables.py
+simpleparse/stt/TextTools/Constants/__init__.py
+simpleparse/stt/TextTools/mxTextTools/Makefile.pre.in
+simpleparse/stt/TextTools/mxTextTools/__init__.py
+simpleparse/stt/TextTools/mxTextTools/highcommands.h
+simpleparse/stt/TextTools/mxTextTools/lowlevelcommands.h
+simpleparse/stt/TextTools/mxTextTools/mx.h
+simpleparse/stt/TextTools/mxTextTools/mxTextTools.c
+simpleparse/stt/TextTools/mxTextTools/mxTextTools.c.~1~
+simpleparse/stt/TextTools/mxTextTools/mxTextTools.def
+simpleparse/stt/TextTools/mxTextTools/mxTextTools.h
+simpleparse/stt/TextTools/mxTextTools/mxbmse.c
+simpleparse/stt/TextTools/mxTextTools/mxbmse.h
+simpleparse/stt/TextTools/mxTextTools/mxh.h
+simpleparse/stt/TextTools/mxTextTools/mxpyapi.h
+simpleparse/stt/TextTools/mxTextTools/mxstdlib.h
+simpleparse/stt/TextTools/mxTextTools/mxte.c
+simpleparse/stt/TextTools/mxTextTools/mxte_impl.h
+simpleparse/stt/TextTools/mxTextTools/recursecommands.h
+simpleparse/stt/TextTools/mxTextTools/speccommands.h
+simpleparse/xmlparser/__init__.py
+simpleparse/xmlparser/xml_parser.py
+tests/__init__.py
+tests/genericvalues.py
+tests/mx_flag.py
+tests/mx_high.py
+tests/mx_low.py
+tests/mx_recursive.py
+tests/mx_special.py
+tests/test_backup_on_subtable_failure.py
+tests/test_common_chartypes.py
+tests/test_common_comments.py
+tests/test_common_iso_date.py
+tests/test_common_numbers.py
+tests/test_common_strings.py
+tests/test_deep_nesting.py
+tests/test_erroronfail.py
+tests/test_grammarparser.py
+tests/test_objectgenerator.py
+tests/test_optimisation.py
+tests/test_printers.py
+tests/test_simpleparsegrammar.py
+tests/test_xml.py
\ No newline at end of file
diff --git a/SimpleParse.egg-info/dependency_links.txt b/SimpleParse.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/SimpleParse.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/SimpleParse.egg-info/top_level.txt b/SimpleParse.egg-info/top_level.txt
new file mode 100644
index 0000000..c4c2111
--- /dev/null
+++ b/SimpleParse.egg-info/top_level.txt
@@ -0,0 +1 @@
+simpleparse
diff --git a/baseparser.py b/baseparser.py
deleted file mode 100644
index 0d90c54..0000000
--- a/baseparser.py
+++ /dev/null
@@ -1,66 +0,0 @@
-"""Base class for real-world parsers (such as parser.Parser)"""
-from simpleparse.stt.TextTools.TextTools import *
-from simpleparse.generator import Generator
-
-class BaseParser:
- """Class on which real-world parsers build
-
- Normally you use a sub-class of this class, such as
- simpleparser.parser.Parser
- """
- _rootProduction = ""
- # primary API...
- def parse( self, data, production=None, processor=None, start=0, stop=None):
- """Parse data with production "production" of this parser
-
- data -- data to be parsed, a Python string, for now
- production -- optional string specifying a non-default production to use
- for parsing data
- processor -- optional pointer to a Processor or MethodSource object for
- use in determining reporting format and/or post-processing the results
- of the parsing pass. Can be None if neither is desired (default)
- start -- starting index for the parsing, default 0
- stop -- stoping index for the parsing, default len(data)
- """
- self.resetBeforeParse()
- if processor is None:
- processor = self.buildProcessor()
- if stop is None:
- stop = len(data)
- value = tag( data, self.buildTagger( production, processor), start, stop )
- if processor and callable(processor):
- return processor( value, data )
- else:
- return value
- # abstract methods
- def buildProcessor( self ):
- """Build default processor object for this parser class
-
- The default implementation returns None. The processor
- can either implement the "method source" API (just provides
- information about Callouts and the like), or the processor
- API and the method-source API. The processor API merely
- requires that the object be callable, and have the signature:
-
- object( (success, children, nextPosition), buffer)
-
- (Note: your object can treat the first item as a single tuple
- if it likes).
-
- See: simpleparse.processor module for details.
- """
- return None
- def buildTagger( self, name, processor ):
- """Build the tag-table for the parser
-
- This method must be implemented by your base class and _not_
- call the implementation here.
- """
- raise NotImplementedError( """Parser sub-class %s hasn't implemented a buildTagger method"""%(self.__class__.__name__))
- def resetBeforeParse( self ):
- """Called just before the parser's parse method starts working,
-
- Allows you to set up special-purpose structures, such as stacks
- or local storage values. There is no base implementation. The
- base implementation does nothing.
- """
diff --git a/common/calendar_names.py b/common/calendar_names.py
deleted file mode 100644
index 361b124..0000000
--- a/common/calendar_names.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""Locale-specific calendar names (day-of-week and month-of-year)
-
-These values are those returned by the calendar module. Available
-productions:
-
- locale_day_names
- locale_day_names_uc
- locale_day_names_lc
- Names for the days of the week
-
- locale_day_abbrs
- locale_day_abbrs_uc
- locale_day_abbrs_lc
- Short-forms (3 characters normally) for
- the days of the week.
-
- locale_month_names
- locale_month_names_uc
- locale_month_names_lc
- Names for the months of the year
-
- locale_month_abbrs
- locale_month_abbrs_uc
- locale_month_abbrs_lc
- Short-forms (3 characters normally) for
- the months of the year
-
-Interpreters:
- MonthNameInterpreter
- DayNameInterpreter
- Both offer the ability to set an index other
- than the default (of 1) for the first item in
- the list.
-"""
-import calendar, string
-from simpleparse import objectgenerator, common
-
-c = {}
-
-da = calendar.day_abbr[:]
-dn = calendar.day_name[:]
-ma = calendar.month_abbr[:]
-mn = calendar.month_name[:]
-
-def _build( name, set ):
- # make sure longest equal-prefix items are first
- set = set[:]
- set.sort()
- set.reverse()
- l,u,r = [],[],[]
- for item in set:
- l.append( objectgenerator.Literal( value = string.lower(item) ))
- u.append( objectgenerator.Literal( value = string.upper(item) ))
- r.append( objectgenerator.Literal( value = item ))
- c[ name + '_lc' ] = objectgenerator.FirstOfGroup( children = l )
- c[ name + '_uc' ] = objectgenerator.FirstOfGroup( children = u )
- c[ name ] = objectgenerator.FirstOfGroup( children = r )
-
-_build( 'locale_day_names', dn )
-_build( 'locale_day_abbrs', da )
-
-
-_build( 'locale_month_names', mn )
-_build( 'locale_month_abbrs', ma )
-
-da = map(string.lower, da )
-dn = map(string.lower, dn )
-ma = map(string.lower, ma )
-mn = map(string.lower, mn )
-
-
-common.share( c )
-
-class NameInterpreter:
- offset = 1
- def __init__( self, offset = 1 ):
- self.offset = offset
- def __call__( self, (tag, left, right, children), buffer ):
- value = string.lower( buffer[left:right] )
- for table in self.tables:
- try:
- return table.index( value )+ self.offset
- except ValueError:
- pass
- raise ValueError( """Unrecognised (but parsed) %s name %s at character %s"""%( self.nameType, value, left))
-
-class MonthNameInterpreter( NameInterpreter):
- """Interpret a month-of-year name as an integer index
-
- Pass an "offset" value to __init__ to use an offset other
- than 1 (Monday = 1), normally 0 (Monday = 0)
- """
- nameType = "Month"
- tables = (mn,ma)
-class DayNameInterpreter( NameInterpreter ):
- """Interpret a day-of-week name as an integer index
-
- Pass an "offset" value to __init__ to use an offset other
- than 1 (January = 1), normally 0 (January = 0)
- """
- nameType = "Day"
- tables = (dn,da)
diff --git a/common/chartypes.py b/common/chartypes.py
deleted file mode 100644
index 209cfc5..0000000
--- a/common/chartypes.py
+++ /dev/null
@@ -1,83 +0,0 @@
-"""Common locale-specific character types
-
-Following productions are all based on string module,
-with the default locale specified. The first production
-is a single character of the class and the second a
-repeating character version:
-
- digit, digits
- uppercasechar, uppercase
- lowercasechar, lowercase
- letter, letters
- whitespacechar, whitespace
- punctuationchar, punctuation
- octdigit, octdigits
- hexdigit, hexdigits
- printablechar, printable
-
-For Python versions with the constants in the string module:
- ascii_letter, ascii_letters
- ascii_lowercasechar, ascii_lowercase
- ascii_uppercasechar, ascii_uppercase
-
-
-Following are locale-specific values, both are
-single-character values:
-
- locale_decimal_point -- locale-specific decimal seperator
- locale_thousands_seperator -- locale-specific "thousands" seperator
-
-Others:
-
- EOF -- Matches iff parsing has reached the end of the buffer
-
-There are no interpreters provided (the types are considered
-too common to provide meaningful interpreters).
-"""
-from simpleparse import objectgenerator, common
-import string, locale
-locale.setlocale(locale.LC_ALL, "" )
-
-c = {}
-
-# string-module items...
-
-for source,single,repeat in [
- ("digits","digit","digits"),
- ("uppercase", "uppercasechar", "uppercase"),
- ("lowercase", "lowercasechar", "lowercase"),
- ("letters", "letter", "letters" ),
- ("ascii_lowercase", "ascii_lowercasechar", "ascii_lowercase"),
- ("ascii_uppercase", "ascii_uppercasechar", "ascii_uppercase"),
- ("ascii_letters", "ascii_letter", "ascii_letters" ),
- ("whitespace", "whitespacechar", "whitespace"),
- ("punctuation", "punctuationchar", "punctuation"),
- ("octdigits", "octdigit", "octdigits"),
- ("hexdigits", "hexdigit", "hexdigits"),
- ("printable", "printablechar", "printable"),
-]:
- try:
- value = getattr( string, source )
- c[ single ] = objectgenerator.Range( value = value )
- c[ repeat ] = objectgenerator.Range( value = value, repeating =1 )
- except AttributeError:
- pass
-
-# locale-module items
-_lc = locale.localeconv()
-c[ "locale_decimal_point" ] = objectgenerator.Literal( value = _lc["decimal_point"] )
-c[ "locale_thousands_seperator" ] = objectgenerator.Literal( value = _lc["thousands_sep"] )
-
-del _lc
-
-# common, but not really well defined sets
-# this is the set of characters which are interpreted
-# specially by Python's string-escaping when they
-# follow a \\ char.
-
-from simpleparse.stt import TextTools
-c[ "EOF" ] = objectgenerator.Prebuilt( value = (
- (None, TextTools.EOF, TextTools.Here),
-) )
-
-common.share( c )
diff --git a/common/iso_date.py b/common/iso_date.py
deleted file mode 100644
index e6516b3..0000000
--- a/common/iso_date.py
+++ /dev/null
@@ -1,148 +0,0 @@
-"""Canonical ISO date format YYYY-MM-DDTHH:mm:SS+HH:mm
-
-This parser is _extremely_ strict, and the dates that match it,
-though really easy to work with for the computer, are not particularly
-readable. See the iso_date_loose module for a slightly relaxed
-definition which allows the "T" character to be replaced by a
-" " character, and allows a space before the timezone offset, as well
-as allowing the integer values to use non-0-padded integers.
-
-
- ISO_date -- YYYY-MM-DD format, with a month and date optional
- ISO_time -- HH:mm:SS format, with minutes and seconds optional
- ISO_date_time -- YYYY-MM-DD HH:mm:SS+HH:mm format,
- with time optional and TimeZone offset optional
-
-Interpreter:
- MxInterpreter
- Interprets the parse tree as mx.DateTime values
- ISO_date and ISO_time
- returns DateTime objects
- Time only
- returns RelativeDateTime object which, when
- added to a DateTime gives you the given time
- within that day
-"""
-try:
- from mx import DateTime
- haveMX = 1
-except ImportError:
- haveMX = 0
-from simpleparse.parser import Parser
-from simpleparse import common, objectgenerator
-from simpleparse.common import chartypes, numbers
-from simpleparse.dispatchprocessor import *
-
-c = {}
-
-declaration ="""
-year := digit,digit,digit,digit
-month := digit,digit
-day := digit,digit
-
-hour := digit,digit
-minute := digit,digit
-second := digit,digit
-offset_sign := [-+]
-offset := offset_sign, hour, time_separator?, minute
-
-<date_separator> := '-'
-<time_separator> := ':'
-
-ISO_date := year, (date_separator, month, (date_separator, day)?)?
-ISO_time := hour, (time_separator, minute, (time_separator, second)?)?
-ISO_date_time := ISO_date, ([T], ISO_time)?, offset?
-"""
-
-
-
-
-_p = Parser( declaration )
-for name in ["ISO_time","ISO_date", "ISO_date_time"]:
- c[ name ] = objectgenerator.LibraryElement(
- generator = _p._generator,
- production = name,
- )
-common.share( c )
-
-if haveMX:
- class MxInterpreter(DispatchProcessor):
- """Interpret a parsed ISO_date_time_loose in GMT/UTC time or localtime
- """
- def __init__(
- self,
- inputLocal = 1,
- returnLocal = 1,
- ):
- self.inputLocal = inputLocal
- self.returnLocal = returnLocal
- dateName = 'ISO_date'
- timeName = 'ISO_time'
- def ISO_date_time( self, (tag, left, right, sublist), buffer):
- """Interpret the loose ISO date + time format"""
- set = singleMap( sublist, self, buffer )
- base, time, offset = (
- set.get(self.dateName),
- set.get(self.timeName) or DateTime.RelativeDateTime(hour=0,minute=0,second=0),
- set.get( "offset" ),
- )
- base = base + time
- offset = set.get( "offset" )
- if offset is not None:
- # an explicit timezone was entered, convert to gmt and return as appropriate...
- gmt = base - offset
- if self.returnLocal:
- return gmt.localtime()
- else:
- return gmt
- # was in the default input locale (either gmt or local)
- if self.inputLocal and self.returnLocal:
- return base
- elif not self.inputLocal and not self.returnLocal:
- return base
- elif self.inputLocal and not self.returnLocal:
- # return gmt from local...
- return base.gmtime()
- else:
- return base.localtime()
- def ISO_date( self, (tag, left, right, sublist), buffer):
- """Interpret the ISO date format"""
- set = {}
- for item in sublist:
- set[ item[0] ] = dispatch( self, item, buffer)
- return DateTime.DateTime(
- set.get("year") or now().year,
- set.get("month") or 1,
- set.get("day") or 1,
- )
- def ISO_time( self, (tag, left, right, sublist), buffer):
- """Interpret the ISO time format"""
- set = {}
- for item in sublist:
- set[ item[0] ] = dispatch( self, item, buffer)
- return DateTime.RelativeDateTime(
- hour = set.get("hour") or 0,
- minute = set.get("minute") or 0,
- second = set.get("second") or 0,
- )
-
- integer = numbers.IntInterpreter()
- second = offset_minute = offset_hour = year = month = day = hour =minute =integer
-
- def offset( self, (tag, left, right, sublist), buffer):
- """Calculate the time zone offset as a date-time delta"""
- set = singleMap( sublist, self, buffer )
- direction = set.get('offset_sign',1)
- hour = set.get( "hour", 0)
- minute = set.get( "minute", 0)
- delta = DateTime.DateTimeDelta( 0, hour*direction, minute*direction)
- return delta
-
- def offset_sign( self , (tag, left, right, sublist), buffer):
- """Interpret the offset sign as a multiplier"""
- v = buffer [left: right]
- if v in ' +':
- return 1
- else:
- return -1
-
diff --git a/common/iso_date_loose.py b/common/iso_date_loose.py
deleted file mode 100644
index 79e5586..0000000
--- a/common/iso_date_loose.py
+++ /dev/null
@@ -1,136 +0,0 @@
-"""Somewhat Looser ISO date format YYYY-MM-DD HH:mm:SS +HH:mm
-
- ISO_date_loose -- YYYY-MM-DD format, with a month and day optional,
- month or day may be specified without leading 0
- ISO_time_loose -- HH:mm:SS format, with minutes and seconds optional
- all numbers may be specified without leading 0
- ISO_date_time_loose -- YYYY-MM-DD HH:mm:SS +HH:mm format,
- with time optional and TimeZone offset optional,
- same format for date and time as above
-
-Interpreter:
- MxInterpreter
- Interprets the parse tree as mx.DateTime values
- Date and DateTime -> DateTime objects
- Time only -> RelativeDateTime
-"""
-try:
- from mx import DateTime
- haveMX = 1
-except ImportError:
- haveMX = 0
-from simpleparse.parser import Parser
-from simpleparse import common, objectgenerator
-from simpleparse.common import chartypes, numbers
-from simpleparse.dispatchprocessor import *
-
-c = {}
-declaration = """
-<date_separator> := [-]
-<time_separator> := ':'
-offset_sign := [-+]
-
-year := int
-month := int
-day := int
-hour := int
-minute := int
-second := float/int
-ISO_date_loose := year, (date_separator, month, (date_separator, day)?)?
-ISO_time_loose := hour, (time_separator, minute, (time_separator, second)?)?
-offset := offset_sign, offset_hour, time_separator?, offset_minute?
-offset_hour := digit, digit
-offset_minute := digit, digit
-
-ISO_date_time_loose := ISO_date_loose, ([T ], ISO_time_loose)?, [ ]?, offset?
-"""
-
-_p = Parser( declaration )
-for name in ["ISO_time_loose","ISO_date_time_loose", "ISO_date_loose"]:
- c[ name ] = objectgenerator.LibraryElement(
- generator = _p._generator,
- production = name,
- )
-common.share( c )
-
-if haveMX:
- class MxInterpreter(DispatchProcessor):
- """Interpret a parsed ISO_date_time_loose in GMT/UTC time or localtime
- """
- int = numbers.IntInterpreter()
- offset_minute = offset_hour = year = month = day = hour = minute = int
-
- float = numbers.FloatInterpreter()
- second = float
-
- def __init__(
- self,
- inputLocal = 1,
- returnLocal = 1,
- ):
- self.inputLocal = inputLocal
- self.returnLocal = returnLocal
- dateName = 'ISO_date_loose'
- timeName = 'ISO_time_loose'
- def ISO_date_time_loose( self, (tag, left, right, sublist), buffer):
- """Interpret the loose ISO date + time format"""
- set = singleMap( sublist, self, buffer )
- base, time, offset = (
- set.get(self.dateName),
- set.get(self.timeName) or DateTime.RelativeDateTime(hour=0,minute=0,second=0),
- set.get( "offset" ),
- )
- base = base + time
- offset = set.get( "offset" )
- if offset is not None:
- # an explicit timezone was entered, convert to gmt and return as appropriate...
- gmt = base - offset
- if self.returnLocal:
- return gmt.localtime()
- else:
- return gmt
- # was in the default input locale (either gmt or local)
- if self.inputLocal and self.returnLocal:
- return base
- elif not self.inputLocal and not self.returnLocal:
- return base
- elif self.inputLocal and not self.returnLocal:
- # return gmt from local...
- return base.gmtime()
- else:
- return base.localtime()
- def ISO_date_loose( self, (tag, left, right, sublist), buffer):
- """Interpret the loose ISO date format"""
- set = singleMap( sublist, self, buffer )
- return DateTime.DateTime(
- set.get("year") or now().year,
- set.get("month") or 1,
- set.get("day") or 1,
- )
- def ISO_time_loose( self, (tag, left, right, sublist), buffer):
- """Interpret the loose ISO time format"""
- set = singleMap( sublist, self, buffer )
- return DateTime.RelativeDateTime(
- hour = set.get("hour") or 0,
- minute = set.get("minute") or 0,
- second = set.get("second") or 0,
- )
-
-
- def offset( self, (tag, left, right, sublist), buffer):
- """Calculate the time zone offset as a date-time delta"""
- set = singleMap( sublist, self, buffer )
- direction = set.get('offset_sign',1)
- hour = set.get( "offset_hour", 0)
- minute = set.get( "offset_minute", 0)
- delta = DateTime.DateTimeDelta( 0, hour*direction, minute*direction)
- return delta
-
- def offset_sign( self , (tag, left, right, sublist), buffer):
- """Interpret the offset sign as a multiplier"""
- v = buffer [left: right]
- if v in ' +':
- return 1
- else:
- return -1
-
diff --git a/common/numbers.py b/common/numbers.py
deleted file mode 100644
index debaba8..0000000
--- a/common/numbers.py
+++ /dev/null
@@ -1,187 +0,0 @@
-"""Samples showing the parsing of common programming-language constructs
-
-numbers
- integers
- int
- int_unsigned
-
- hexidecimal integers
- hex
-
- floats (including exponents, requring a '.' in the literal)
- float
- floats, with optional integer-only exponents
- float_floatexp
- floats, with optional integer or float exponents
-
- imaginary_number
- (float/int),[jJ]
-
- number
- hex/float/int
- number_full
- binary_number/imaginary_number/hex/float/int
-
- binary_number
... 42303 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/simpleparse.git
More information about the Python-modules-commits
mailing list