-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for floating points lexing in all bases :)
`src/tokenizer.c`: `consume_floating_number` and `consume_hex_floating_number` are pretty much identical, barring how they accept the base character set, but finally that hurdle is over and done with. `tests/`: Added relevant passing/failing regression tests.
- Loading branch information
Showing
8 changed files
with
196 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,5 @@ build/* | |
.venv/* | ||
.cache/* | ||
.ccls-cache/* | ||
a.out | ||
t.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
int | ||
main (void) | ||
{ | ||
char c = 'a'; | ||
char c = ''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
int | ||
main (void) | ||
{ | ||
float a = .123456789; | ||
float b = 1.; | ||
float c = 1.e-123; | ||
float d = .123e123; | ||
float e = 1.1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
int | ||
main (void) | ||
{ | ||
float a = .123456789asd; | ||
float a_ = .123456789fl; | ||
float b = 1.Lf; | ||
float b_ = 1.asd; | ||
float c = 1.e-123ff; | ||
float c_ = 1.e-123ll; | ||
float d = .123e123FF; | ||
float d_ = .123e123lLL; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
int | ||
main (void) | ||
{ | ||
float a = .123456789f; | ||
float a_ = .123456789l; | ||
float b = 1.f; | ||
float b_ = 1.l; | ||
float c = 1.e-123f; | ||
float c_ = 1.e-123l; | ||
float d = .123e123f; | ||
float d_ = .123e123l; | ||
float e = 1.1f; | ||
float e_ = 1.1l; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* fragment HexadecimalFloatingConstant | ||
* : HexadecimalPrefix (HexadecimalFractionalConstant | HexadecimalDigitSequence) BinaryExponentPart FloatingSuffix? | ||
* ; | ||
*/ | ||
|
||
int | ||
main (void) | ||
{ | ||
float a = 0x123456789abcdef.123456789abcdefp1; | ||
float b = 0x123456789abcdef.123456789abcdefp-1; | ||
float c = 0x.0p-1; | ||
float d = 0x.0p1; | ||
float e = 0x.0p1f; | ||
float f = 0x.0p1l; | ||
} |