Lexer floating point issue #95

Closed
opened 2023-01-29 11:56:21 +00:00 by deavmi · 1 comment
Owner

What is it?

Well, the lexer supports floating points but it somehow supports this:

module simple_literals;

int var = 1.2.2;

However, it actually returns 1.2, it's just that the lexer should actually hand up on something like this.

Mmmnh....

It sees this:

.2 at (3, 11), . at (3, 14), 2 
### What is it? Well, the lexer supports floating points but it somehow supports this: ```d module simple_literals; int var = 1.2.2; ``` However, it actually returns `1.2`, it's just that the lexer should actually hand up on something like this. Mmmnh.... It sees this: ``` .2 at (3, 11), . at (3, 14), 2 ```
deavmi added this to the Basics milestone 2023-01-29 11:56:22 +00:00
deavmi added the
needsfix
parser
lexer
labels 2023-01-29 11:56:22 +00:00
deavmi self-assigned this 2023-01-29 11:56:22 +00:00
deavmi added this to the Lexer project 2023-01-29 11:56:22 +00:00
Author
Owner

Actually, I see it sees 1.2.2 as 1.2 (float . (dot operator) followed by literal 2. this is fine.

Infact we see this work even with 1.2.2.2 which is (1.2) . (2.2):

module simple_literals;

int var = 1.2.2.2;

This is fine :

[module at (1, 1), simple_literals at (1, 9), ; at (1, 23), int at (3, 1), var at (3, 5), = at (3, 9), 1.2 at (3, 11), . at (3, 14), 2.2 at (3, 15), ; at (3, 18)]
Actually, I see it sees `1.2.2` as `1.2` (float `.` (dot operator) followed by literal `2`. this is fine. Infact we see this work even with `1.2.2.2` which is `(1.2) . (2.2)`: ```d module simple_literals; int var = 1.2.2.2; ``` This is fine ✅ : ``` [module at (1, 1), simple_literals at (1, 9), ; at (1, 23), int at (3, 1), var at (3, 5), = at (3, 9), 1.2 at (3, 11), . at (3, 14), 2.2 at (3, 15), ; at (3, 18)] ```
deavmi added reference literal_encodings 2023-01-29 12:12:10 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tlang/tlang#95
No description provided.