erlydtl_ext.hrl 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. checks = [non_block_tag]
  38. }).
  39. %% ALL fields of ast_info{} must be lists (see erlydtl_compiler_utils:merge_info/2)
  40. -record(ast_info, {
  41. dependencies = [],
  42. translatable_strings = [],
  43. translated_blocks= [],
  44. custom_tags = [],
  45. var_names = [],
  46. def_names = [],
  47. const_names = []
  48. }).
  49. -record(treewalker, {
  50. counter = 0,
  51. safe = false,
  52. extension = undefined,
  53. context
  54. }).
  55. -record(scanner_state, {
  56. template=[],
  57. scanned=[],
  58. pos={1,1},
  59. state=in_text
  60. }).
  61. -define(ERR(Err, Ctx), erlydtl_compiler_utils:add_error(?MODULE, Err, Ctx)).
  62. -define(WARN(Warn, Ctx), erlydtl_compiler_utils:add_warning(?MODULE, Warn, Ctx)).
  63. -define(V_INFO,1).
  64. -define(V_DEBUG,2).
  65. -define(V_TRACE,3).
  66. -define(LOG_INFO(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_INFO, Fmt, Args, Ctx)).
  67. -define(LOG_DEBUG(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_DEBUG, Fmt, Args, Ctx)).
  68. -define(LOG_TRACE(Fmt, Args, Ctx), erlydtl_compiler_utils:print(?V_TRACE, Fmt, Args, Ctx)).