Another excellent post 👌🏽 from Russ Cox 👇🏽🫡:

“Floating-Point Printing And Parsing Can Be Simple And Fast” (https://research.swtch.com/fp).

On HN: https://news.ycombinator.com/item?id=46685317

On Lobsters: https://lobste.rs/s/nbsclr/floating_point_printing_parsing_can_be

#Programming #Math #FloatingPoint #Numbers #PLDI #Parsing #Printing

research!rsc: Floating-Point Printing and Parsing Can Be Simple And Fast (Floating Point Formatting, Part 3)

Maybe I'm just parsing it the wrong way, but could you get away with this restaurant name anywhere other Glasgow? And it's in the fashionable area of Finnieston, too!

#glasgow #keepglasgowweird #parsing #finnieston #scotland

How to Avoid eval When Parsing Arrays

eval turns input into execution. Use JSON instead.

#php #eval #json #security #howto #parsing

https://www.youtube.com/watch?v=_MA_XUT34G8

How to Avoid eval When Parsing Arrays #parsing

YouTube

A Percise Parser, by @remyporter.bsky.social:

https://thedailywtf.com/articles/a-percise-parser

#javascript #parsing

A Percise Parser

Thomas worked for a company based in Germany which was looking to expand internationally. Once they started servicing other locales, things started to break. It didn't take long to track the problem down to a very "percise" numeric parser. handleInput( value ){ let value_ = value; if( value.substring( 0, 1 ) === '+' ){ value_ = value.substring( 1 ); } value_ = value_.split( '.' ).join( '' ); if( this.usePercisionIfPercentage && value_.indexOf( ',' ) >= 0 ) { const parsedPreValue = value_.split( ',' )[ 0 ]; const parsedCommaValue = parseInt( value_.split( ',' )[ 1 ], 10 ) < 10 ? parseInt( value_.split( ',' )[ 1 ], 10 ) * 10 : value_.split( ',' )[ 1 ].substring( 0, 2 ); if( parsedCommaValue === 0 ) { value_ = parseInt( parsedPreValue, 10 ); } else { const parsedValue = parseInt( parsedPreValue + parsedCommaValue, 10 ); value_ = parseInt( parsedValue, 10 ) / 100; } } // do stuff with value_ }

The Daily WTF

How to Stop JSON Parse From Executing Dangerous revivers

A reviver can reintroduce unsafe objects.

#javascript #json #reviver #security #howto #parsing

https://www.youtube.com/watch?v=sdT2HvfFWD0

How to Stop JSON Parse From Executing Dangerous revivers #security

YouTube

(Knowledge is knowing that `LL` refers to syntactic grammar not lexical grammar. Intelligence is knowing that they don't have to be separate. Wisdom is knowing that they should absolutely be separate.)

#shitpost #parsing

How to Stop Implicit Date Conversion Bugs

String dates can be interpreted differently than you expect.

#mysql #date #parsing #howto #bug #data

https://www.youtube.com/watch?v=Krq5ZwzIR_Q

How to Stop Implicit Date Conversion Bugs #bug

YouTube

How to Stop parseFloat From Accepting Garbage

parseFloat accepts partial input and hides bugs.

#javascript #parsefloat #parsing #bug #howto #validation

https://www.youtube.com/watch?v=GSypdxVeB-0

How to Stop parseFloat From Accepting Garbage #validation

YouTube
Explainer: Tree-sitter vs. LSP

I got asked a good question today: what is the difference between Tree-sitter and a language server? I don’t understand how either of these tools work in depth, so I’m just going to explain from an observable, pragmatic point of view.

Lambda Land