RoseFE_SourceProcessing

changeset 529:0e2efba41eac

equivalence statement parsed
author hcm@serenity
date Mon Nov 30 02:12:46 2009 -0600 (2009-11-30)
parents ba685bf2f3b8
children 7a6c5b2640f5
files PyFort/fortStmts.py
line diff
     1.1 --- a/PyFort/fortStmts.py	Wed Nov 25 14:15:48 2009 -0600
     1.2 +++ b/PyFort/fortStmts.py	Mon Nov 30 02:12:46 2009 -0600
     1.3 @@ -681,6 +681,7 @@
     1.4  class CommonStmt(Decl):
     1.5      kw = 'common'
     1.6      kw_str = kw
     1.7 +    _sons = ['declList']
     1.8  
     1.9      @classmethod
    1.10      def parse(cls,ws_scan,lineNumber):
    1.11 @@ -925,8 +926,30 @@
    1.12                 +''.join(self.internal)
    1.13  
    1.14  class EquivalenceStmt(Decl):
    1.15 -    pass
    1.16 +    kw = 'equivalence'
    1.17 +    _sons = ['nlists']
    1.18  
    1.19 +    @staticmethod
    1.20 +    def parse(ws_scan,lineNumber):
    1.21 +        scan = filter(lambda x: x != ' ',ws_scan)
    1.22 +        nlist = seq(lit('('),
    1.23 +                    cslist(Exp),
    1.24 +                    lit(')'))
    1.25 +        stmt = seq(lit(EquivalenceStmt.kw),cslist(nlist))
    1.26 +        ([equivalence,nlists],rm) = stmt(scan)
    1.27 +        return EquivalenceStmt(declList,lineNumber)
    1.28 +
    1.29 +    
    1.30 +    def __init__(self,nlists,lineNumber=0,label=False,lead='',internal=[]):
    1.31 +        self.nlists = nlists
    1.32 +        Decl.__init__(self,lineNumber,label,lead,internal)
    1.33 +
    1.34 +    def __str__(self):
    1.35 +        declStrList = []
    1.36 +        for nlist in self.nlists:
    1.37 +            declStrList.append('('+','.join(str(item) for item in nlist[1])+')')
    1.38 +        return '%s %s' % (self.kw,','.join(declStrList))
    1.39 +        
    1.40  aNamedParam = seq(id,lit('='),Exp)
    1.41  
    1.42  class ParameterStmt(Decl):
    1.43 @@ -1625,7 +1648,8 @@
    1.44  class ReadStmt(ComplexSyntaxIOStmt):
    1.45      kw = 'read'
    1.46      kw_str = kw
    1.47 -
    1.48 +    _sons = ['ioCtrlSpecList','itemList']
    1.49 +    
    1.50      @staticmethod
    1.51      def parse(ws_scan,lineNumber):
    1.52          scan = filter(lambda x: x != ' ',ws_scan)
    1.53 @@ -1640,6 +1664,7 @@
    1.54  class WriteStmt(ComplexSyntaxIOStmt):
    1.55      kw = 'write'
    1.56      kw_str = kw
    1.57 +    _sons = ['ioCtrlSpecList','itemList']
    1.58  
    1.59      @staticmethod
    1.60      def parse(ws_scan,lineNumber):