diff --git a/src/fortran/ofp/XMLPrinterBase.java b/src/fortran/ofp/XMLPrinterBase.java index 87b14ec..7582c8a 100644 --- a/src/fortran/ofp/XMLPrinterBase.java +++ b/src/fortran/ofp/XMLPrinterBase.java @@ -589,6 +589,13 @@ protected void insertTokens(Element context, int tokenType, String tokenContextN throw new IllegalArgumentException("two possible targets"); } */ + if (targetIndex > 0) { + Element beforeTarget = contextNode(target, targetIndex - 1); + if (beforeTarget.getNodeName().equals("body")) { + target = beforeTarget; + targetIndex = contextNodesCount(beforeTarget); + } + } Element tokenNode = contextOpen(tokenContextName); setAttribute(tokenTextAttributeName, token.getText());