PageRenderTime 65ms CodeModel.GetById 25ms RepoModel.GetById 7ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre14/bsh/commands/getSourceFileInfo.bsh

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