Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-rply for openSUSE:Factory checked in at 2022-10-08 01:26:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-rply (Old) and /work/SRC/openSUSE:Factory/.python-rply.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-rply" Sat Oct 8 01:26:05 2022 rev:5 rq:1008867 version:0.7.8 Changes: -------- --- /work/SRC/openSUSE:Factory/python-rply/python-rply.changes 2019-04-08 20:52:49.318536906 +0200 +++ /work/SRC/openSUSE:Factory/.python-rply.new.2275/python-rply.changes 2022-10-08 01:26:31.294408081 +0200 @@ -1,0 +2,6 @@ +Fri Oct 7 15:12:10 UTC 2022 - Yogalakshmi Arunachalam <[email protected]> + +- version update to 0.7.8 + * No Changelog + +------------------------------------------------------------------- Old: ---- v0.7.7.tar.gz New: ---- v0.7.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-rply.spec ++++++ --- /var/tmp/diff_new_pack.FH6QaG/_old 2022-10-08 01:26:31.690408989 +0200 +++ /var/tmp/diff_new_pack.FH6QaG/_new 2022-10-08 01:26:31.694408998 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-rply # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rply -Version: 0.7.7 +Version: 0.7.8 Release: 0 Summary: A pure Python Lex/Yacc that works with RPython License: BSD-3-Clause ++++++ v0.7.7.tar.gz -> v0.7.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/.travis/run.sh new/rply-0.7.8/.travis/run.sh --- old/rply-0.7.7/.travis/run.sh 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/.travis/run.sh 2021-01-27 22:12:47.000000000 +0100 @@ -5,11 +5,11 @@ export PYPY_LOCATION case "${TOXENV}" in - py26|py3*) + py3*) PYPY_LOCATION="" ;; *) - PYPY_LOCATION=$(python -c "import glob; import os; print os.path.abspath(glob.glob('../pypy-pypy*')[0])") + PYPY_LOCATION=$(python -c "import glob; import os; print os.path.abspath(glob.glob('../pypy-*')[0])") ;; esac diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/.travis.yml new/rply-0.7.8/.travis.yml --- old/rply-0.7.7/.travis.yml 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/.travis.yml 2021-01-27 22:12:47.000000000 +0100 @@ -7,8 +7,6 @@ matrix: include: - - python: 2.6 - env: TOXENV=py26 - python: 2.7 env: TOXENV=py27 - python: 3.4 @@ -17,6 +15,8 @@ env: TOXENV=py35 - python: 3.6 env: TOXENV=py36 + - python: 3.7 + env: TOXENV=py37 - python: pypy env: TOXENV=pypy - python: 2.7 @@ -27,7 +27,7 @@ install: - pip install -U pip - pip install tox - - wget https://bitbucket.org/pypy/pypy/get/default.tar.bz2 -O `pwd`/../pypy.tar.bz2 + - wget https://foss.heptapod.net/pypy/pypy/-/archive/branch/default/pypy-branch-default.tar.bz2 -O `pwd`/../pypy.tar.bz2 - tar -xf `pwd`/../pypy.tar.bz2 -C `pwd`/../ script: - ./.travis/run.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/README.rst new/rply-0.7.8/README.rst --- old/rply-0.7.7/README.rst 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/README.rst 2021-01-27 22:12:47.000000000 +0100 @@ -110,7 +110,7 @@ Python compatibility -------------------- -RPly is tested and known to work under Python 2.6, 2.7, 3.4+, and PyPy. It is +RPly is tested and known to work under Python 2.7, 3.4+, and PyPy. It is also valid RPython for PyPy checkouts from ``6c642ae7a0ea`` onwards. Links diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/docs/conf.py new/rply-0.7.8/docs/conf.py --- old/rply-0.7.7/docs/conf.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/docs/conf.py 2021-01-27 22:12:47.000000000 +0100 @@ -54,7 +54,7 @@ # The short X.Y version. version = '0.7' # The full version, including alpha/beta/rc tags. -release = '0.7.7' +release = '0.7.8' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/docs/users-guide/parsers.rst new/rply-0.7.8/docs/users-guide/parsers.rst --- old/rply-0.7.7/docs/users-guide/parsers.rst 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/docs/users-guide/parsers.rst 2021-01-27 22:12:47.000000000 +0100 @@ -132,6 +132,25 @@ the :meth:`~rply.ParserGenerator.production` decorator. The function receives a list of the tokens and non-terminals and returns a non-terminal. +It is possible to chain multiple production rule right-hand sides with "|". +Thus, the following are equivalent: + +.. code:: python + + from rply import ParserGenerator + + pg = ParserGenerator(["TOK1", "TOK2"]) + + @pg.production("rule: TOK1") + @pg.production("rule: TOK2") + def prod(p): + pass + + @pg.production("rule: TOK1 | TOK2") + def prod_shorthand(p): + pass + + In this case we create an abstract syntax tree. We can now use this parser in combination with the lexer given to parse and evaluate mathematical expressions as defined by our grammar:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/rply/__init__.py new/rply-0.7.8/rply/__init__.py --- old/rply-0.7.7/rply/__init__.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/rply/__init__.py 2021-01-27 22:12:47.000000000 +0100 @@ -3,7 +3,7 @@ from rply.parsergenerator import ParserGenerator from rply.token import Token -__version__ = '0.7.7' +__version__ = '0.7.8' __all__ = [ "LexerGenerator", "LexingError", "ParserGenerator", "ParsingError", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/rply/lexer.py new/rply-0.7.8/rply/lexer.py --- old/rply-0.7.7/rply/lexer.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/rply/lexer.py 2021-01-27 22:12:47.000000000 +0100 @@ -18,6 +18,7 @@ self.idx = 0 self._lineno = 1 + self._colno = 1 def __iter__(self): return self @@ -47,14 +48,15 @@ match = rule.matches(self.s, self.idx) if match: lineno = self._lineno - colno = self._update_pos(match) - source_pos = SourcePosition(match.start, lineno, colno) + self._colno = self._update_pos(match) + source_pos = SourcePosition(match.start, lineno, self._colno) token = Token( rule.name, self.s[match.start:match.end], source_pos ) return token else: - raise LexingError(None, SourcePosition(self.idx, -1, -1)) + raise LexingError(None, SourcePosition( + self.idx, self._lineno, self._colno)) def __next__(self): return self.next() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/rply/lexergenerator.py new/rply-0.7.8/rply/lexergenerator.py --- old/rply-0.7.7/rply/lexergenerator.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/rply/lexergenerator.py 2021-01-27 22:12:47.000000000 +0100 @@ -21,7 +21,6 @@ self.name = name self.re = re.compile(pattern, flags=flags) if rpython: - self.flags = flags self._pattern = get_code(pattern, flags) def _freeze_(self): @@ -33,7 +32,7 @@ return Match(*m.span(0)) if m is not None else None else: assert pos >= 0 - ctx = rsre_core.StrMatchContext(s, pos, len(s), self.flags) + ctx = rsre_core.StrMatchContext(s, pos, len(s)) matched = rsre_core.match_context(ctx, self._pattern) if matched: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/rply/parsergenerator.py new/rply-0.7.8/rply/parsergenerator.py --- old/rply-0.7.7/rply/parsergenerator.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/rply/parsergenerator.py 2021-01-27 22:12:47.000000000 +0100 @@ -42,15 +42,15 @@ def production(self, rule, precedence=None): """ - A decorator that defines a production rule and registers the decorated - function to be called with the terminals and non-terminals matched by - that rule. + A decorator that defines one or many production rules and registers + the decorated function to be called with the terminals and + non-terminals matched by those rules. A `rule` should consist of a name defining the non-terminal returned - by the decorated function and a sequence of non-terminals and terminals - that are supposed to be replaced:: + by the decorated function and one or more sequences of pipe-separated + non-terminals and terminals that are supposed to be replaced:: - replacing_non_terminal : ATERMINAL non_terminal + replacing_non_terminal : TERMINAL1 non_term1 | TERMINAL2 non_term2 The name of the non-terminal replacing the sequence is on the left, separated from the sequence by a colon. The whitespace around the colon @@ -75,10 +75,14 @@ production_name = parts[0] if parts[1] != ":": raise ParserGeneratorError("Expecting :") - syms = parts[2:] + + body = " ".join(parts[2:]) + prods = body.split("|") def inner(func): - self.productions.append((production_name, syms, func, precedence)) + for production in prods: + syms = production.split() + self.productions.append((production_name, syms, func, precedence)) return func return inner diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/setup.py new/rply-0.7.8/setup.py --- old/rply-0.7.7/setup.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/setup.py 2021-01-27 22:12:47.000000000 +0100 @@ -9,7 +9,7 @@ description="A pure Python Lex/Yacc that works with RPython", long_description=readme, # duplicated in docs/conf.py and rply/__init__.py - version="0.7.7", + version="0.7.8", author="Alex Gaynor", author_email="[email protected]", packages=["rply"], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/tests/test_lexer.py new/rply-0.7.8/tests/test_lexer.py --- old/rply-0.7.7/tests/test_lexer.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/tests/test_lexer.py 2021-01-27 22:12:47.000000000 +0100 @@ -150,3 +150,30 @@ stream.next() assert 'SourcePosition(' in repr(excinfo.value) + + def test_error_line_number(self): + lg = LexerGenerator() + lg.add("NEW_LINE", r"\n") + l = lg.build() + + stream = l.lex("\nfail") + stream.next() + with raises(LexingError) as excinfo: + stream.next() + + assert excinfo.value.source_pos.lineno == 2 + + def test_error_column_number(self): + lg = LexerGenerator() + lg.add("NUMBER", r"\d+") + lg.add("PLUS", r"\+") + l = lg.build() + stream = l.lex("1+2+fail") + stream.next() + stream.next() + stream.next() + stream.next() + with raises(LexingError) as excinfo: + stream.next() + + assert excinfo.value.source_pos.colno == 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/tests/test_parsergenerator.py new/rply-0.7.8/tests/test_parsergenerator.py --- old/rply-0.7.7/tests/test_parsergenerator.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/tests/test_parsergenerator.py 2021-01-27 22:12:47.000000000 +0100 @@ -63,6 +63,25 @@ pg.build() + def test_pipe_production(self): + pg = ParserGenerator(["VALUE1", "VALUE2"]) + + @pg.production("main : VALUE1 | VALUE2") + def main(p): + return p[0] + + parser = pg.build() + + assert len(pg.productions) == 2 + + assert parser.parse(iter([ + Token("VALUE1", "3") + ])) == Token("VALUE1", "3") + + assert parser.parse(iter([ + Token("VALUE2", "3") + ])) == Token("VALUE2", "3") + class TestParserCaching(object): def test_simple_caching(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/tests/test_ztranslation.py new/rply-0.7.8/tests/test_ztranslation.py --- old/rply-0.7.7/tests/test_ztranslation.py 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/tests/test_ztranslation.py 2021-01-27 22:12:47.000000000 +0100 @@ -1,3 +1,5 @@ +import re + import py try: @@ -50,6 +52,32 @@ assert self.run(f, [14]) == 42 + def test_regex_flags(self): + lg = LexerGenerator() + lg.add("ALL", r".*", re.DOTALL) + + l = lg.build() + + def f(n): + tokens = l.lex("%d\n%d" % (n, n)) + + t = tokens.next() + if t.name != "ALL": + return -1 + + ended = False + try: + tokens.next() + except StopIteration: + ended = True + + if not ended: + return -2 + + return 1 + + assert self.run(f, [3]) == 1 + def test_basic_parser(self): pg = ParserGenerator(["NUMBER", "PLUS"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rply-0.7.7/tox.ini new/rply-0.7.8/tox.ini --- old/rply-0.7.7/tox.ini 2019-01-22 01:03:42.000000000 +0100 +++ new/rply-0.7.8/tox.ini 2021-01-27 22:12:47.000000000 +0100 @@ -1,5 +1,5 @@ [tox] -envlist = py26, py27, py34, py35, py36, pypy, docs +envlist = py27, py34, py35, py36, py37, pypy, docs [testenv] deps = pytest
