Skip to content

Commit

Permalink
Special treatment for filesize 0b (#133)
Browse files Browse the repository at this point in the history
This PR is a partial fix for file size `0b` which will lead to parse
error in current grammar.

<img width="388" alt="image"
src="https://github.com/user-attachments/assets/81d231fd-b1c8-4d19-a2db-0ea345d4555b">

Since `0b` is a special single terminal token in `$.val_number` and
`$.val_binary`.
A perfect split into `value` 0 and `unit` b needs unnecessarily
complicated tweaking of potential conflicts (also need to split `0b` in
other 2 rules).

With this PR however, `0b` is added to `$.val_filesize` as a special
case, no detailed fields generated:

```scheme
  (pipeline [0, 0] - [1, 0]
    (pipe_element [0, 0] - [0, 2]
      (val_filesize [0, 0] - [0, 2])))
```

But it avoids the error with minimal effort.
  • Loading branch information
blindFS authored Nov 6, 2024
1 parent 5b1375e commit d8b3356
Show file tree
Hide file tree
Showing 5 changed files with 467,876 additions and 465,029 deletions.
11 changes: 8 additions & 3 deletions grammar.js
45 changes: 27 additions & 18 deletions src/grammar.json
4 changes: 2 additions & 2 deletions src/node-types.json
932,819 changes: 467,814 additions & 465,005 deletions src/parser.c
26 changes: 25 additions & 1 deletion test/corpus/expr/units.nu

0 comments on commit d8b3356

Please sign in to comment.