code: function nonlocal_tokens(codestr, filename, options) {
    options = options || {};
  
    // get the base dialects for this file type:
    var fileext = utils.getFileExt(filename, "slisp");
    baseDialectNames = options.baseDialectNames || filetypes[fileext];
    if(!baseDialectNames) {
      throw new Error(filename + " is not a recognized sugarlisp file type.");
    }
  
    // note we manually ensure the lexer has the appropriate bases dialects below
    // (this is normally taken care of by reader.read_from_source() but not here)
    var lexer = new lex.Lexer(codestr, filename, {wrapOuterForm: 'no'});
  
    // we always bootstrap the core dialect which everything must have
    use_dialect('core', lexer);
  
    // And then add the extension dialects the file depends on
    baseDialectNames.forEach(function(dialectName) {
      use_dialect(dialectName, lexer);
    })
  
    // Just read each token and return them all...
    var token;
    var tokens = [];
    while(token = lexer.next_token()) {
      // we can't handle local dialects but at least we
      // can handle file level #used ones:
      if(token.text === "#use") {
        tokens.push(token); // push the "#use"
        tokens.push(lexer.next_token()); // push the opening quote
        var dialectNameToken = lexer.next_token();
        tokens.push(dialectNameToken);
        use_dialect(dialectNameToken.text, lexer);
      }
      else {
        tokens.push(token);
      }
    }
    return tokens;
  }
docs: Return the tokens seen using just the main (non-local) dialects
  for the file.
  
  note:  this is just meant for debugging and will not reflect tokens
  gotten by local dialects added/removed during then normal read process.
  Those *true* tokens can be gotten after a read when the lexer is passed
  {to: "tokens"}.  This alternative is provided mainly because there are
  times when the read may be blowing up in which case the alternative
  approach will fail (in which case this option is better than nothing).
  (presumably for debugging but who knows...)