| 177 | } |
| 178 | |
| 179 | comment(token) { |
| 180 | let node = new Comment() |
| 181 | this.init(node, token[2]) |
| 182 | node.source.end = this.getPosition(token[3] || token[2]) |
| 183 | node.source.end.offset++ |
| 184 | |
| 185 | let text = token[1].slice(2, -2) |
| 186 | if (!text.trim()) { |
| 187 | node.text = '' |
| 188 | node.raws.left = text |
| 189 | node.raws.right = '' |
| 190 | } else { |
| 191 | let match = text.match(/^(\s*)([^]*\S)(\s*)$/) |
| 192 | node.text = match[2] |
| 193 | node.raws.left = match[1] |
| 194 | node.raws.right = match[3] |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | createTokenizer() { |
| 199 | this.tokenizer = tokenizer(this.input) |