docs: public static String delimitExpressions(String s) {
  
          StringBuilder result = new StringBuilder();
          char[] cs = s.toCharArray();
          int brace = 0;
          int sqre = 0;
          int crly = 0;
          int skippedNewLines = 0;
          boolean inString = false;
          char lastNonWhite = ';';
          for ( int i = 0; i < cs.length; i++ ) {
              char c = cs[i];
              switch ( c ) {
                  case ' ' :
                  case '\t' :
                      if (!inString && lookAhead(cs, i+1) == '.') {
                          continue;
                      }
                      break;
                  case '\"' :
                      if ( i == 0 || cs[i-1] != '\\' ) {
                          inString = !inString;
                      }
                      break;
                  case '/' :
                      if( i < cs.length-1 && cs[i+1] == '*' && !inString ) {
                          // multi-line comment
                          int start = i;
                          i+=2; // skip the /*
                          for( ; i < cs.length; i++ ) {
                              if( cs[i] == '*' && i < cs.length-1 && cs[i+1] == '/' ) {
                                  i++; // skip the */
                                  break;
                              } else if( cs[i] == '\n' || cs[i] == '\r' ) {
                                  lastNonWhite = checkAndAddSemiColon( result,
                                                                       inString,
                                                                       brace,
                                                                       sqre,
                                                                       crly,
                                                                       lastNonWhite );
                              }
                          }
                          result.append( cs, start, i-start );
                          break;
                      } else if( i < cs.length-1 && cs[i+1] != '/' ) {
                          // not a line comment
                          break;
                      }
                      // otherwise handle it in the same way as #
                  case '#' :
                      // line comment
                      lastNonWhite = checkAndAddSemiColon( result,
                                                           inString,
                                                           brace,
                                                           sqre,
                                                           crly,
                                                           lastNonWhite );
                      if (inString) {
                          result.append( c );
                      } else {
                          i = processLineComment( cs, i, result );
                      }
                      continue;
                  case '(' :
                      brace++;
                      break;
                  case '{' :
                      crly++;
                      break;
                  case '[' :
                      sqre++;
                      break;
                  case ')' :
                      brace--;
                      break;
                  case '}' :
                      crly--;
                      break;
                  case ']' :
                      sqre--;
                      break;
                  default :
                      break;
              }
  
              if ( c == '\n' || c == '\r' ) {
                  // line break
                  if ( brace == 0 && sqre == 0 && crly == 0 &&
                       lastNonWhite != '.' && lookAhead(cs, i+1) != '.' ) {
                      if ( lastNonWhite != ';' ) {
                          result.append( ';' );
                          lastNonWhite = ';';
                      }
                      for (int j = 0; j < skippedNewLines; j++) {
                          result.append("\n");
                      }
                      skippedNewLines = 0;
                  } else {
                      skippedNewLines++;
                      continue;
                  }
              } else if ( !Character.isWhitespace( c ) ) {
                  lastNonWhite = c;
              }
              result.append( c );
          }
          for (int i = 0; i < skippedNewLines; i++) {
              result.append("\n");
          }
          return result.toString();
      }