From 9b6ae480dcc6f5c91e34a873648f1e5f2d96e22a Mon Sep 17 00:00:00 2001 From: Mateusz Bysiek Date: Sun, 10 Dec 2017 01:27:25 +0900 Subject: [PATCH] try to put tokens where they can be picked up --- src/fortran/ofp/XMLPrinterBase.java | 7 +++++++ 1 file changed, 7 insertions(+) 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());