MCPcopy Create free account
hub / github.com/crownengine/crown / parser

Function parser

3rdparty/bx/src/dtoa.cpp:711–924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709 }
710
711 static int parser(const char* _s, const char* _term, PrepNumber* _pn)
712 {
713 int state = FSM_A;
714 int digx = 0;
715 char c = ' '; /* initial value for kicking off the state machine */
716 int result = PARSER_OK;
717 int expneg = 0;
718 int32_t expexp = 0;
719
720 while (state != FSM_STOP) // && _s != _term)
721 {
722 switch (state)
723 {
724 case FSM_A:
725 if (isSpace(c) )
726 {
727 c = next(_s, _term);
728 }
729 else
730 {
731 state = FSM_B;
732 }
733 break;
734
735 case FSM_B:
736 state = FSM_C;
737
738 if (c == '+')
739 {
740 c = next(_s, _term);
741 }
742 else if (c == '-')
743 {
744 _pn->negative = 1;
745 c = next(_s, _term);
746 }
747 else if (isNumeric(c) )
748 {
749 }
750 else if (c == '.')
751 {
752 }
753 else
754 {
755 state = FSM_STOP;
756 }
757 break;
758
759 case FSM_C:
760 if (c == '0')
761 {
762 c = next(_s, _term);
763 }
764 else if (c == '.')
765 {
766 c = next(_s, _term);
767 state = FSM_D;
768 }

Callers 1

fromStringFunction · 0.85

Calls 4

isSpaceFunction · 0.85
isNumericFunction · 0.85
toLowerFunction · 0.85
nextFunction · 0.70

Tested by

no test coverage detected