diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-30 16:55:52 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-01-30 16:55:52 -0500 |
| commit | 64f1140c9e2cbf435c5c10a30a50dff4838e0a1e (patch) | |
| tree | 460ba9f5e8f9ffb5aa6bbfc5a94f8d0f4a88c86b /src | |
| parent | afadc45f29d34de5b4bce0b1ebe751436939a77b (diff) | |
Test for underscore-prefixed numbers instead of treating them like identifiers
Diffstat (limited to 'src')
| -rw-r--r-- | src/c.bqn | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -60,7 +60,8 @@ Tokenize←{ i←l>n←l∧(+`w)⊏0∾wk<0 # Identifier/Number masks num←is ReadNums○(((0∾us)<∨⟜«0∾n)/0⊸∾) t×l # Numbers ir←(us/˜«⊸<i)(⊢+∧⟜(2⊸=))0⊸≤⊸/wk # Identifier role - id←(1-˜(i>us)×+`w>n)⊔t # Identifiers + id←(ig←1-˜(i>us)×+`w>n)⊔t # Identifiers + {⟨ig⊐/𝕩,"Numbers can't start with underscores"⟩!0}⍟(∨´)(⊑bA)>⊑¨id # Deduplicate literals and identifiers; other cleanup ki←((⍋⊏⟜n)⊸⊏/w)∾(ci∾/si)⊏+`»f # Indices in t |
