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