Skip to content

Commit

Permalink
Merge pull request #5 from yannickbattail/float_start_with_dot_bug
Browse files Browse the repository at this point in the history
Float start with dot bug
  • Loading branch information
hugheaves authored Dec 19, 2023
2 parents 12cb4da + c3da516 commit 93ade7e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,33 @@ SCADFormat is a command line tool.

SCADFormat can be run directly on a file by specifying the filename on the command line:

$ scadformat my-source.scad
INFO formatting file my-source.scad

```bash
scadformat my-source.scad
```
```
INFO formatting file my-source.scad
```
In this mode, SCADFormat will overwrite the existing code with the formatted version. Note that SCADFormat creates a backup of the original file (with a .scadbak extension) before overwriting it.

### Read from stdin / write to stdout

SCADFormat can also read from stdin and write to stdout as follows:

$ scadformat <my-source.scad >my-source-formatted.scad
```bash
scadformat <my-source.scad >my-source-formatted.scad
```

### Format all .scad recursively

Format all .scad files in the directory "." recursively
```bash
find . -type f -name "*.scad" -exec scadformat "{}" \;
```

If you are ok with the result, you can delete all backup files (.scadbak)
```bash
find $directory -type f -name "*.scadbak" -exec rm "{}" \;
```

## Building

Expand Down Expand Up @@ -59,7 +76,6 @@ ANTLR Parser Generator Version 4.13.1
...
```


### Checkout And Build

Once ANTLR and Go are installed, the SCADFormat can be built as follows:
Expand Down
1 change: 1 addition & 0 deletions internal/formatter/testdata/float_start_with_dot_bug.scad
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a=.1;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a = .1;
2 changes: 1 addition & 1 deletion internal/parser/OpenSCAD.g4
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ NUMBER

FLOAT
:
DIGIT+ '.' DIGIT+
DIGIT* '.' DIGIT+
;

INTEGER
Expand Down

0 comments on commit 93ade7e

Please sign in to comment.