lkesteloot / turbopascal

Web-based Turbo Pascal compiler.
https://www.teamten.com/lawrence/projects/turbo_pascal_compiler/
BSD 2-Clause "Simplified" License
483 stars 54 forks source link

Add scientific notation to the Lexer #5

Closed ghost closed 8 years ago

ghost commented 8 years ago

I think what i did is self-explanatory, we keep getting characters until we bump into an e, the we check if the next characters is allowed (i.e is +, - or simply a number), and then we keep getting numbers, if the nextCh is not a number then we return a tokens whose value is the scientific notation translated into a real type Would it be a good idea if 0xab2 and 0b10101 also translated this way ?

lkesteloot commented 8 years ago

Thank you! I fixed up the state machine a bit in subsequent change 1b5f322. The resulting code is simpler and is a better match for the original spec.

Not sure what you mean by parsing hex numbers the same way.