Click here to Skip to main content
15,886,919 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: 6502 Powered Whole Generation of Devices Pin
Peter Shaw28-Mar-24 3:42
professionalPeter Shaw28-Mar-24 3:42 
GeneralRe: 6502 Powered Whole Generation of Devices Pin
raddevus28-Mar-24 8:04
mvaraddevus28-Mar-24 8:04 
GeneralRe: 6502 Powered Whole Generation of Devices Pin
StarNamer@work28-Mar-24 9:10
professionalStarNamer@work28-Mar-24 9:10 
GeneralRe: 6502 Powered Whole Generation of Devices Pin
CPallini28-Mar-24 10:00
mveCPallini28-Mar-24 10:00 
GeneralRe: 6502 Powered Whole Generation of Devices Pin
Roger Wright28-Mar-24 10:02
professionalRoger Wright28-Mar-24 10:02 
GeneralRe: 6502 Powered Whole Generation of Devices Pin
Geordie Al29-Mar-24 7:36
Geordie Al29-Mar-24 7:36 
GeneralRe: 6502 Powered Whole Generation of Devices Pin
PIEBALDconsult29-Mar-24 7:52
mvePIEBALDconsult29-Mar-24 7:52 
GeneralI love regex. Haters hate. Pin
honey the codewitch27-Mar-24 1:32
mvahoney the codewitch27-Mar-24 1:32 
For reasons I have to hand implement a parser for JSON numbers that can operate over a stream parsing part of the number with each fetch. It's kind of difficult, so I fired up my Visual FA C# project and fed it this code
C#
var number = FA.Parse(@"(0|-?([1-9][0-9]*))((\.[0-9]+[Ee]\-?[1-9][0-9]*)?|\.[0-9]+)");
var dgo = new FADotGraphOptions();
dgo.HideAcceptSymbolIds = true;
number = number.ToMinimizedDfa();
number.RenderToFile(@"..\..\..\number.jpg",dgo);


which gave me this which I can use to guide my hand rolled implementation:

DFA state diagram[^]

Bam! Now it makes it easy to write what is pretty complicated code by following this graph.

The code that I need to write to be clear, must be able to parse a very long number. For example 3.14159265358979462643 and parse it using say, 8 bytes of memory for the capture, so it can parse 8 characters at a time. Real world those figures would be larger, but the principle is the same.

If you have an easier way, put it in the replies. Smile | :) I'd love to hear them, honestly. Otherwise I'm sticking with my regex solution because I can't think of a more direct route from A to B.

Edit: Aaand my regex was wrong (not quite JSON spec) so I since fixed it but haven't updated this post to reflect the changes. Still, it was easy to change.
Check out my IoT graphics library here:
https://honeythecodewitch.com/gfx
And my IoT UI/User Experience library here:
https://honeythecodewitch.com/uix


modified 27-Mar-24 7:45am.

PraiseRe: I love regex. Haters hate. Pin
Kornfeld Eliyahu Peter27-Mar-24 2:16
professionalKornfeld Eliyahu Peter27-Mar-24 2:16 
GeneralRe: I love regex. Haters hate. Pin
Amarnath S27-Mar-24 2:28
professionalAmarnath S27-Mar-24 2:28 
GeneralRe: I love regex. Haters hate. Pin
honey the codewitch27-Mar-24 23:08
mvahoney the codewitch27-Mar-24 23:08 
GeneralRe: I love regex. Haters hate. Pin
Mircea Neacsu27-Mar-24 2:57
Mircea Neacsu27-Mar-24 2:57 
GeneralRe: I love regex. Haters hate. Pin
honey the codewitch27-Mar-24 5:19
mvahoney the codewitch27-Mar-24 5:19 
GeneralRe: I love regex. Haters hate. Pin
Mircea Neacsu27-Mar-24 5:21
Mircea Neacsu27-Mar-24 5:21 
GeneralRe: I love regex. Haters hate. Pin
Maximilien27-Mar-24 3:37
Maximilien27-Mar-24 3:37 
GeneralRe: I love regex. Haters hate. Pin
SchaeferFFM27-Mar-24 3:46
SchaeferFFM27-Mar-24 3:46 
GeneralRe: I love regex. Haters hate. Pin
honey the codewitch27-Mar-24 5:18
mvahoney the codewitch27-Mar-24 5:18 
GeneralRe: I love regex. Haters hate. Pin
TNCaver27-Mar-24 5:10
TNCaver27-Mar-24 5:10 
GeneralRe: I love regex. Haters hate. Pin
FormerBIOSGuy27-Mar-24 10:52
FormerBIOSGuy27-Mar-24 10:52 
GeneralRe: I love regex. Haters hate. Pin
Daniel Pfeffer27-Mar-24 11:01
professionalDaniel Pfeffer27-Mar-24 11:01 
GeneralRe: I love regex. Haters hate. Pin
honey the codewitch27-Mar-24 11:10
mvahoney the codewitch27-Mar-24 11:10 
GeneralRe: I love regex. Haters hate. Pin
rob tillaart27-Mar-24 20:23
rob tillaart27-Mar-24 20:23 
GeneralRe: I love regex. Haters hate. Pin
honey the codewitch27-Mar-24 23:07
mvahoney the codewitch27-Mar-24 23:07 
GeneralRe: I love regex. Haters hate. Pin
rob tillaart27-Mar-24 23:32
rob tillaart27-Mar-24 23:32 
GeneralRe: I love regex. Haters hate. Pin
trønderen28-Mar-24 4:02
trønderen28-Mar-24 4:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.