Skip to content

Commit da6de16

Browse files
committed
Merge branch 'feature/access-specifiers'
2 parents 04ae173 + f193c06 commit da6de16

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

src/fortran/ofp/XMLPrinter.java

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,25 @@ public void declaration_type_spec(Token udtKeyword, int type) {
439439
}
440440

441441
public void attr_spec(Token attrKeyword, int attr) {
442+
Element preceeding = null;
442443
String nestIn = "";
443444
switch (attr) {
444445
case IActionEnums.AttrSpec_access:
445-
// private
446+
preceeding = contextNode(-1);
447+
int accessType = Integer.parseInt(getAttribute("type", preceeding).getValue());
448+
switch (accessType) {
449+
case IActionEnums.AttrSpec_PUBLIC:
450+
nestIn = "public";
451+
break;
452+
case IActionEnums.AttrSpec_PROTECTED:
453+
nestIn = "protected";
454+
break;
455+
case IActionEnums.AttrSpec_PRIVATE:
456+
nestIn = "private";
457+
break;
458+
default:
459+
throw new IllegalArgumentException(Integer.toString(attr) + " - " + attrKeyword + ", type=" + Integer.toString(accessType));
460+
}
446461
break;
447462
case IActionEnums.AttrSpec_language_binding:
448463
// bind
@@ -497,6 +512,8 @@ public void attr_spec(Token attrKeyword, int attr) {
497512
}
498513
if (nestIn.length() > 0)
499514
contextOpen("attribute-" + nestIn);
515+
if (preceeding != null)
516+
moveHere(preceeding);
500517
super.attr_spec(attrKeyword, attr);
501518
if (nestIn.length() > 0)
502519
contextClose();
@@ -629,15 +646,11 @@ public void intent_spec(Token intentKeyword1, Token intentKeyword2, int intent)
629646
contextClose();
630647
}
631648

632-
public void access_id_list__begin() {
633-
// contextOpen("access-list");
634-
if (verbosity >= 100)
635-
super.access_id_list__begin();
636-
}
637-
638-
public void access_id_list(int count) {
639-
super.access_id_list(count);
640-
// contextClose("access-list");
649+
public void access_stmt(Token label, Token eos, boolean hasList) {
650+
if (!context.getTagName().equals("declaration"))
651+
cleanUpAfterError("tag name is not 'declaration' but '" + context.getTagName() + "'");
652+
setAttribute("type", "access");
653+
super.access_stmt(label, eos, hasList);
641654
}
642655

643656
public void allocatable_decl_list__begin() {

src/fortran/ofp/XMLPrinterBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static public void addListContext(String eventNamePrefix, String listName, Strin
9898
/*
9999
addListContext("explicit-shape-spec", "", "");
100100
*/
101-
// addListContext("access-id", /*"access-list"*/ null, null); // currently not necessary
101+
addListContext("access-id", "names", null);
102102
// addListContext("allocatable-decl", null, null); // currently not necessary
103103
/*
104104
addListContext("bind-entity", "", "");

0 commit comments

Comments
 (0)