Scope analysis does not provide support for undeclared variables.

0 instances of missing semicolons counted.

0 unnecessary instances of the keyword new counted.

  1. 1
  2. -2
  3. -3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. -27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. -45
  46. -46
  47. 47
  48. 48
  49. 49
  50. -50
  51. 51
  52. 52
  53. -53
  54. 54
  55. 55
  56. 56
  57. 57
  58. 58
  59. 59
  60. 60
  61. 61
  62. 62
  63. 63
  1. /*global global*/
  2. (function pdcomment_init() {
  3. // parses the prettydiff settings comment
  4. //
  5. // - Source Priorities:
  6. // * the prettydiff comment is only accepted if it occurs before non-comments
  7. // (near the top)
  8. // * options.source is the priority material for reading the comment
  9. // * the prettydiff comment will be processed from options.diff only if it
  10. // present there, missing from options.source, and options.mode is diff
  11. //
  12. // - Examples:
  13. // /*prettydiff.com width:80 preserve:4*/
  14. // /* prettydiff.com width:80 preserve:4 */
  15. // /*prettydiff.com width=80 preserve=4 */
  16. // // prettydiff.com width=80 preserve:4
  17. // <!-- prettydiff.com width:80 preserve=4 -->
  18. // <!--prettydiff.com width:40 preserve:2-->
  19. //
  20. // - Parsing Considerations:
  21. // * there may be any amount of space at the start or end of the comment
  22. // * "prettydiff.com" must exist at the start of the comment
  23. // * comment must exist prior to non-comment tokens (near top of code)
  24. // * parameters are name value pairs separated by white space
  25. // * the delimiter separating name and value is either ":" or "=" characters
  26. "use strict";
  27. const pdcomment = function pdcomment_(options) {
  28. let pdcom = options.source.search(/((\/(\*|\/))|<!--*)\s*prettydiff\.com/),
  29. a = (pdcom > -1)
  30. ? pdcom
  31. : options.diff.search(/((\/(\*|\/))|<!--*)\s*prettydiff\.com/),
  32. b = 0,
  33. quote = "",
  34. op = [];
  35. const ops = [],
  36. source = (pdcom > -1)
  37. ? options.source
  38. : options.diff,
  39. len = source.length,
  40. comment = (source.charAt(a) === "<")
  41. ? "<!--"
  42. : (source.charAt(a + 1) === "/")
  43. ? "//"
  44. : "/\u002a",
  45. esc = function pdcomment_esc() {
  46. if (source.charAt(a - 1) !== "\\") {
  47. return false;
  48. }
  49. let x = a;
  50. do {
  51. x = x - 1;
  52. } while (x > 0 && source.charAt(x) === "\\");
  53. if ((a - x) % 2 === 0) {
  54. return true;
  55. }
  56. return false;
  57. };
  58. };
  59. global
  60. .prettydiff
  61. .api
  62. .pdcommenttttt = pdcomment;
  63. }());