(htmlNode node.Node, prevNode node.Node)
| 154 | } |
| 155 | |
| 156 | func (l *Parser) splitSemiColonAndPhpCloseTag(htmlNode node.Node, prevNode node.Node) { |
| 157 | if l.Lexer.GetWithFreeFloating() == false { |
| 158 | return |
| 159 | } |
| 160 | |
| 161 | semiColon := (*prevNode.GetFreeFloating())[freefloating.SemiColon] |
| 162 | delete((*prevNode.GetFreeFloating()), freefloating.SemiColon) |
| 163 | if len(semiColon) == 0 { |
| 164 | return |
| 165 | } |
| 166 | |
| 167 | p := semiColon[0].Position |
| 168 | if semiColon[0].Value[0] == ';' { |
| 169 | l.setFreeFloating(prevNode, freefloating.SemiColon, []freefloating.String{ |
| 170 | { |
| 171 | StringType: freefloating.TokenType, |
| 172 | Value: ";", |
| 173 | Position: &position.Position{ |
| 174 | StartLine: p.StartLine, |
| 175 | EndLine: p.StartLine, |
| 176 | StartPos: p.StartPos, |
| 177 | EndPos: p.StartPos + 1, |
| 178 | }, |
| 179 | }, |
| 180 | }) |
| 181 | } |
| 182 | |
| 183 | vlen := len(semiColon[0].Value) |
| 184 | tlen := 2 |
| 185 | if strings.HasSuffix(semiColon[0].Value, "?>\n") { |
| 186 | tlen = 3 |
| 187 | } |
| 188 | |
| 189 | phpCloseTag := []freefloating.String{} |
| 190 | if vlen-tlen > 1 { |
| 191 | phpCloseTag = append(phpCloseTag, freefloating.String{ |
| 192 | StringType: freefloating.WhiteSpaceType, |
| 193 | Value: semiColon[0].Value[1 : vlen-tlen], |
| 194 | Position: &position.Position{ |
| 195 | StartLine: p.StartLine, |
| 196 | EndLine: p.EndLine, |
| 197 | StartPos: p.StartPos + 1, |
| 198 | EndPos: p.EndPos - tlen, |
| 199 | }, |
| 200 | }) |
| 201 | } |
| 202 | |
| 203 | phpCloseTag = append(phpCloseTag, freefloating.String{ |
| 204 | StringType: freefloating.WhiteSpaceType, |
| 205 | Value: semiColon[0].Value[vlen-tlen:], |
| 206 | Position: &position.Position{ |
| 207 | StartLine: p.EndLine, |
| 208 | EndLine: p.EndLine, |
| 209 | StartPos: p.EndPos - tlen, |
| 210 | EndPos: p.EndPos, |
| 211 | }, |
| 212 | }) |
| 213 |
no test coverage detected