| 1 | /** |
| 2 | A simple container to store the line, column and html tag value to insert in the source file |
| 3 | for comments, string literals, template literals and regexp literals |
| 4 | */ |
| 5 | |
| 6 | class TagData { |
| 7 | |
| 8 | /** |
| 9 | The line number in the source file where the tag must be inserted |
| 10 | @type {Number} |
| 11 | */ |
| 12 | |
| 13 | #line; |
| 14 | |
| 15 | /** |
| 16 | The column number in the source file where the tag must be inserted |
| 17 | @type {?Number} |
| 18 | */ |
| 19 | |
| 20 | #column; |
| 21 | |
| 22 | /** |
| 23 | The tag to insert. |
| 24 | @type {String} |
| 25 | */ |
| 26 | |
| 27 | #tag; |
| 28 | |
| 29 | /** |
| 30 | The constructor |
| 31 | @param {Number} line The line number in the source file where the tag must be inserted |
| 32 | @param {?Number} column The column number in the source file where the tag must be inserted |
| 33 | @param {String} tag The tag to insert. |
| 34 | */ |
| 35 | |
| 36 | constructor ( line, column, tag ) { |
| 37 | Object.freeze ( this ); |
| 38 | this.#line = line; |
| 39 | this.#column = column; |
| 40 | this.#tag = tag; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | The line number in the source file where the tag must be inserted |
| 45 | @type {Number} |
| 46 | */ |
| 47 | |
| 48 | get line ( ) { return this.#line; } |
| 49 | |
| 50 | /** |
| 51 | The column number in the source file where the tag must be inserted |
| 52 | If the tag must be inserted at the end of the line the value is null |
| 53 | @type {?Number} |
| 54 | */ |
| 55 | |
| 56 | get column ( ) { return this.#column; } |
| 57 | |
| 58 | /** |
| 59 | The tag to insert. |
| 60 | To avoid a replacement of the < ,> and " chars when creating the source html file |
| 61 | the < char is replaced with <, the > char with > and the " char with " and then |
| 62 | replaced with the correct value inthe source html file. |
| 63 | @type {String} |
| 64 | */ |
| 65 | |
| 66 | get tag ( ) { return this.#tag; } |
| 67 | } |
| 68 | |
| 69 | export default TagData; |
| 70 |