aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xc.bqn24
1 files changed, 20 insertions, 4 deletions
diff --git a/c.bqn b/c.bqn
index 66edc3ca..b7a26d67 100755
--- a/c.bqn
+++ b/c.bqn
@@ -2,13 +2,29 @@
⊔↩((↕1+(>⌈´))=¨<)∘⊣ /¨⟜< ↕∘≠⍠⊢
+lf‿tab←•UCS 10‿9
+chR←"⍝" ⍝ Remark
+chD←•d ⍝ +⟜(↕10)⌾•UCS'0' ⍝ Digit
+chN←"¯.π∞" ⍝ Numeric
+chA←' '(⊢∾+)⌾•UCS•a ⍝ Alphabetic
+chU←"_" ⍝ Underscore
+chF←"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔" ⍝ Function
+chM←"˜˘¨⌜⁼´`" ⍝ Modifier
+chC←"∘○⊸⟜⌾⎉⚇⍟" ⍝ Composition
+chP←"𝕨𝕎𝕩𝕏𝕗𝔽𝕘𝔾" ⍝ Parameter
+chW←" "∾tab ⍝ Whitespace
+chS←"⋄,"∾lf ⍝ Separator
+chG←"←↩→" ⍝ Gets
+chB←"(){}⟨⟩" ⍝ Bracket
+chL←"‿" ⍝ Ligature
+chQ←"'""" ⍝ Quote
+
Parse←{
⟨⟩Parse𝕩;args←𝕨⋄x←𝕩
- lf‿tab←•UCS 10‿9
- x(/˜)↩¬(x∊' '∾tab)∨<○(⌈`↕∘≠⊸×)´(lf∾'⍝')=⌜x
- seps←"⋄,"∾lf⋄x(/˜)↩¬(1⌾⊑1⌽1⌾⊑)⊸∧x∊seps
+ x(/˜)↩¬(x∊chW)∨<○(⌈`↕∘≠⊸×)´(lf∾chR)=⌜x
+ x(/˜)↩¬(1⌾⊑1⌽1⌾⊑)⊸∧x∊chS
a←x∊"←↩"⋄at←1⌽a⋄vars←at/x⋄x(/˜)↩¬a⋄a(/˜)↩¬at
- l←≠x⋄sep←x∊seps⋄x↩'⋄'¨⌾(sep⊸/)x
+ l←≠x⋄sep←x∊chS⋄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