erlydtl_ext.hrl 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. const = [],
  16. record_info = [],
  17. filters = [],
  18. tags = [],
  19. libraries = [],
  20. custom_tags_dir = [],
  21. reader = {file, read_file},
  22. module = undefined,
  23. compiler_options = [],
  24. binary_strings = true,
  25. force_recompile = false,
  26. verbose = 0,
  27. is_compiling_dir = false,
  28. extension_module = undefined,
  29. scanner_module = erlydtl_scanner,
  30. scanned_tokens = [],
  31. all_options = [],
  32. errors = #error_info{},
  33. warnings = #error_info{},
  34. bin = undefined,
  35. lists_0_based = false,
  36. tuples_0_based = false
  37. }).
  38. %% ALL fields of ast_info{} must be lists (see erlydtl_compiler_utils:merge_info/2)
  39. -record(ast_info, {
  40. dependencies = [],
  41. translatable_strings = [],
  42. translated_blocks= [],
  43. custom_tags = [],
  44. var_names = [],
  45. def_names = [],
  46. const_names = []
  47. }).
  48. -record(treewalker, {
  49. counter = 0,
  50. safe = false,
  51. extension = undefined,
  52. context
  53. }).
  54. -record(scanner_state, {
  55. template=[],
  56. scanned=[],
  57. pos={1,1},
  58. state=in_text
  59. }).
  60. -define(ERR(Err, Ctx), erlydtl_compiler_utils:add_error(?MODULE, Err, Ctx)).
  61. -define(WARN(Warn, Ctx), erlydtl_compiler_utils:add_warning(?MODULE, Warn, Ctx)).
  62. -define(V_INFO,1).
  63. -define(V_DEBUG,2).
  64. -define(V_TRACE,3).
  65. -define(LOG_INFO(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_INFO, Fmt, Args, Ctx)).
  66. -define(LOG_DEBUG(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_DEBUG, Fmt, Args, Ctx)).
  67. -define(LOG_TRACE(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_TRACE, Fmt, Args, Ctx)).