From: yeom Date: Fri, 13 May 2011 17:51:46 +0000 (+0000) Subject: decide not to have additional grammar to declare the location hierarchy. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=18d774ae0c7c5e6cdf6c32f53c2741e7cc09d7c2;p=IRC.git decide not to have additional grammar to declare the location hierarchy. all additional things for SSJava will be done using the standard Java annotation. --- diff --git a/Robust/src/IR/Tree/BuildIR.java b/Robust/src/IR/Tree/BuildIR.java index 8b7d2585..21587c03 100644 --- a/Robust/src/IR/Tree/BuildIR.java +++ b/Robust/src/IR/Tree/BuildIR.java @@ -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 locOrder = - new Lattice("_top_","_bottom_"); - Set spinLocSet=new HashSet(); - 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) { diff --git a/Robust/src/Parse/java14.cup b/Robust/src/Parse/java14.cup index daf3c181..16d229f3 100644 --- a/Robust/src/Parse/java14.cup +++ b/Robust/src/Parse/java14.cup @@ -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