erlydtl_ext.hrl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. -record(error_info, {
  2. return = false,
  3. report = false,
  4. list = []
  5. }).
  6. -record(dtl_context, {
  7. local_scopes = [],
  8. block_dict = dict:new(),
  9. trans_fun = none,
  10. trans_locales = [],
  11. auto_escape = off,
  12. doc_root = "",
  13. parse_trail = [],
  14. vars = [],
  15. record_info = [],
  16. filters = [],
  17. tags = [],
  18. libraries = [],
  19. custom_tags_dir = [],
  20. reader = {file, read_file},
  21. module = undefined,
  22. compiler_options = [],
  23. binary_strings = true,
  24. force_recompile = false,
  25. verbose = 0,
  26. is_compiling_dir = false,
  27. extension_module = undefined,
  28. scanner_module = erlydtl_scanner,
  29. scanned_tokens = [],
  30. all_options = [],
  31. errors = #error_info{},
  32. warnings = #error_info{},
  33. bin = undefined
  34. }).
  35. -record(ast_info, {
  36. dependencies = [],
  37. translatable_strings = [],
  38. translated_blocks= [],
  39. custom_tags = [],
  40. var_names = [],
  41. pre_render_asts = []}).
  42. -record(treewalker, {
  43. counter = 0,
  44. safe = false,
  45. extension = undefined,
  46. context
  47. }).
  48. -record(scanner_state, {
  49. template=[],
  50. scanned=[],
  51. pos={1,1},
  52. state=in_text
  53. }).
  54. -define(ERR(Err, Ctx), erlydtl_compiler_utils:add_error(?MODULE, Err, Ctx)).
  55. -define(WARN(Warn, Ctx), erlydtl_compiler_utils:add_warning(?MODULE, Warn, Ctx)).
  56. -define(V_INFO,1).
  57. -define(V_DEBUG,2).
  58. -define(V_TRACE,3).
  59. -define(LOG_INFO(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_INFO, Fmt, Args, Ctx)).
  60. -define(LOG_DEBUG(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_DEBUG, Fmt, Args, Ctx)).
  61. -define(LOG_TRACE(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_TRACE, Fmt, Args, Ctx)).