diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-08 12:57:24 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-08 12:57:24 -0400 |
| commit | e742c2bad5386eef44ea423301faf689706f61a7 (patch) | |
| tree | c5f5e102f02ae7d29f3a47f063ed30a467822a3e /src | |
| parent | 535ad31b2feb49f477c0496fe55d0e9ed7cb0525 (diff) | |
Verify system dot syntax, only allowing • before words
Diffstat (limited to 'src')
| -rw-r--r-- | src/c.bqn | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -54,10 +54,12 @@ Tokenize←{ ie←/f⋄is←ie≠⊸↑/1»f⋄Fs←{is/˜↩𝕨⋄𝕨/𝕩} # Token start and end is-↩is(-×⊏⟜c)ie # Comment → ending newline only t←CharCode ie⊏𝕩 - w←»⊸<l←t M bD(⊣≍-˜)○⊑bW⋄us←t=¯1++´bA # Word chars l, start w + w←»⊸<l←t M bD(⊣≍-˜)○⊑bW # Word chars l, start w + us←t=¯1++´bA⋄sy←t=⊑bW # Underscore, system dot wk←na⌊∘÷˜(⊑bA)-˜w/t # Kind of word from first char t-↩na×l∧t≥na+⊑bA # Case-insensitive - wi←0<wt←(2×wk≥0)(×⟜¬+⊢)w/»t=⊑bW # Type: 0 number, 1 system, 2 identifier + {⟨𝕩/is,"System dot with no name"⟩!0}⍟(∨´)sy>«l + wi←0<wt←(2×wk≥0)(×⟜¬+⊢)w/»sy # Type: 0 number, 1 system, 2 identifier i←l>n←l∧(+`w)⊏0∾¬wi # Identifier/Number masks num←is ReadNums○(((0∾us)<∨⟜«0∾n)/0⊸∾) t×l # Numbers ir←(us/˜«⊸<i)(⊢+∧⟜(2⊸=))wi/wk # Identifier role |
