Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry BLIND2019-10-10 13:00:21 -0400
committerThierry BLIND2019-10-10 13:00:21 -0400
commitb649b3042029d4e50c0b51f7ee877ca0b7dc4338 (patch)
treee10f3c79bd3cdc1489ed9079fd94c91d2b949cec /plugins
parent9601354cb7421677e96fc69864e0599923e7328a (diff)
downloadorg.eclipse.pdt-master.tar.gz
org.eclipse.pdt-master.tar.xz
org.eclipse.pdt-master.zip
Bug 551622 - don't assert when formatting php code with inline html codeHEADmaster
additional fix Signed-off-by: Thierry BLIND <thierryblind@msn.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java
index 73105c8d3..ad9dc7502 100644
--- a/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java
+++ b/plugins/org.eclipse.php.formatter.core/src/org/eclipse/php/formatter/core/CodeFormatterVisitor.java
@@ -4880,6 +4880,21 @@ public class CodeFormatterVisitor extends AbstractVisitor implements ICodeFormat
}
}
isPHPMode = false;
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=551622
+ // We can have multiple successive InLineHtml statements
+ // when the HTML portion contains opening PHP short tags or
+ // opening asp tags and we did set useASPTags or
+ // useShortTags to false while creating our ASTParser.
+ // In this case these "undesired" tags will be represented
+ // as individual InLineHtml statements.
+ for (int j = i + 1; j < statements.length; j++) {
+ if (statements[j].getType() == ASTNode.IN_LINE_HTML) {
+ statements[j - 1].accept(this);
+ i++;
+ } else {
+ break;
+ }
+ }
} else if (!isPHPMode && !isHtmlStatement) {
// HTML -> PHP
if (!isStatementAfterError) {

Back to the top