• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / py-slang / 34236008069
86%

Build:
DEFAULT BRANCH: main
Ran 08 Sep 2026 02:21PM UTC
Jobs 1
Files 139
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

08 Sep 2026 02:05PM UTC coverage: 85.753%. Remained the same
34236008069

push

github

web-flow
feat(parser): make comparison operators non-associative (#463)

* feat(parser): make comparison operators non-associative

Chained comparisons (a < b < c) previously parsed left-associatively
as (a < b) < c, which is not what full Python does (there, it's sugar
for a < b and b < c, evaluating b once and short-circuiting before c).
That mismatch meant chaining silently diverged by chapter: always a
TypeError at §1/§2 (bool isn't a valid ordering operand there), but a
silently wrong result at §3/§4 (bool coerces to int there, so e.g.
1 < 3 < 2 evaluates to True instead of full Python's False).

Rather than documenting that divergence, exclude chaining from the
sublanguage entirely: expressionCmp now takes expressionAdd on both
sides instead of recursing on the left, so every comparison,
membership (in/not in), and identity (is/is not) operator takes
exactly two operands. Chaining any of them - or mixing different ones,
e.g. a < b == c - is now a syntax error at parse time, uniformly
across all four chapters, rather than chapter-dependent runtime
behavior. Verified via parser-adapter that 1 < 2 < 3, 1 == 2 == 3,
1 is 2 is 3, and 1 in [2] in [3] are all rejected, while ordinary
single comparisons still parse.

Regenerated src/parser/python-grammar.ts via `npm run compile-grammar`
and updated the two nearley-parser.test.ts tests that asserted the old
left-associative chaining, adding coverage for the mixed-operator and
membership/identity cases. Full suite (19712 tests) still passes.

Updates docs/specs/python_precedence.tex and _3.tex to match: marks
comparison/membership/identity associativity as "n/a" and replaces the
chapter-dependent-behavior notes with an explanation of this
deliberate sublanguage restriction, per @martin-henz's PR #462 review
feedback.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQg5WPyxbnsMLEVveyqML8

* style: fix prettier formatting in nearley-parser.test.ts

format:ci ... (continued)

4892 of 6131 branches covered (79.79%)

Branch coverage included in aggregate %.

10920 of 12308 relevant lines covered (88.72%)

162109.64 hits per line

Jobs
ID Job ID Ran Files Coverage
1 34236008069.1 08 Sep 2026 02:21PM UTC 139
85.75
GitHub Action Run
Source Files on build 34236008069
  • Tree
  • List 139
  • Changed 1
  • Source Changed 1
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #34236008069
  • 306374c0 on github
  • Prev Build on main (#34216270117)
  • Next Build on main (#34242982262)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc