MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxDebugParse

Function fxDebugParse

xs/sources/xsDebug.c:673–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673void fxDebugParse(txMachine* the)
674{
675 txString string = the->debugBuffer;
676 txString limit = string + the->debugOffset;
677 char c;
678 while (string < limit) {
679 c = *string++;
680 switch (the->debugState) {
681 case XS_BODY_STATE:
682 if (c == '<')
683 the->debugState = XS_TAG_STATE;
684 else if (c == '\r')
685 the->debugState = XS_CR_STATE;
686 break;
687
688 case XS_CR_STATE:
689 if (c == '\n')
690 the->debugState = XS_LF_STATE;
691 else
692 the->debugState = XS_ERROR_STATE;
693 break;
694
695 case XS_LF_STATE:
696 if (c == '<')
697 the->debugState = XS_TAG_STATE;
698 else if (c == '\r')
699 the->debugState = XS_CR_STATE;
700 break;
701
702 case XS_TAG_STATE:
703 if (c == '/')
704 the->debugState = XS_END_TAG_STATE;
705 else if (c == '!')
706 the->debugState = XS_START_CDATA_STATE_1;
707 else if (c == '?')
708 the->debugState = XS_PROCESSING_INSTRUCTION_STATE;
709 else if (mxIsFirstLetter(c)) {
710 the->debugState = XS_START_TAG_NAME_STATE;
711 the->nameBuffer[0] = c;
712 the->nameIndex = 1;
713 }
714 else
715 the->debugState = XS_ERROR_STATE;
716 break;
717 case XS_START_TAG_NAME_STATE:
718 if (mxIsNextLetter(c)) {
719 if (the->nameIndex < 255) {
720 the->nameBuffer[the->nameIndex] = c;
721 the->nameIndex++;
722 }
723 else
724 the->debugState = XS_ERROR_STATE;
725 break;
726 }
727 the->debugState = XS_START_TAG_SPACE_STATE;
728 the->nameBuffer[the->nameIndex] = 0;
729 fxDebugParseTag(the, the->nameBuffer);
730 /* fall through */

Callers 3

fxDebugCommandFunction · 0.85
fxDebugImportFunction · 0.85
fxDebugLoopFunction · 0.85

Calls 5

fxDebugParseTagFunction · 0.85
fxDebugPushTagFunction · 0.85
fxDebugPopTagFunction · 0.85
fxDebugScriptCDATAFunction · 0.85
fxAbortFunction · 0.70

Tested by

no test coverage detected