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

Function fxCharSetExpression

xs/sources/xsre.c:830–899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

828}
829
830void* fxCharSetExpression(txPatternParser* parser)
831{
832 txBoolean not = 0;
833 void* result = NULL;
834 void* left = NULL;
835 txInteger leftKind = 0;
836 void* right = NULL;
837 txInteger rightKind = 0;
838 txString string;
839 fxPatternParserCheckStack(parser);
840 if (parser->character == '^') {
841 fxPatternParserNext(parser);
842 not = 1;
843 }
844 left = fxCharSetOperand(parser, &leftKind);
845 string = parser->pattern + parser->offset;
846 if ((parser->character == '-') && (*string == '-')) {
847 for (;;) {
848 fxPatternParserNext(parser);
849 fxPatternParserNext(parser);
850 right = fxCharSetOperand(parser, &rightKind);
851 result = fxCharSetCombine(parser, left, right, mxCharSetSubtractOp);
852 if (parser->character == ']')
853 break;
854 string = parser->pattern + parser->offset;
855 if ((parser->character == '-') && (*string == '-')) {
856 left = result;
857 continue;
858 }
859 fxPatternParserError(parser, gxErrors[mxInvalidRange]);
860 }
861 }
862 else if ((parser->character == '&') && (*string == '&')) {
863 for (;;) {
864 fxPatternParserNext(parser);
865 fxPatternParserNext(parser);
866 right = fxCharSetOperand(parser, &rightKind);
867 result = fxCharSetCombine(parser, left, right, mxCharSetIntersectionOp);
868 if (parser->character == ']')
869 break;
870 string = parser->pattern + parser->offset;
871 if ((parser->character == '&') && (*string == '&')) {
872 left = result;
873 continue;
874 }
875 fxPatternParserError(parser, gxErrors[mxInvalidRange]);
876 }
877 }
878 else {
879 for (;;) {
880 if (parser->character == '-') {
881 fxPatternParserNext(parser);
882 right = fxCharSetOperand(parser, &rightKind);
883 if ((leftKind != 0) && (rightKind != 0))
884 fxPatternParserError(parser, gxErrors[mxInvalidRange]);
885 left = fxCharSetRange(parser, left, right);
886 }
887 if (result)

Callers 2

fxCharSetOperandFunction · 0.85
fxSequenceParseFunction · 0.85

Calls 7

fxPatternParserNextFunction · 0.85
fxCharSetOperandFunction · 0.85
fxCharSetCombineFunction · 0.85
fxPatternParserErrorFunction · 0.85
fxCharSetRangeFunction · 0.85
fxCharSetNotFunction · 0.85

Tested by

no test coverage detected