Skip to content

fix(lexer): scientific notation without a decimal point (1e6, 2E-3, 1E+3) - #98

Merged
ecto merged 3 commits into
mainfrom
claude/sci-notation
Nov 8, 2026
Merged

ecto merged 3 commits into
mainfrom
claude/sci-notation

Conversation

@ecto

@ecto ecto commented Nov 7, 2026

Copy link
Copy Markdown
Owner

1e6 lexed as Int("1e") + Int("6"); the e suffix then desugared to [unit 1 :e] → runtime "unknown unit: e" (found fuzzing vcad's create_cad_loon with [cube 1e6 1e6 1e6]).

Adds a Float token rule for digits [eE] [+-]? digits (suffix)?, which wins over the Int unit-suffix rule by longest match. Unit suffixes (10mm, 2.5in, 90deg, 1e3mm) still desugar to [unit …].

Tests: parse_scientific_notation_without_decimal_point, unit_suffixes_still_desugar. cargo test -p loon-lang green on Linux (553 lib tests). Note: cargo clippy -p loon-lang -- -D warnings already fails with 285 errors on origin/main; this PR doesn't change that.

🤖 Generated with Claude Code

ecto and others added 3 commits November 7, 2026 18:53
1e6 lexed as Int("1e") + Int("6"), and the "e" suffix desugared to
[unit 1 :e] -> runtime error "unknown unit: e". Add a Float rule for
digits+exponent that wins by longest match; unit suffixes still work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ecto added a commit to muni-works/vcad that referenced this pull request Nov 8, 2026
…attern aliases

From fuzzing create_cad_loon in the Mac app:

- union/intersection/difference are variadic (n >= 1), subject-last fold;
  [difference A B] = B - A is unchanged and now documented in lib.loon.
- cube/cylinder/sphere/cone (and -n forms) reject non-positive or
  non-finite dimensions instead of silently abs()-ing (-10 -> 10) or
  building zero-volume parts; a cone may have one zero radius, not both.
- Argument type errors name the stdlib function and argument position
  ("translate: argument 4 expected Solid, got number 3") and, when the
  call site is unique in the source, its line/col.
- linear_pattern / circular_pattern aliases for the kebab-case forms.
- Scientific-notation test added (ignored until the loon-lang rev bump
  for ecto/loon#98).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ecto
ecto merged commit 7b78f05 into main Nov 8, 2026
4 checks passed
ecto added a commit to muni-works/vcad that referenced this pull request Nov 8, 2026
…tion)

Bumps the root Cargo.toml rev + Cargo.lock and un-ignores
scientific_notation_literals_are_numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant