erlydtl_ext.hrl 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. lists_0_based = false,
  35. tuples_0_based = false
  36. }).
  37. -record(ast_info, {
  38. dependencies = [],
  39. translatable_strings = [],
  40. translated_blocks= [],
  41. custom_tags = [],
  42. var_names = [],
  43. pre_render_asts = []}).
  44. -record(treewalker, {
  45. counter = 0,
  46. safe = false,
  47. extension = undefined,
  48. context
  49. }).
  50. -record(scanner_state, {
  51. template=[],
  52. scanned=[],
  53. pos={1,1},
  54. state=in_text
  55. }).
  56. -define(ERR(Err, Ctx), erlydtl_compiler_utils:add_error(?MODULE, Err, Ctx)).
  57. -define(WARN(Warn, Ctx), erlydtl_compiler_utils:add_warning(?MODULE, Warn, Ctx)).
  58. -define(V_INFO,1).
  59. -define(V_DEBUG,2).
  60. -define(V_TRACE,3).
  61. -define(LOG_INFO(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_INFO, Fmt, Args, Ctx)).
  62. -define(LOG_DEBUG(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_DEBUG, Fmt, Args, Ctx)).
  63. -define(LOG_TRACE(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_TRACE, Fmt, Args, Ctx)).