code: private int lineBeginningFor(int pos) {
          if (sourceChars == null) {
              return -1;
          }
          if (pos <= 0) {
              return 0;
          }
          char[] buf = sourceChars;
          if (pos >= buf.length) {
              pos = buf.length - 1;
          }
          while (--pos >= 0) {
              char c = buf[pos];
              if (ScriptRuntime.isJSLineTerminator(c)) {
                  return pos + 1; // want position after the newline
              }
          }
          return 0;
      }
docs: Return the file offset of the beginning of the input source line
  containing the passed position.
  
  @param pos an offset into the input source stream.  If the offset
  is negative, it's converted to 0, and if it's beyond the end of
  the source buffer, the last source position is used.
  
  @return the offset of the beginning of the line containing pos
  (i.e. 1+ the offset of the first preceding newline).  Returns -1
  if the {@link CompilerEnvirons} is not set to ide-mode,
  and {@link #parse(java.io.Reader,String,int)} was used.