arc-lang 0.6.14 → 0.6.15

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/ast.d.ts CHANGED
@@ -182,7 +182,7 @@ export interface GroupExpr {
182
182
  expr: Expr;
183
183
  loc: Loc;
184
184
  }
185
- export type Pattern = WildcardPattern | LiteralPattern | BindingPattern | ArrayPattern | OrPattern | ConstructorPattern;
185
+ export type Pattern = WildcardPattern | LiteralPattern | BindingPattern | ArrayPattern | OrPattern | ConstructorPattern | RangePattern;
186
186
  export interface WildcardPattern {
187
187
  kind: "WildcardPattern";
188
188
  loc: Loc;
@@ -213,6 +213,12 @@ export interface ConstructorPattern {
213
213
  args: Pattern[];
214
214
  loc: Loc;
215
215
  }
216
+ export interface RangePattern {
217
+ kind: "RangePattern";
218
+ from: number;
219
+ to: number;
220
+ loc: Loc;
221
+ }
216
222
  export type Stmt = LetStmt | FnStmt | ForStmt | DoStmt | WhileStmt | ExprStmt | UseStmt | TypeStmt | AssignStmt | MemberAssignStmt | IndexAssignStmt | RetStmt | BreakStmt | ContinueStmt | TryCatchStmt;
217
223
  export interface AssignStmt {
218
224
  kind: "AssignStmt";
@@ -3005,6 +3005,8 @@ function matchPattern(pattern, value, env) {
3005
3005
  return false;
3006
3006
  return pattern.elements.every((p, i) => matchPattern(p, value[i], env));
3007
3007
  }
3008
+ case "RangePattern":
3009
+ return typeof value === "number" && value >= pattern.from && value <= pattern.to;
3008
3010
  case "OrPattern":
3009
3011
  return pattern.patterns.some(p => matchPattern(p, value, env));
3010
3012
  case "ConstructorPattern": {
package/dist/parser.js CHANGED
@@ -1026,7 +1026,17 @@ export class Parser {
1026
1026
  }
1027
1027
  if (t.type === TokenType.Int || t.type === TokenType.Float) {
1028
1028
  this.advance();
1029
- return { kind: "LiteralPattern", value: parseFloat(t.value), loc };
1029
+ const fromVal = parseFloat(t.value);
1030
+ if (this.at(TokenType.Range)) {
1031
+ this.advance();
1032
+ const toTok = this.peek();
1033
+ if (toTok.type !== TokenType.Int && toTok.type !== TokenType.Float) {
1034
+ throw new ParseError(`Expected number after '..' in range pattern`, this.loc());
1035
+ }
1036
+ this.advance();
1037
+ return { kind: "RangePattern", from: fromVal, to: parseFloat(toTok.value), loc };
1038
+ }
1039
+ return { kind: "LiteralPattern", value: fromVal, loc };
1030
1040
  }
1031
1041
  if (t.type === TokenType.String) {
1032
1042
  this.advance();
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const ARC_VERSION = "0.6.14";
1
+ export declare const ARC_VERSION = "0.6.15";
2
2
  export declare const ARC_BUILD_DATE: string;
3
3
  export declare const ARC_PLATFORM: string;
4
4
  /** Print version info */
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // Arc Version System
2
- export const ARC_VERSION = "0.6.14";
2
+ export const ARC_VERSION = "0.6.15";
3
3
  export const ARC_BUILD_DATE = new Date().toISOString().split("T")[0];
4
4
  export const ARC_PLATFORM = `${process.platform}-${process.arch}`;
5
5
  /** Print version info */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arc-lang",
3
- "version": "0.6.14",
3
+ "version": "0.6.15",
4
4
  "description": "Arc ⚡ — A programming language designed by AI agents, for AI agents. 27-63% fewer tokens than JavaScript.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,6 +16,7 @@
16
16
  "scripts": {
17
17
  "build": "tsc",
18
18
  "copy-stdlib": "node -e \"const fs=require('fs');const p=require('path');function cp(s,d){fs.mkdirSync(d,{recursive:true});for(const f of fs.readdirSync(s)){const sp=p.join(s,f),dp=p.join(d,f);fs.statSync(sp).isDirectory()?cp(sp,dp):fs.copyFileSync(sp,dp)}}cp(p.join(__dirname,'..','stdlib'),p.join(__dirname,'stdlib'))\"",
19
+ "postinstall": "node -e \"console.log('\\n ⚡ Arc installed! Try: arc repl\\n Docs: https://docs.arclang.dev\\n Playground: https://play.arclang.dev\\n')\"",
19
20
  "prepublishOnly": "npm run copy-stdlib && tsc",
20
21
  "run": "tsx src/index.ts run",
21
22
  "parse": "tsx src/index.ts parse"