decide not to have additional grammar to declare the location hierarchy.
authoryeom <yeom>
Fri, 13 May 2011 17:51:46 +0000 (17:51 +0000)
committeryeom <yeom>
Fri, 13 May 2011 17:51:46 +0000 (17:51 +0000)
all additional things for SSJava will be done using the standard Java annotation.

Robust/src/IR/Tree/BuildIR.java
Robust/src/Parse/java14.cup

index 8b7d2585a4dd197c26e13a59ea6df9a8ac382edd..21587c03da0d696ac3f2665abb86b8149ddd8c48 100644 (file)
@@ -621,60 +621,11 @@ public class BuildIR {
         } else if (isNode(decl, "static_block")) {
           parseStaticBlockDecl(cn, decl.getChild("static_block_declaration"));
         } else if (isNode(decl,"block")) {
-        } else if (isNode(decl,"location_order_declaration")) {
-          parseLocationOrder(cn,decl.getChild("location_order_list"));
         } else throw new Error();
       }
     }
   }
 
-  private void parseLocationOrder(ClassDescriptor cd, ParseNode pn) {
-    ParseNodeVector pnv = pn.getChildren();
-    Lattice<String> locOrder =
-      new Lattice<String>("_top_","_bottom_");
-    Set<String> spinLocSet=new HashSet<String>();
-    String thisLoc=null;
-    for (int i = 0; i < pnv.size(); i++) {
-      ParseNode loc = pnv.elementAt(i);
-      if(isNode(loc,"location_property")) {
-        if(loc.getFirstChild().getLabel().equals("location_multi")){
-          String spinLoc=loc.getFirstChild().getFirstChild().getLabel();
-          spinLocSet.add(spinLoc);
-        }else{
-          thisLoc=loc.getFirstChild().getFirstChild().getLabel();
-        }
-      } else {
-        if(loc.getChildren().size()==1){
-          String locIentifier=loc.getChildren().elementAt(0).getLabel();
-          locOrder.put(locIentifier);
-        }else{
-          String lowerLoc=loc.getChildren().elementAt(0).getLabel();
-          String higherLoc= loc.getChildren().elementAt(1).getLabel();
-          locOrder.put(higherLoc, lowerLoc);
-          if (locOrder.isIntroducingCycle(higherLoc)) {
-            throw new Error("Error: the order relation " + lowerLoc + " < " + higherLoc
-                + " introduces a cycle.");
-          }
-        }
-      }
-    }
-    if(spinLocSet.size()>0) {
-      //checking if location is actually defined in the hierarchy
-      for (Iterator iterator = spinLocSet.iterator(); iterator.hasNext(); ) {
-        String locID = (String) iterator.next();
-        if(!locOrder.containsKey(locID)) {
-          throw new Error("Error: The spinning location '"+
-                          locID + "' is not defined in the hierarchy of the class '"+cd +"'.");
-        }
-      }
-      state.addLocationProperty(new Pair(cd,"spin"), spinLocSet);
-    }
-    if(thisLoc!=null){
-      state.addLocationProperty(new Pair(cd,"this"), thisLoc);
-    }
-    state.addLocationOrder(cd, locOrder);
-  }
-
   private void parseClassMember(ClassDescriptor cn, ParseNode pn) {
     ParseNode fieldnode=pn.getChild("field");
     if (fieldnode!=null) {
index daf3c1818eea75d8cecc6464d1ab8cea0b9a0334..16d229f3db314bdb4bac8aa5ff90bed8f331f80e 100644 (file)
@@ -160,8 +160,6 @@ non terminal ParseNode static_initializer;
 non terminal ParseNode constructor_declaration, constructor_declarator;
 non terminal ParseNode constructor_body;
 non terminal ParseNode explicit_constructor_invocation;
-// 19.8.6) Location Hierarchy Declarations
-non terminal ParseNode location_order_declaration, location_order_list, location_order;
 // 19.9.1) Interface Declarations
 non terminal ParseNode interface_declaration;
 //non terminal ParseNode normal_interface_declaration
@@ -957,9 +955,6 @@ class_body_declaration ::=
        |       block:block {:
                RESULT=(new ParseNode("block",parser.lexer.line_num)).addChild(block).getRoot();
         :}
-        |       location_order_declaration:lod {:
-                RESULT=(new ParseNode("location_order_declaration",parser.lexer.line_num)).addChild(lod).getRoot();
-        :}
        ;
 class_member_declaration ::=
        //failure aware computation
@@ -1296,46 +1291,6 @@ SUPER LPAREN argument_list_opt:alo RPAREN SEMICOLON {:
 //     |       primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON
        ;
 
-// 19.8.6) Location Hierarchy Declarations
-location_order_declaration ::= LOCDEF LBRACE location_order_list:lol RBRACE {:
-                RESULT=lol;                       
-        :}
-        ;
-location_order_list ::= 
-                location_order:lo {:
-                ParseNode pn=new ParseNode("location_order_list",parser.lexer.line_num);
-               pn.addChild(lo);
-               RESULT=pn;
-        :}
-        |       location_order_list:lol COMMA location_order:lo {:
-                lol.addChild(lo);
-               RESULT=lol;
-        :}
-        ;
-location_order ::= 
-                IDENTIFIER:loc1 LT IDENTIFIER:loc2{:
-               ParseNode pn=new ParseNode("location_order",parser.lexer.line_num);
-               pn.addChild(loc1);
-               pn.addChild(loc2);
-               RESULT=pn;         
-        :}
-       |       IDENTIFIER:loc MULT{:
-               ParseNode pn=new ParseNode("location_property",parser.lexer.line_num);          
-               pn.addChild("location_multi").addChild(loc);
-               RESULT=pn;
-       :}
-       |       IDENTIFIER:loc {:
-               ParseNode pn=new ParseNode("location_order",parser.lexer.line_num);
-               pn.addChild(loc);
-               RESULT=pn;
-       :}
-       |       THIS COLON IDENTIFIER:loc {:
-               ParseNode pn=new ParseNode("location_property",parser.lexer.line_num);
-               pn.addChild("location_this").addChild(loc);
-               RESULT=pn;
-       :}
-        ;
-
 // 19.9) Interfaces
 
 // 19.9.1) Interface Declarations