./devel/py-pyparsing, Parsing module for Python

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]

Branch: CURRENT, Version: 3.1.1nb1, Package name: py311-pyparsing-3.1.1nb1, Maintainer: pkgsrc-users

The pyparsing module is an alternative approach to creating and executing
simple grammars, vs. the traditional lex/yacc approach, or the use of regular
expressions. The pyparsing module provides a library of classes that client
code uses to construct the grammar directly in Python code.

Required to run:
[devel/py-setuptools] [lang/python37]

Required to build:

Master sites:

Filesize: 864.076 KB

Version history: (Expand)

CVS history: (Expand)

   2023-10-26 00:25:07 by Thomas Klausner | Files touched by this commit (1)
Log message:
py-pyparsing: remove unused file
   2023-10-26 00:24:14 by Thomas Klausner | Files touched by this commit (2)
Log message:
py-pyparsing: switch to bootstrap.mk

   2023-07-31 09:19:59 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-pyparsing: updated to 3.1.1

Version 3.1.1 - July, 2023
- Fixed regression in Word(min).
- Fixed bug in bad exception messages raised by Forward expressions.
- Fixed regression in SkipTo, where ignored expressions were not checked when looking
  for the target expression.
- Fixed type annotation for enable_packrat.
- Some general internal code cleanup.
   2023-06-19 10:02:42 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-pyparsing: updated to 3.1.0

Version 3.1.0 - June, 2023
- Added `tag_emitter.py` to examples. This example demonstrates how to insert
  tags into your parsed results that are not part of the original parsed text.

Version 3.1.0b2 - May, 2023
- Updated `create_diagram()` code to be compatible with railroad-diagrams package
  version 3.0.

- Fixed bug in `NotAny`, where parse actions on the negated expr were not being run.
  This could cause `NotAny` to incorrectly fail if the expr would normally match,
  but would fail to match if a condition used as a parse action returned False.

- Fixed `create_diagram()` to accept keyword args, to be passed through to the
  `template.render()` method to generate the output HTML (PR submitted by Aussie \ 
  good catch!)

- Fixed bug in `python_quoted_string` regex.

- Added `examples/bf.py` Brainf*ck parser/executor example. Illustrates using
  a pyparsing grammar to parse language syntax, and attach executable AST nodes to
  the parsed results.

Version 3.1.0b1 - April, 2023
- Added support for Python 3.12.

- API CHANGE: A slight change has been implemented when unquoting a quoted string
  parsed using the `QuotedString` class. Formerly, when unquoting and processing
  whitespace markers such as \t and \n, these substitutions would occur first, and
  then any additional '\' escaping would be done on the resulting string. This would
  parse "\\n" as "\<newline>". Now escapes and \ 
whitespace markers are all processed
  in a single pass working left to right, so the quoted string "\\n" \ 
would get unquoted
  to "\n" (a backslash followed by "n").

- Added named field "url" to `pyparsing.common.url`, returning the entire
  parsed URL string.

- Fixed bug when parse actions returned an empty string for an expression that
  had a results name, that the results name was not saved. That is:

      expr = Literal("X").add_parse_action(lambda tokens: \ 
      result = expr.parse_string("X")

  would raise a `KeyError`. Now empty strings will be saved with the associated
  results name.

- Fixed bug in `SkipTo` where ignore expressions were not properly handled while
  scanning for the target expression.

- Updated `ci.yml` permissions to limit default access to source - submitted by Joyce
  Brum of Google. Thanks so much!

- Updated the `lucene_grammar.py` example (better support for '*' and '?' wildcards)
  and corrected the test cases - brought to my attention by Elijah Nicol, good catch!

Version 3.1.0a1 - March, 2023
- API ENHANCEMENT: `Optional(expr)` may now be written as `expr | ""`

  This will make this code:

      "{" + Optional(Literal("A") | Literal("a")) \ 
+ "}"

  writable as:

      "{" + (Literal("A") | Literal("a") | \ 
"") + "}"

  Some related changes implemented as part of this work:
  - `Literal("")` now internally generates an `Empty()` (and no longer \ 
raises an exception)
  - `Empty` is now a subclass of `Literal`

- Added new class property `identifier` to all Unicode set classes in \ 
  using the class's values for `cls.identchars` and `cls.identbodychars`. Now \ 
  parsers that formerly wrote:

      ppu = pyparsing.unicode
      ident = Word(ppu.Greek.identchars, ppu.Greek.identbodychars)

  can now write:

      ident = ppu.Greek.identifier
      # or
      # ident = ppu.Ελληνικά.identifier

- `ParseResults` now has a new method `deepcopy()`, in addition to the current
  `copy()` method. `copy()` only makes a shallow copy - any contained `ParseResults`
  are copied as references - changes in the copy will be seen as changes in the \ 
  In many cases, a shallow copy is sufficient, but some applications require a \ 
deep copy.
  `deepcopy()` makes a deeper copy: any contained `ParseResults` or other mappings or
  containers are built with copies from the original, and do not get changed if the
  original is later changed.

- Reworked `delimited_list` function into the new `DelimitedList` class.
  `DelimitedList` has the same constructor interface as `delimited_list`, and
  in this release, `delimited_list` changes from a function to a synonym for
  `DelimitedList`. `delimited_list` and the older `delimitedList` method will be
  deprecated in a future release, in favor of `DelimitedList`.

- Error messages from `MatchFirst` and `Or` expressions will try to give more details
  if one of the alternatives matches better than the others, but still fails.

- Added new class method `ParserElement.using_each`, to simplify code
  that creates a sequence of `Literals`, `Keywords`, or other `ParserElement`

  For instance, to define suppressible punctuation, you would previously

      LPAR, RPAR, LBRACE, RBRACE, SEMI = map(Suppress, "(){};")

  You can now write:

      LPAR, RPAR, LBRACE, RBRACE, SEMI = Suppress.using_each("(){};")

  `using_each` will also accept optional keyword args, which it will
  pass through to the class initializer. Here is an expression for
  single-letter variable names that might be used in an algebraic

      algebra_var = MatchFirst(
          Char.using_each(string.ascii_lowercase, as_keyword=True)

- Added new builtin `python_quoted_string`, which will match any form
  of single-line or multiline quoted strings defined in Python.

- Extended `expr[]` notation for repetition of `expr` to accept a
  slice, where the slice's stop value indicates a `stop_on`

      test = "BEGIN aaa bbb ccc END"
      BEGIN, END = Keyword.using_each("BEGIN END".split())
      body_word = Word(alphas)

      expr = BEGIN + Group(body_word[...:END]) + END
      # equivalent to
      # expr = BEGIN + Group(ZeroOrMore(body_word, stop_on=END)) + END



      ['BEGIN', ['aaa', 'bbb', 'ccc'], 'END']

- `ParserElement.validate()` is deprecated. It predates the support for \ 
  parsers, and was prone to false positives (warning that a grammar was invalid when
  it was in fact valid).  It will be removed in a future pyparsing release. In its
  place, developers should use debugging and analytical tools, such as \ 
  and `ParserElement.create_diagram()`.

- Added bool `embed` argument to `ParserElement.create_diagram()`.
  When passed as True, the resulting diagram will omit the `<DOCTYPE>`,
  `<HEAD>`, and `<BODY>` tags so that it can be embedded in other
  HTML source. (Useful when embedding a call to `create_diagram()` in
  a PyScript HTML page.)

- Added `recurse` argument to `ParserElement.set_debug` to set the
  debug flag on an expression and all of its sub-expressions.

- Added '·' (Unicode MIDDLE DOT) to the set of Latin1.identbodychars.

- Fixed bug in `Word` when `max=2`. Also added performance enhancement
  when specifying `exact` argument.

- `Word` arguments are now validated if `min` and `max` are both
  given, that `min` <= `max`; raises `ValueError` if values are invalid.

- Fixed bug in srange, when parsing escaped '/' and '\' inside a
  range set.

- Fixed exception messages for some `ParserElements` with custom names,
  which instead showed their contained expression names.

- Fixed bug in pyparsing.common.url, when input URL is not alone
  on an input line.

- Multiple added and corrected type annotations. With much help from
  Stephen Rosen, thanks!

- Some documentation and error message clarifications on pyparsing's
  keyword logic, cited by Basil Peace.

- General docstring cleanup for Sphinx doc generation, PRs submitted
  by Devin J. Pohly. A dirty job, but someone has to do it - much

- `invRegex.py` example renamed to `inv_regex.py` and updated to PEP-8
  variable and method naming. PR submitted by Ross J. Duff, thanks!

- Removed examples `sparser.py` and `pymicko.py`, since each included its
  own GPL license in the header. Since this conflicts with pyparsing's
  MIT license, they were removed from the distribution to avoid
  confusion among those making use of them in their own projects.
   2022-05-18 10:50:41 by Thomas Klausner | Files touched by this commit (3) | Package updated
Log message:
py-pyparsing: update to 3.0.9.

Version 3.0.9 -
- Added Unicode set `BasicMultilingualPlane` (may also be referenced
  as `BMP`) representing the Basic Multilingual Plane (Unicode
  characters up to code point 65535). Can be used to parse
  most language characters, but omits emojis, wingdings, etc.
  Raised in discussion with Dave Tapley (issue #392).

- To address mypy confusion of `pyparsing.Optional` and `typing.Optional`
  resulting in `error: "_SpecialForm" not callable` message
  reported in issue #365, fixed the import in exceptions.py. Nice
  sleuthing by Iwan Aucamp and Dominic Davis-Foster, thank you!
  (Removed definitions of `OptionalType`, `DictType`, and `IterableType`
  and replaced them with `typing.Optional`, `typing.Dict`, and
  `typing.Iterable` throughout.)

- Fixed typo in jinja2 template for railroad diagrams, thanks for the
  catch Nioub (issue #388).

- Removed use of deprecated `pkg_resources` package in
  railroad diagramming code (issue #391).

- Updated bigquery_view_parser.py example to parse examples at
   2022-04-12 09:39:15 by Adam Ciarcinski | Files touched by this commit (3)
Log message:
py-pyparsing: switch back to egg.mk to avoid dependency hell
   2022-04-11 13:21:05 by Adam Ciarcinski | Files touched by this commit (3) | Package updated
Log message:
py-pyparsing: updated to 3.0.8

Version 3.0.8
- API CHANGE: modified pyproject.toml to require Python version
  3.6.8 or later for pyparsing 3.x. Earlier minor versions of 3.6
  fail in evaluating the `version_info` class (implemented using
  `typing.NamedTuple`). If you are using an earlier version of Python
  3.6, you will need to use pyparsing 2.4.7.

- Improved pyparsing import time by deferring regex pattern compiles.

- Updated build to use flit, PR by Michał Górny, added BUILDING.md
  doc and removed old Windows build scripts - nice cleanup work!

- More type-hinting added for all arithmetic and logical operator
  methods in `ParserElement`. PR from Kazantcev Andrey, thank you.

- Fixed `infix_notation`'s definitions of `lpar` and `rpar`, to accept
  parse expressions such that they do not get suppressed in the parsed
  results. PR submitted by Philippe Prados, nice work.

- Fixed bug in railroad diagramming with expressions containing `Combine`
  elements. Reported by Jeremy White, thanks!

- Added `show_groups` argument to `create_diagram` to highlight grouped
  elements with an unlabeled bounding box.

- Added `unicode_denormalizer.py` to the examples as a demonstration
  of how Python's interpreter will accept Unicode characters in
  identifiers, but normalizes them back to ASCII so that identifiers
  `print` and `𝕡𝓻ᵢ𝓃𝘁` and `𝖕𝒓𝗂𝑛ᵗ` are all equivalent.

- Removed imports of deprecated `sre_constants` module for catching
  exceptions when compiling regular expressions. PR submitted by
  Serhiy Storchaka, thank you.
   2022-01-21 12:31:47 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-pyparsing: updated to 3.0.7

Version 3.0.7
- Fixed bug 345, in which delimitedList changed expressions in place
  using expr.streamline(). Reported by Kim Gräsman, thanks!

- Fixed bug 346, when a string of word characters was passed to WordStart
  or WordEnd instead of just taking the default value. Originally posted
  as a question by Parag on StackOverflow, good catch!

- Fixed bug 350, in which White expressions could fail to match due to
  unintended whitespace-skipping. Reported by Fu Hanxi, thank you!

- Fixed bug 355, when a QuotedString is defined with characters in its
  quoteChar string containing regex-significant characters such as ., *,
  ?, [, ], etc.

- Fixed bug in ParserElement.run_tests where comments would be displayed
  using with_line_numbers.

- Added optional "min" and "max" arguments to \ 
`delimited_list`. PR
  submitted by Marius, thanks!

- Added new API change note in `whats_new_in_pyparsing_3_0_0`, regarding
  a bug fix in the `bool()` behavior of `ParseResults`.

  Prior to pyparsing 3.0.x, the `ParseResults` class implementation of
  `__bool__` would return `False` if the `ParseResults` item list was empty,
  even if it contained named results. In 3.0.0 and later, `ParseResults` will
  return `True` if either the item list is not empty *or* if the named
  results dict is not empty.

      # generate an empty ParseResults by parsing a blank string with
      # a ZeroOrMore
      result = Word(alphas)[...].parse_string("")

      # add a results name to the result
      result["name"] = "empty result"



      {'name': 'empty result'}

  In previous versions, the second call to `bool()` would return `False`.

- Minor enhancement to Word generation of internal regular expression, to
  emit consecutive characters in range, such as "ab", as \ 
"ab", not "a-b".

- Fixed character ranges for search terms using non-Western characters
  in booleansearchparser, PR submitted by tc-yu, nice work!

- Additional type annotations on public methods.