summaryrefslogtreecommitdiff
path: root/pyparsing/core.py
Commit message (Collapse)AuthorAgeFilesLines
* Doc updates, remove references to deprecated delimitedList and ↵ptmcg2023-04-191-4/+4
| | | | delimited_list (use DelimitedList class)
* Fix regex matching for Python quoted stringsptmcg2023-04-181-4/+4
|
* Fix railroad so head, body args included in html (#479)Aussie Schnore2023-04-181-2/+2
|
* Blackenptmcg2023-04-031-1/+0
|
* Small perf optimization for `expr | ""` mapping to `Optional(expr)`ptmcg2023-03-291-0/+3
|
* Fix #474 - redo QuotedString '\' escape handling as a state machine so that ↵ptmcg2023-03-281-9/+27
| | | | all transforms are done left to right
* Fix #475 - SkipTo used incorrect storage of ignore expressions, would match ↵ptmcg2023-03-261-11/+6
| | | | the target expression if present within an ignorable
* Don't always override exception messages in MatchFirst or Or classes - ↵ptmcg2023-03-071-2/+7
| | | | addresses #464
* Add ParseResults.deepcopy() - fixes #463ptmcg2023-03-061-2/+3
|
* Remove future import annotations - fixes #465ptmcg2023-02-121-3/+2
|
* Fix some type annotations; fixes Issue #456ptmcg2022-12-221-12/+16
|
* Added DelimitedList class, for better handling of naming and diagramming ↵ptmcg2022-12-111-0/+65
| | | | (replaces delimited_list function)
* Additional measures to prevent premature streamlining (Issue #447)ptmcg2022-11-101-3/+4
|
* Deprecate ParserElement.validate() (Issue #444)ptmcg2022-11-061-0/+20
|
* Added new class method `ParserElement.using_each`ptmcg2022-11-061-0/+12
|
* Add doc and error message clarifications about Word with as_keyword=True. ↵ptmcg2022-07-181-2/+4
| | | | Fixes #433.
* Add type annotationsptmcg2022-07-141-33/+67
|
* Add recurse option to set_debug(), fixes #399ptmcg2022-07-111-1/+25
|
* Some micro-optimizationsptmcg2022-07-091-15/+15
|
* Simpler fix for __new__ with copy.copy() (#427)Devin J. Pohly2022-07-091-8/+4
|
* Small docstring formatting/syntax fixes (#426)Devin J. Pohly2022-07-091-4/+4
| | | | | ``...`` needs to be surrounded by non-word characters to be detected, and backslash-space in a non-raw Python string should technically be written backslash-backslash-space.
* Add return of NotImplemented to other binary operators (similar to PR #425), ↵ptmcg2022-07-041-0/+20
| | | | and add unit tests
* Return NotImplemented for unsupported operations (#425)Devin J. Pohly2022-07-041-36/+12
| | | Fixes #424.
* Added python_quoted_string; fixed exception messages for ParseElementEnhance ↵ptmcg2022-06-291-3/+26
| | | | subclasses
* Remove assignment to __class__ in Word, remove internal _WordRegex classptmcg2022-06-241-11/+4
|
* Simplify code that incrementally builds a ParseResultsptmcg2022-06-231-4/+2
|
* Additional docstring and sphinx cleanupptmcg2022-06-181-2/+2
|
* There will be blackptmcg2022-06-171-3/+0
|
* Explicitly declare compatibility alias functions (#414)Devin J. Pohly2022-06-171-35/+124
| | | | | This allows static type checkers to find and check these functions correctly, and it removes the need to fiddle around with stack frames to get the aliases defined.
* Fix docstring synonyms for parseString, scanString, et al.; refactor ↵ptmcg2022-06-171-6/+6
| | | | replaces_prePEP8_function decorator to handle new methods correctly
* Add mypy ignore directives for intentional Python rule-bendingptmcg2022-06-161-10/+13
|
* Cleanup docstrings using replaces_prePEP8_function decorator; and blackptmcg2022-06-161-30/+29
|
* Use Literal.__new__ to select optimized subclasses (#413)Devin J. Pohly2022-06-161-19/+37
| | | | | | | | | | | | | | | | | | | * Use Literal.__new__ to select optimized subclasses This turns Literal() into a factory which creates an object of the appropriate type from the start, rather than having to overwrite the __class__ attribute later. * Fix Literal.__copy__() Instance attributes from superclasses weren't being transferred to the copy. Regression test included. * Make Empty a subclass of Literal This unifies the logic with other optimized literal classes like _SingleCharLiteral, and it seemed right in terms of a type relationship. * Style
* Clean up docstrings to use new PEP8 names instead of old camelCase namesptmcg2022-06-161-8/+8
|
* Fix up docstrings for deprecated functions (doc as deprecated, instead of ↵ptmcg2022-06-161-2/+3
| | | | duplicating actual function doc) - issue #411
* fix Sphinx errors/warnings (#410)Devin J. Pohly2022-06-101-6/+8
| | | | | | Two warnings remain from the Hebrew and Devanagari names in pyparsing_unicode, but those are due to Sphinx using Python's builtin `re` library to parse identifiers (which does not have thorough Unicode handling for `\w`).
* Fix Word(max=2) (issue #409); create re for Word(exact=n) exprs; validate ↵ptmcg2022-06-101-22/+32
| | | | that min <= max if both given
* Fix list formatting in docstrings (#407)Devin J. Pohly2022-06-071-26/+37
| | | | | | | | | * Fix list formatting in docstrings A few docstrings were missing a blank line before lists, causing the start of the list to be parsed by RST as a continuation of the previous line. * add backticks to parameter names in lists
* Convert most str.format() calls to use f-stringsptmcg2022-05-301-129/+69
|
* More added type annotations; reworked Word.__init__ so that excludeChars ↵ptmcg2022-05-291-50/+53
| | | | exclusion code is clearer
* Fix/ignore mypy attr-defined errors, where attr definitions are intentionalptmcg2022-05-291-2/+5
|
* Fix type annotations of Forward dunder-methods (#402)Stephen Rosen2022-05-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix type annotations of Forward dunder-methods The `__lshift__`, `__ilshift__`, and `__or__` methods each return a ParserElement object, but have no annotated return type. The result is that the following code will not type check: def foo() -> pp.ParserElement: expr = pp.Forward() expr <<= bar() return expr | pp.Literal("baz") whereas the code will type check if the return line is changed to return pp.MatchFirst([expr, pp.Literal("baz")]) This is a bug in the types which can be resolved fairly simply with some return type annotations. Testing is more complicated. Testing annotation accuracy is a relatively novel space with a few options, none of which can be considered standard as of yet. Many solutions require learning a new toolchain only for that purpose. However, one of the lower-impact options is to use `mypy --warn-unused-ignores` to check that annotations satisfy some constraints. This isn't the most precise test possible, but it's simple and uses a widely known and familiar tool for the job. `tox -e mypy-tests` is a new tox env which calls `mypy` in the desired way. We can confirm with a new test case file that `tox -e mypy-tests` fails prior to this change to `pyparsing/` and that it passes with the change made. * Comment out mypy-test tox env for CI Until CI adjustments are made, it's not possible to add mypy-test to the tox config. It will be run under pypy where it does not work until other changes are made.
* Cleaned up/expanded some docstrings and docs to reflect new 3.0.10 changesptmcg2022-05-201-0/+5
|
* Add embed argument to create_diagram, to suppress DOCTYPE, HEAD, and BODY tagsptmcg2022-05-201-2/+5
|
* Make expr[:ender] equivalent to expr[...:ender]ptmcg2022-05-181-2/+4
|
* Add support for slice in expr[] notation, to pass stop_on repetition sentinelptmcg2022-05-181-0/+20
|
* Fixed bug in srange (escaped chars inside range set); fixed ignore type ↵ptmcg2022-05-141-4/+4
| | | | annotation in SkipTo
* Update docstrings, replacing ZeroOrMore and OneOrMore with [...] and [1, ↵ptmcg2022-04-111-20/+20
| | | | ...] notation
* Reworked mypy typing, removed definitions of OptionalType, DictType, and ↵ptmcg2022-04-111-44/+46
| | | | IterableType
* Added show_groups arg to create_diagram; prep for releasepyparsing_3.0.8ptmcg2022-04-091-1/+3
|