stringFacet: stringLength INTEGER | REGEXP REGEXP_FLAGS
            stringLength: KW_LENGTH | KW_MINLENGTH | KW_MAXLENGTH

def visitStringFacet(self, ctx: ShExDocParser.StringFacetContext):
        """ stringFacet: stringLength INTEGER | REGEXP REGEXP_FLAGS
            stringLength: KW_LENGTH | KW_MINLENGTH | KW_MAXLENGTH """
        if ctx.stringLength():
            slen = jsg.Integer(ctx.INTEGER().getText())
            if ctx.stringLength().KW_LENGTH():
                self.nodeconstraint.length = slen
            elif ctx.stringLength().KW_MINLENGTH():
                self.nodeconstraint.minlength = slen
            else:
                self.nodeconstraint.maxlength = slen

        else:
            self.nodeconstraint.pattern = jsg.String(self.context.fix_re_escapes(ctx.REGEXP().getText()[1:-1]))
            if ctx.REGEXP_FLAGS():
                self.nodeconstraint.flags = jsg.String(ctx.REGEXP_FLAGS().getText())