littlewing 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -411,7 +411,7 @@ declare class Lexer {
411
411
  private skipWhitespaceAndComments;
412
412
  /**
413
413
  * Read a number token
414
- * Supports: integers (42), decimals (3.14), and scientific notation (1.5e6, 2e-3)
414
+ * Supports: integers (42), decimals (3.14), decimal shorthand (.2), and scientific notation (1.5e6, 2e-3, .5e2)
415
415
  */
416
416
  private readNumber;
417
417
  /**
package/dist/index.js CHANGED
@@ -446,6 +446,9 @@ class Lexer {
446
446
  if (this.isDigit(char)) {
447
447
  return this.readNumber();
448
448
  }
449
+ if (char === "." && this.isDigit(this.peek())) {
450
+ return this.readNumber();
451
+ }
449
452
  if (this.isLetter(char) || char === "_") {
450
453
  return this.readIdentifier();
451
454
  }
@@ -558,6 +561,10 @@ class Lexer {
558
561
  const start = this.position;
559
562
  let hasDecimal = false;
560
563
  let hasExponent = false;
564
+ if (this.getCharAt(this.position) === ".") {
565
+ hasDecimal = true;
566
+ this.position++;
567
+ }
561
568
  while (this.position < this.source.length) {
562
569
  const char = this.getCharAt(this.position);
563
570
  if (this.isDigit(char)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "littlewing",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "A minimal, high-performance arithmetic expression language with lexer, parser, and executor. Optimized for browsers with zero dependencies and type-safe execution.",
5
5
  "keywords": [
6
6
  "arithmetic",