diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-06-07 17:19:15 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-06-07 17:19:15 -0400 |
| commit | 4de8120b4f38494452205753e9cb481f22e1c0e9 (patch) | |
| tree | cfdd3a275353cf0a76a1bea6b89b77fe6a9b16e5 | |
| parent | a3366e9228504eb372680c3e384df1809e03f0a1 (diff) | |
Handle whitespace, comments, and alternate separators
| -rwxr-xr-x | c.bqn | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,9 +1,12 @@ #!/usr/bin/env bqn Parse←{ ⟨⟩Parse𝕩;args←𝕨⋄x←𝕩 - seps←"⋄,"∾•UCS 10⋄x(/˜)↩¬(1⌾⊑1⌽1⌾⊑)⊸∧x∊seps + lf‿tab←•UCS 10‿9 + x(/˜)↩¬(x∊' '∾tab)∨<○(⌈`↕∘≠⊸×)´(lf∾'⍝')=⌜x + seps←"⋄,"∾lf⋄x(/˜)↩¬(1⌾⊑1⌽1⌾⊑)⊸∧x∊seps a←x∊"←↩"⋄at←1⌽a⋄vars←at/x⋄x(/˜)↩¬a⋄a(/˜)↩¬at - l←≠x⋄o←x='('⋄c←x=')'⋄sep←x∊seps⋄v←a-˜x∊•d∾args∾vars⋄f←¬o∨c∨v∨sep + l←≠x⋄sep←x∊seps⋄x↩'⋄'¨⌾(sep⊸/)x + o←x='('⋄c←x=')'⋄v←a-˜x∊•d∾args∾vars⋄f←¬o∨c∨v∨sep na←(2×sep)+f×1+l↑0∾c∨v e←/c⋄d←+`o-c ed←e⊏d⋄b←(⍋⍋ed)⊏(⍋⊏⟜d)⊸⊏/o |
