docs: public int scanScalar(int req_width, Pointer _cursor, int len) {
          byte[] cursorb = _cursor.buffer;
          int cursor = _cursor.start;
  
          int start = 0;
          int flags = SCAN_NONE;
          if(len < 1) {
              return flags;
          }
  
          switch(cursorb[cursor]) {
          case '[': case ']':
          case '{': case '}':
          case '!': case '*':
          case '&': case '|':
          case '>': case '\'':
          case '"': case '#':
          case '%': case '@':
          case '`':
              flags |= SCAN_INDIC_S;
              break;
          case '-': case ':':
          case '?': case ',':
              if(len == 1 || cursorb[cursor+1] == ' ' || cursorb[cursor+1] == '\n') {
                  flags |= SCAN_INDIC_S;
              }
              break;
          }
  
          if(cursorb[cursor + len - 1] != '\n') {
              flags |= SCAN_NONL_E;
          } else if(len > 1 && cursorb[cursor + len - 2] == '\n') {
              flags |= SCAN_MANYNL_E;
          }
  
          if(
             (len>0 && (cursorb[cursor] == ' ' || cursorb[cursor] == '\t')) ||
             (len>1 && (cursorb[cursor + len - 1] == ' ' || cursorb[cursor + len - 1] == '\t'))
             ) {
              flags |= SCAN_WHITEEDGE;
          }
  
          if(len >= 3 && cursorb[cursor] == '-' && cursorb[cursor+1] == '-' && cursorb[cursor+2] == '-') {
              flags |= SCAN_DOCSEP;
          }
  
          for(int i=0; i<len; i++) {
              int ci = (int)(cursorb[cursor+i]&0xFF);
              if(! ( ci == 0x9 ||
                     ci == 0xA ||
                     ci == 0xD ||
                     (ci >= 0x20 && ci <= 0x7E))) {
                  flags |= SCAN_NONPRINT;
              } else if(ci == '\n') {
                  flags |= SCAN_NEWLINE;
                  if(len - i >= 3 && cursorb[cursor+i+1] == '-' && cursorb[cursor+i+2] == '-' && cursorb[cursor+i+3] == '-' ) {
                      flags |= SCAN_DOCSEP;
                  }
                  if(i+1 < len && (cursorb[cursor+i+1] == ' ' || cursorb[cursor+i+1] == '\t')) {
                      flags |= SCAN_INDENTED;
                  }
                  if(req_width > 0 && (i - start) > req_width) {
                      flags |= SCAN_WIDE;
                  }
                  start = i;
              } else if(ci == '\'') {
                  flags |= SCAN_SINGLEQ;
              } else if(ci == '"') {
                  flags |= SCAN_DOUBLEQ;
              } else if(ci == ']') {
                  flags |= SCAN_FLOWSEQ;
              } else if(ci == '}') {
                  flags |= SCAN_FLOWMAP;
              } else if(((ci == ' ' && (i+1<len && cursorb[cursor+i+1] == '#') ) ||
                         (ci == ':' && ((i+1<len && cursorb[cursor+i+1] == ' ') || 
                                        (i+1<len && cursorb[cursor+i+1] == '\n') || 
                                        i == len - 1 )))) {
                  flags |= SCAN_INDIC_C;
              } else if(ci == ',' && ((i == len - 1 ||
                                       cursorb[cursor+i+1] == ' ' || 
                                       cursorb[cursor+i+1] == '\n'))) {
                  flags |= SCAN_FLOWMAP;
                  flags |= SCAN_FLOWSEQ;
              }
          }
  
          return flags;
      }