Index: C:/Naidu/Projects/eclipse/june_policy_workspace/apache/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g =================================================================== --- C:/Naidu/Projects/eclipse/june_policy_workspace/apache/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g (revision 669804) +++ C:/Naidu/Projects/eclipse/june_policy_workspace/apache/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g (working copy) @@ -1298,110 +1298,94 @@ basicActionBlock[SPLSymbolTable symTab] returns [ActionBlock ab=null] : { - ArrayList paramList = new ArrayList(); - String ident1 = null; - String ident2 = ""; - String st = ""; - String op = ""; - MethodSymbol x=null; - SPLSymbolTable table=symTab; - Expression c = null; - + String st = ""; + String op = ""; + SPLSymbolTable table = symTab; + ArrayList paramList = new ArrayList(); + Expression c = null; + String ident1 = null; + String secondId = ""; + boolean isMethod = false; + boolean isBuiltInMethod = false; + List identTupleList = new ArrayList(); + IdentPrimaryTuple tp = null; + Expression arrexp = null; } - #( ACTIONBLOCK - ( - id1:IDENT {ident1 = id1.getText(); } - | - s:"Set" {st = s.getText();} - | - i:"InvokePolicy" {st = i.getText();} - ) - - ( - id2:IDENT - { - ident2 = id2.getText(); - try - { - //System.out.println(" trying to get method : "+ ident1+"."+ident2 ); - x = (MethodSymbol)symTab.getSymbol(ident1+"."+ident2); - } - catch (SPLException ex) - { - //System.out.println(" symTab get method Symbol failed : "+ ex.getMessage() ); - } - if(x!=null) - { - //System.out.println(" x != null"); - SPLSymbolTable methodTable=x.getMethodSymbolTable(); - if(methodTable!=null) - { - //System.out.println("table is not null therefore table.setParentSymbolTable(symTab)"); - table=methodTable; - table.setParentSymbolTable(symTab); - } - else - { - //System.out.println("table is null therefore table=symTab"); - table=symTab; - } - } - else - { - //System.out.println("x is null therefore table=symTab"); - table=symTab; - } - } - )? - - #(METHOD_CALL - ( - paramList = exprList[table] - ) - ) - - ( - ( - e:EQUAL {op = e.getText();} - | - ne:NOT_EQUAL {op = ne.getText();} - | - ge:GE {op = ge.getText();} - | - gt:GT {op = gt.getText();} - | - lt:LT {op = lt.getText();} - | - le:LE {op = le.getText();} - ) - - c=constant - )? - ) -{ - //System.out.println("ident1, ident2 "+ident1+" "+ ident2); + #( ACTIONBLOCK + ( + ( + #(i1:IDENT { ident1 = i1.getText(); } + ( + #(m2:METHOD_CALL (paramList = exprList[symTab])? ) + | + ( + i2:IDENT { secondId = i2.getText(); } + ( + arrexp = arrayIndex[symTab] + | + #( m:METHOD_CALL (paramList = exprList[symTab])? ) + )? + { + if(m != null) + isMethod = true; + table = new SPLSymbolTable(); + tp = new IdentPrimaryTuple(arrexp, paramList, secondId, isMethod, table); + identTupleList.add(tp); + } + )* + ) + ) + ) + + | + + ( + ( s:"Set" {st = s.getText();} + | i:"InvokePolicy" {st = i.getText();} + ) + ( id3:IDENT {ident1 = id3.getText(); } )? + + #( METHOD_CALL ( paramList = exprList[symTab] ) ) + ) + ) + + + ( + ( + e:EQUAL {op = e.getText();} + | + ne:NOT_EQUAL {op = ne.getText();} + | + ge:GE {op = ge.getText();} + | + gt:GT {op = gt.getText();} + | + lt:LT {op = lt.getText();} + | + le:LE {op = le.getText();} + ) + c = constant + )? + + ) + + { try { - //System.out.println("creating action : "+ident1+" "+ident2+" "+st+" "+op); - ab = ActionFactory.createAction(ident1, ident2, paramList, st, op, c,symTab); - if(logger.isLoggable(Level.FINE)) - logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: basicActionBlock created "); + // System.out.println("creating action : "+ident1+" "+ident2+" "+st+" "+op); + ab = ActionFactory.createAction(ident1, paramList, identTupleList, isBuiltInMethod, st, op, c, symTab); + if(logger.isLoggable(Level.FINE)) + logger.fine(Thread.currentThread().getName()+" CIMSPLTreeParser:: basicActionBlock created "); } catch (SPLException ex) { - ASTWithLineNumber q = (ASTWithLineNumber)id1; + ASTWithLineNumber q = (ASTWithLineNumber)i1; logger.severe(ex.getMessage()); logger.severe(Thread.currentThread().getName()+" "+"TreeParser::Exception creating Expression at line "+q.getLine()); - //System.out.println(ex.getMessage()); - //System.out.println("TreeParser::Exception inserting action at line "+q.getLine()); - System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+ex.getMessage()); + System.err.println("$SPLTreeParser$ Error at line no#"+q.getLine()+":"+ex.getMessage()); throw new RecognitionException(ex.getMessage()); - } - - -} - + } ; policyGroup[SPLSymbolTable symTab] returns [PolicyGroup pg = null]: