From 4aab121d1720ebb8ca2c59b82dc86beeb4593c6d Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 29 Oct 2020 16:02:26 -0400 Subject: Allow cjs.bqn to output source indices, with initial -i argument --- src/cjs.bqn | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/cjs.bqn b/src/cjs.bqn index 47e65d04..abb16c47 100755 --- a/src/cjs.bqn +++ b/src/cjs.bqn @@ -1,7 +1,8 @@ #! /usr/bin/env dbqn compile ← •Import "c.bqn" -Comp ← ¯1 ↓ ((<"runtime["∾⍕∾"]"˙)¨↕62)⊸Compile +useInd ← "-i"≡⊑args←•args ⋄ args↓˜↩useInd +Comp ← (-¬useInd) ↓ ((<"runtime["∾⍕∾"]"˙)¨↕62)⊸Compile FP ← ∞⊸=◶⟨⍕,"Infinity"⟩ Esc ← (⟨"\t","\n","\r","\'","\"""⟩∾<∘⥊)⊑˜("'"""∾˜@+9‿10‿13)⊑∘⊐⊢ Str ← "str("""∾(∾Esc¨)∾""")"˜ @@ -9,12 +10,12 @@ Char ← "'"(∾∾⊣)Esc Fconst ← ≡◶⟨(⊑⍋)∘(∾⟜∞)◶⟨0⊸≤◶⟨"-"∾FP∘|,FP⟩,Char⟩⋄Str⋄⊑⟩ L ← "["∾"]"∾˜1↓·∾","⊸∾⟜⍕¨ J ← ∾∾⟜(@+10)¨ -Fout ← ⟨⊢,Fconst,L⟩ {L𝕎¨𝕩}¨ ⊢ +Fout ← (≠↑⟨⊢,Fconst,L,⊢⟩˙) {L𝕎¨𝕩}¨ ⊢ Frun ← ("provide.concat("∾∾⟜")")⌾(1⊸⊑) Fout -Long ← ∾ (1‿2/⟨" new Uint8Array("∾∾⟜")"⋄((@+10)∾" ,")⊸∾⟩) {𝕎𝕩}¨ ⊢ +Long ← ∾ (≠↑1‿3/⟨" new Uint8Array("∾∾⟜")"⋄((@+10)∾" ,")⊸∾⟩˙) {𝕎𝕩}¨ ⊢ • ← (⊑"r"‿"c"‿"fmt"⊐⊏)◶⟨ {𝕩⋄ref‿len←•Import"pr.bqn"⋄Long Frun len⊸↓⌾(1⊸⊑)Comp ref} {𝕩⋄Long Fout Comp J •LNS "c.bqn"} {𝕩⋄Long Fout Comp J •LNS "fmt.bqn"} ¯1 ↓ · J L∘Fout∘Comp¨ -⟩ •args +⟩ args -- cgit v1.2.3