PageRenderTime 1294ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre3/bsh/commands/getSourceFileInfo.bsh

#
Unknown | 27 lines | 23 code | 4 blank | 0 comment | 0 complexity | 1d7ce782d92bcdbb0ea83a22c61cd564 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. bsh.help.getSourceFileInfo = "usage: getSourceFileInfo()";
  2. import bsh.Interpreter;
  3. /**
  4. Return the name of the file or source from which the current interpreter
  5. is reading. Note that if you use this within a method, the result will
  6. not be the file from which the method was sourced, but will be the file
  7. that the caller of the method is reading. Methods are sourced once but
  8. can be called many times... Each time the interpreter may be associated
  9. with a different file and it is that calling interpreter that you are
  10. asking for information.
  11. <p>
  12. Note: although it may seems like this command would always return the
  13. getSourceFileInfo.bsh file, it does not since it is being executed after
  14. sourcing by the caller's interpreter.
  15. If one wanted to know the file from which a bsh method was sourced one
  16. would have to either capture that info when the file was sourced (by
  17. saving the state of the getSourceFileInfo() in a variable outside of
  18. the method or more generally we could add the info to the BshMethod class
  19. so that bsh methods remember from what source they were created...
  20. */
  21. getSourceFileInfo() {
  22. return this.interpreter.getSourceFileInfo();
  23. }