Skip to content

Commit 351bd98

Browse files
committed
Merge branch 'feature/nature'
2 parents 15b6ab3 + 4753807 commit 351bd98

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/fortran/ofp/XMLPrinter.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,12 +2281,27 @@ public void use_stmt(Token label, Token useKeyword, Token id, Token onlyKeyword,
22812281
contextOpen("declaration");
22822282
}
22832283

2284+
public void module_nature(Token nature) {
2285+
if (context.getTagName().equals("declaration")) {
2286+
LOG.log(Level.FINE, "closing unclosed declaration at module_nature nature={0}", nature.getText());
2287+
contextClose("declaration");
2288+
}
2289+
if (!context.getTagName().equals("use"))
2290+
contextOpen("use");
2291+
contextOpen("nature");
2292+
setAttribute("name", nature);
2293+
if (verbosity >= 80)
2294+
super.module_nature(nature);
2295+
contextClose("nature");
2296+
}
2297+
22842298
public void rename_list__begin() {
22852299
if (context.getTagName().equals("declaration")) {
22862300
LOG.log(Level.FINE, "closing unclosed declaration at rename_list__begin");
22872301
contextClose("declaration");
22882302
}
2289-
contextOpen("use");
2303+
if (!context.getTagName().equals("use"))
2304+
contextOpen("use");
22902305
contextOpen("rename");
22912306
if (verbosity >= 100)
22922307
super.rename_list__begin();
@@ -2302,7 +2317,8 @@ public void only_list__begin() {
23022317
LOG.log(Level.FINE, "closing unclosed declaration at only_list__begin");
23032318
contextClose("declaration");
23042319
}
2305-
contextOpen("use");
2320+
if (!context.getTagName().equals("use"))
2321+
contextOpen("use");
23062322
contextOpen("only");
23072323
if (verbosity >= 100)
23082324
super.only_list__begin();

test/test_compatibility.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,16 @@ def test_ofp_interface(self):
333333
'rule-tests/R1207.f90']]
334334
self.check_cases(input_paths)
335335

336+
def test_module_nature(self):
337+
input_paths = [pathlib.Path(_) for _ in [
338+
'annex_c/c_10_2_1.f03',
339+
'annex_c/c_10_2_2.f03',
340+
'annex_c/c_10_2_3.f03',
341+
'annex_c/c_10_2_4.f03',
342+
'rule-f08-tests/R1109.f90',
343+
'rule-f08-tests/R1228.f90']]
344+
self.check_cases(input_paths)
345+
336346
@unittest.skipUnless(os.environ.get('TEST_LONG'), 'skipping long test')
337347
def test_ofp_all_cases(self):
338348
tests_absolute_path = _OFP_TESTS_DIR.resolve()

0 commit comments

Comments
 (0)