Salome HOME
*** empty log message ***
[tools/eficas.git] / convert / autre_parseur.py
1 # -*- coding: utf-8 -*-
2 #            CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002  EDF R&D                  WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
9 #
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
14 #
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 #    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
18 #
19 #
20 # ======================================================================
21 import sys,string,re,tokenize
22 import cStringIO
23
24 class ENTITE_JDC :
25     def __init__(self):
26         self.texte = ''
27
28     def set_text(self,texte):
29         self.texte = texte
30
31     def append_text(self,texte):
32         """
33         """
34         self.texte = self.texte +texte
35
36 class COMMENTAIRE(ENTITE_JDC):
37
38     def __str__(self):
39         """
40         Retourne une chaîne de caractères représentant self
41         sous une forme interprétable par EFICAS
42         """
43         t=repr(self.texte)
44         return "COMMENTAIRE("+t+")\n"
45
46     def append_text(self,texte):
47         """
48         Ajoute texte à self.texte en enlevant le # initial
49         """
50         if texte[0] == '#':
51             self.texte = self.texte+texte[1:]
52         else:
53             # le dièse n'est pas sur le premier caractère
54             amont,aval = string.split(texte,'#',1) # on découpe suivant la première occurrence de #
55             self.texte = self.texte +amont + aval
56         
57 class AFFECTATION(ENTITE_JDC):
58
59     def append_text(self,texte):
60         """
61         Ajoute texte à self.texte en enlevant tout retour chariot et tout point virgule
62         """
63         self.texte = self.texte+texte
64         
65     def __str__(self):
66         """
67         Retourne une expression de l'affectation compréhensible par ACCAS
68         et exploitable par EFICAS
69         """
70         #t=repr(self.texte)
71         t=self.texte
72         return "PARAMETRE(nom='"+self.name+"',valeur="+t+")"
73
74 class COMMANDE_COMMENTARISEE(ENTITE_JDC):
75
76     def append_text(self,texte):
77         """
78         Ajoute texte à self.texte en enlevant les doubles commentaires
79         """
80         texte = string.strip(texte)
81         texte = string.strip(texte[2:])
82         self.texte = self.texte+(len(self.texte)>0)*'\n'+texte
83
84     def __str__(self):
85         """
86         Retourne une expression de la commande commentarisée compréhensible par ACCAS
87         et exploitable par EFICAS
88         """
89         return "COMMANDE_COMM(texte="+repr(self.texte)+")\n"
90
91         
92 next = {}
93 next['if'] = next['elif'] = 'elif', 'else', 'end'
94 next['while'] = next['for'] = 'else', 'end'
95 next['try'] = 'except', 'finally'
96 next['except'] = 'except', 'else', 'end'
97 next['else'] = next['finally'] = next['def'] = next['class'] = 'end'
98 next['end'] = ()
99 start = 'if', 'while', 'for', 'try', 'def', 'class'
100
101 class PARSEUR_PYTHON:
102     """
103     Cette classe sert à créer un objet PARSEUR_PYTHON qui réalise l'analyse d'un texte 
104     représentant un JDC Python en distinguant :
105       - les commentaires inter commandes
106       - les affectations
107       - les commandes
108     """
109     # au moins 1 caractère non blanc ou non tabulation
110     #pattern_ligne_non_blanche = re.compile(r'^[\w\t]+')
111     pattern_ligne_non_blanche = re.compile(r'[^ \t]+')
112     kwprog = re.compile(
113                 r'^\s*(?P<kw>[a-z]+)'
114                 r'(\s+(?P<id>[a-zA-Z_]\w*))?'
115                 r'[^\w]')
116     endprog = re.compile(
117                 r'^\s*#?\s*end\s+(?P<kw>[a-z]+)'
118                 r'(\s+(?P<id>[a-zA-Z_]\w*))?'
119                 r'[^\w]')
120     wsprog = re.compile(r'^[ \t]*')
121     optionprog=re.compile(r'#\s*parse:\s*([^\n\'"]*)$')
122
123     def __init__(self,texte):
124         # on verifie que le texte fourni se compile correctement
125         compile(texte,"<string>",'exec')
126         self.texte = cStringIO.StringIO(texte)
127         self.line=''
128         self.out=""
129         self.lastcol = 0
130         self.lastrow = 1
131         self.please_indent = 1
132         self.indent_list = []
133         self.indentation=0
134         self.paren_level=0
135         self.affectation=0
136         self.indent_list=[""]
137         self.objet_courant=None
138         self.affectation_flag=1
139         self.comment_flag=1
140         self.buffer=[]
141         self.buffer_indent=""
142
143     def getoptions(self):
144         m= self.optionprog.match(self.line)
145         if m:
146            option=m.group(1)
147            name=option[1:]
148            flag=(option[0] == '+')
149            if name == "affectation": self.affectation_flag=flag
150            if name == "comment": self.comment_flag=flag
151            if name == "all": 
152               self.comment_flag=flag
153               self.affectation_flag=flag
154
155     def readline(self):
156         self.line= self.texte.readline()
157         #print "line:",self.line
158         # option ?
159         self.getoptions()
160         return self.line
161
162     def get_texte(self,appli=None):
163         """
164            Retourne le texte issu de l'analyse
165         """
166         for tk in tokenize.generate_tokens(self.readline):
167             self.process_token(tk)
168         return self.out
169
170     def process_token(self, tk):
171         """
172         """
173         ttype, tstring, spos, epos, line = tk
174         thisrow, thiscol = spos
175         #print spos, epos,tokenize.tok_name[ttype],self.lastrow, self.lastcol
176
177         if thisrow > self.lastrow:
178             # si plusieurs lignes (>1)
179             self.out=self.out+"\n" * (thisrow - self.lastrow - 1)
180             self.lastcol = 0
181
182 #        if thiscol > self.lastcol :
183 #            self.out=self.out+ " " * (thiscol - self.lastcol)
184 #            self.please_indent = None
185
186         self.thiscol=thiscol
187         #self.nextrow, self.nextcol = epos
188
189         try:
190             fn = getattr(self, tokenize.tok_name[ttype])
191         except AttributeError:
192             print >>sys.stderr, "No match!", tokenize.tok_name[ttype], tstring
193             return
194
195         if ttype != tokenize.DEDENT and ttype != tokenize.INDENT and self.please_indent:
196             self.do_indent()
197
198         fn(tstring)
199         self.lastrow, self.lastcol = epos
200
201     def output(self,tstring):
202         #print "output",tstring
203
204         if self.thiscol > self.lastcol :
205             #print self.thiscol,self.lastcol
206             self.out=self.out+ " " * (self.thiscol - self.lastcol)
207             self.lastcol=self.thiscol
208
209         self.out=self.out+tstring
210
211     def output_com(self,tstring):
212         self.out=self.out+tstring
213
214     def update_indent(self):
215         #print "update_indent",len(self.indent_list[-1]),len(self.buffer_indent)
216         if len(self.indent_list[-1]) > len(self.buffer_indent):
217            self.out=self.out+(len(self.indent_list[-1]) - len(self.buffer_indent))*" "
218            self.buffer_indent=self.indent_list[-1]
219
220     def do_indent(self):
221         #print "indentation dans do_indent",len(self.indent_list)
222
223         self.out=self.out+self.indent_list[-1]
224         self.buffer_indent=self.indent_list[-1]
225         if self.lastcol+len(self.indent_list[-1]) > self.thiscol:
226            self.lastcol=self.thiscol
227         else:
228            self.lastcol=self.lastcol+len(self.indent_list[-1])
229         self.please_indent = None
230
231     def flush_buffer(self):
232         #if self.buffer:
233         #   print len(self.indent_list),self.please_indent
234         for ob in self.buffer:
235            self.out= self.out+ str(ob)
236            self.do_indent()
237         self.buffer=[]
238         self.objet_courant=None
239
240     def NL(self, tstring):
241         if self.affectation:
242            if self.paren_level == 0:
243               # affectation en cours mais complète
244               self.out= self.out+ str(self.affectation_courante)
245               self.affectation_courante=None
246               self.please_indent=1
247               self.affectation=0
248            else:
249               # affectation en cours, on ajoute
250               if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
251               self.affectation_courante.append_text(tstring)
252               return
253            
254         if self.objet_courant:
255            self.objet_courant=None
256            self.buffer.append(tstring)
257         #   self.please_indent = None
258            return
259         self.output(tstring)
260         self.please_indent = 1
261
262     def COMMENT(self, tstring):
263         liste= string.split(self.line,"##",1)
264         if len(liste) > 1:
265            # On a trouve un double commentaire
266            before,after=liste
267            if self.affectation:
268               # affectation en cours, on ignore
269               pass
270            elif self.paren_level > 0:
271               self.output(tstring)
272            elif self.comment_flag and not self.pattern_ligne_non_blanche.search(before):
273               # il s'agit d'une commande commentarisée
274               if self.objet_courant == None:
275                  if not self.buffer:self.buffer_indent=self.indent_list[-1]
276                  self.objet_courant=COMMANDE_COMMENTARISEE()
277                  self.buffer.append(self.objet_courant)
278                  self.objet_courant.append_text(tstring)
279                  self.please_indent = None
280               elif isinstance(self.objet_courant,COMMENTAIRE):
281                  self.objet_courant=COMMANDE_COMMENTARISEE()
282                  self.buffer.append(self.objet_courant)
283                  self.objet_courant.append_text(tstring)
284                  self.please_indent = None
285               else:
286                  self.objet_courant.append_text(tstring)
287                  self.please_indent = None
288            else:
289               # commentaire inline
290               self.output(tstring)
291               self.please_indent = 1
292            return
293
294         else:
295            # On a un commentaire simple
296            new_line = string.split(self.line,'#')[0]
297            if self.affectation:
298               # affectation en cours, on ignore
299               pass
300            elif self.paren_level > 0:
301               self.output(tstring)
302            elif self.comment_flag and not self.pattern_ligne_non_blanche.search(new_line):
303               # commentaire précédé de blancs
304               if self.objet_courant == None:
305                  if not self.buffer:self.buffer_indent=self.indent_list[-1]
306                  self.objet_courant=COMMENTAIRE()
307                  self.buffer.append(self.objet_courant)
308                  self.objet_courant.append_text(tstring)
309                  self.please_indent = None
310               elif isinstance(self.objet_courant,COMMANDE_COMMENTARISEE):
311                  self.objet_courant=COMMENTAIRE()
312                  self.buffer.append(self.objet_courant)
313                  self.objet_courant.append_text(tstring)
314                  self.please_indent = None
315               else:
316                  self.objet_courant.append_text(tstring)
317                  self.please_indent = None
318            else:
319               # commentaire inline
320               self.output(tstring)
321               self.please_indent = 1
322            return
323
324     def ERRORTOKEN(self, tstring):
325         print "ERRORTOKEN",tstring
326
327     def NAME(self, tstring):
328         if self.buffer:
329            self.update_indent()
330         self.flush_buffer()
331
332         if self.affectation ==1:
333            # on a une expression du type NAME=NAME
334            # on ne veut pas des expressions qui commencent par NAME=NAME(NAME=
335            # on en prend le chemin : on met affectation a 3 pour le signaler
336            # on attend d'en savoir plus
337            if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
338            self.affectation_courante.append_text(tstring)
339            self.affectation=3
340            return
341         elif self.affectation ==4:
342            # on a une expression qui commence par NAME=NAME(NAME
343            # il s'agit tres probablement d'une commande
344            # on annule l'affectation en cours
345            if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
346            self.affectation_courante.append_text(tstring)
347            self.affectation=5
348            return
349         elif self.affectation == 2:
350            # affectation en cours, on ajoute
351            if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
352            self.affectation_courante.append_text(tstring)
353            self.affectation=2
354            return
355         self.affectation=0
356         self.name=None
357         if self.paren_level == 0 and self.affectation_flag: 
358            # si on est en dehors de parentheses et en mode transformation d'affectation
359            # on initialise l'attribut name qui indique une affectation en cours
360            self.name=tstring
361         self.output(tstring)
362
363     def ident(self, tstring):
364         self.flush_buffer()
365         self.affectation=0
366         self.output(tstring)
367
368     def NUMBER(self, tstring):
369         self.flush_buffer()
370         if self.affectation>=1:
371            # affectation en cours, on ajoute
372            if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
373            self.affectation_courante.append_text(tstring)
374            self.affectation=2
375            return
376         self.output(tstring)
377
378     def OP(self,tstring):
379         self.flush_buffer()
380         if tstring in ('(','[','{'): self.paren_level=self.paren_level+1
381         if tstring in (')',']','}'): self.paren_level=self.paren_level-1
382
383         if tstring == '=' and self.affectation ==5:
384            # on a une expression qui commence par NAME=NAME(NAME=)
385            # il peut s'agir d'une commande
386            # on annule l'affectation en cours
387            self.out= self.out+ self.affectation_courante.texte
388            self.affectation_courante=None
389            self.name=None
390            self.affectation=0
391         elif tstring == ')' and self.affectation ==4:
392            # on a une expression qui commence par NAME=NAME()
393            # il peut s'agir d'une commande
394            # on annule l'affectation en cours
395            self.out= self.out+ self.affectation_courante.texte
396            self.affectation_courante=None
397            self.affectation=0
398         elif tstring == '(' and self.affectation == 3:
399            # on a deja trouve NAME=NAME
400            # on passe affectation a 4
401            if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
402            self.affectation_courante.append_text(tstring)
403            self.affectation=4
404            return
405         elif tstring == ';' and self.affectation>=1:
406            # l'affectation est terminee
407            self.out= self.out+ str(self.affectation_courante)
408            self.affectation_courante=None
409            self.please_indent=1
410            self.affectation=0
411         elif self.affectation>=1:
412            # on complete l'affectation
413            if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
414            self.affectation_courante.append_text(tstring)
415            self.affectation=2
416            return
417
418         self.affectation=0
419         if self.name and tstring=='=': 
420            self.affectation=1
421            self.affectation_courante=AFFECTATION()
422            self.affectation_courante.name=self.name
423         self.output(tstring)
424
425     ENDMARKER = ident
426     NEWLINE=NL
427
428     def INDENT(self, tstring):
429         #tstring=str(len(self.indent_list))*len(tstring)
430         self.indent_list.append(tstring) 
431         #print "indentation dans INDENT",len(self.indent_list),len(tstring)
432         self.affectation=0
433         if self.buffer:
434            self.update_indent()
435         self.flush_buffer()
436
437     def DEDENT(self, tstring):
438         #print "DEDENT",tstring,len(tstring)
439         if self.buffer:
440            self.out= self.out+ str(self.buffer[0])
441            if len(self.buffer) > 1:
442               for ob in self.buffer[1:]:
443                   self.do_indent()
444                   self.out= self.out+ str(ob)
445            self.buffer=[]
446            self.objet_courant=None
447            self.please_indent=1
448
449         self.affectation=0
450         self.indent_list = self.indent_list[:-1] 
451         #print "indentation dans DEDENT",len(self.indent_list)
452
453     def STRING(self, tstring):
454         self.flush_buffer()
455         if self.affectation>=1:
456            # affectation en cours, on ajoute
457            if self.thiscol > self.lastcol :self.affectation_courante.append_text((self.thiscol - self.lastcol)*" ")
458            self.affectation_courante.append_text(tstring)
459            self.affectation=2
460            return
461         self.output(tstring)
462
463 if __name__ == "__main__" :
464     import sys
465     import cStringIO
466     text="""
467 #
468 #   comment
469 #   comment
470 #   comment
471 #
472
473 import sys,os
474
475 # commentaire
476 # commentaire
477 # commentaire
478
479 DEBUT();
480 ##toto = FORMULE(REEL='(REEL:A) = A',);
481
482 x=2*cos(90.)/34.
483
484 a=1.
485 if a != 0:
486   a=+1
487
488 b=2.
489 c=a+b
490 #if 1:
491 #  d=3
492 #  e=5
493 #try:
494 #  a=1/2
495 #except KeyError:
496 #  pass
497
498 if 1:
499   a=2
500   b=3
501                # commenta
502 else:
503   # commen
504   # commen
505   a=3
506                #qqqqqqqqqqqqqqqqqqqqqqqq
507   c=5
508
509 b=5
510           # commentaire
511 toto = FORMULE(REEL='(REEL:A) = A',);
512 titi = FORMULE(REEL='(REEL:A) = A',) # commentaire inline
513 tutu = FORMULE(REEL='(REEL:A) = A',) ## commentaire inline
514
515 TEST_TABLE( TABLE=RELV[k],
516                FILTRE=(
517                         _F( NOM_PARA = 'QUANTITE',
518                             VALE_K = 'MAXIMUM'),),
519         # commentaire 
520                NOM_PARA='VMIS',  # comm
521                VALE=1.9669824189084E9,
522                REFERENCE='NON_REGRESSION',
523                VERSION='8.1.0'  )
524
525 if 1:
526    a=fff(a=1,
527          b=2)
528 if 1:
529   a=2
530   b=3
531                # commenta
532 else:
533   # commen
534   # commen
535   a=3
536
537 for k in range(1,10):
538
539    # Appel a GMSH pour le maillage
540
541    f=open("coque.geo","w")
542
543
544 a = 1.
545 b=3
546 c= 3 * 5
547 d= 4 + \
548  5 \
549  -4
550 e=toto(a=1)
551 x=(1,2)
552 y=[3,
553 #comme
554 4]
555 z="a"
556 zz='v'
557 u='''aaaa
558 bbbb'''
559 if 1:
560   a=45
561 else:
562   a=5.6
563 d={"a":0}
564 e={"a":0,
565 #comme
566 "d":4}
567 a==1
568 x=a==1
569 s="-"*80
570 fmt_raison='-'*80+'''
571
572    Exception erreur_Fatale interceptee
573    Raison : %s
574
575 '''+'-'*80+'xxxxxxxxxxxxxxxx'
576 q=30*cos(12)
577 f=cos(12)
578 #commen'''
579 #commen'''
580 y=a[1]
581 y=["x"]*10
582
583 ##toto = FORMULE(REEL='(REEL:A) = A',
584 ##               X=2
585 ##              );
586 #
587 #   comment
588 #   comment
589 #   comment
590 #
591 zz=8.9;
592 zz=8.9;aa=10
593 P1 = 9.8;
594
595 P2 = 8.8;
596
597 P3 = 7;
598
599 P5 = P3*P1;
600
601 P6 = P1-3;
602
603 P4 = [2,3,4];
604
605 P7=P4[1]
606 MA=LIRE_MAILLAGE()
607 MA=LIRE_MAILLAGE(#comment
608 )
609 xyz=cos(10)
610 MA=LIRE_MAILLAGE(INFO=1)
611 MA=LIRE_MAILLAGE(
612         NFO=1)
613 MA=LIRE_MAILLAGE(#comme
614         NFO=1)
615 MA=\
616 LIRE_MAILLAGE(INFO=1)
617 MA= LIRE_MAILLAGE()
618 TFIN = 1.790     # Temps fin pour le calcul
619
620 PAS = 0.001      # pas de temps du calcul
621 # parse: -affectation
622 DS1=[None]*5
623 DS2=[None]*5
624 DS3=[None]*5
625 DS4=[None]*5
626 CHS1=[None]*5
627 CHS2=[None]*5
628 MO=AFFE_MODELE(  MAILLAGE=MA,
629           #test de validateur GEOM (typ=grma) avec grma derive de GEOM
630                  AFFE=(_F(GROUP_MA = ('LI1'),
631                           PHENOMENE = 'MECANIQUE',
632                           MODELISATION = 'DIS_TR'),
633                                 ),
634                   INFO=2,);
635
636 for k in range(1,5):
637   DS1[k] = CREA_CHAMP( OPERATION='EXTR', TYPE_CHAM='NOEU_DEPL_R',
638                   RESULTAT= MODESTA1, NUME_ORDRE=k, NOM_CHAM = 'DEPL');
639
640 if x==1:
641    print "coucou"
642 elif x==2:
643    print "coucou"
644 elif x==2:
645    print "coucou"
646 elif x==2:
647    print "coucou"
648 else:
649    print "coucou"
650 # parse: +affectation
651 ff=23 # parametre bidon
652
653 # parse: -all
654 a=45
655 #commment1
656 ##toto = FORMULE(REEL='(REEL:A) = A',
657 ##               X=2
658 ##              );
659 # parse: +all
660 b=45
661 #commment2
662 ##toto = FORMULE(REEL='(REEL:A) = A',
663 ##               X=2
664 ##              );
665 # parse: -comment
666 c=45
667 #commment3
668 ##toto = FORMULE(REEL='(REEL:A) = A',
669 ##               X=2
670 ##              );
671 # parse: +comment
672 d=45
673 #commment5
674 ##toto = FORMULE(REEL='(REEL:A) = A',
675 ##               X=2
676 ##              );
677 p=sin(ff)
678
679 e=toto(a=1)
680 e=toto(a=1,b=3)
681 e=toto(1,b=3)
682 e=toto(a,b=3)
683 e=toto()
684 sensible=[2.1E11, 0.3,  1.E-6,   1.E-6,   ]
685
686 n=len(sensible)
687 # parse: -affectation
688
689 PS=[None]*n
690
691 for i in range(n):
692     PS[i]=DEFI_PARA_SENSI(VALE=sensible[i])
693 # parse: +affectation
694
695 TEST_RESU(RESU=(_F(RESULTAT   = U3L,
696                    INST       = 1.0,
697                    NOM_CHAM   = 'DEPL',
698                    GROUP_NO   = 'PPA',
699                    NOM_CMP    = 'DX',
700                    VALE       = 2.86E-5,
701                    PRECISION  = 5.E-2,
702                    REFERENCE  = 'AUTRE_ASTER',
703                    VERSION    = '7.1.11',
704                    ),
705                 )
706        )#
707 #
708 FIN()
709 #
710
711 TEST_RESU(RESU=(_F(RESULTAT   = U3L,
712                    INST       = 1.0,
713                    NOM_CHAM   = 'DEPL',
714                    GROUP_NO   = 'PPA',
715                    NOM_CMP    = 'DX',
716                    VALE       = 2.86E-5,
717                    PRECISION  = 5.E-2,
718                    REFERENCE  = 'AUTRE_ASTER',
719                    VERSION    = '7.1.11',
720                    ),
721                 )
722        ) #a
723
724 titi = FORMULE(REEL='(REEL:A) = A',
725 ) # commentaire inline
726 titi = FORMULE(REEL='(REEL:A) = A',
727  ) # commentaire inline
728
729 def f(x):return x
730 #comment
731 def f(x):
732 #comment
733   if a==1:print "coucou"
734   for i in range(10): s=0
735
736 #com1
737 #com2
738
739 #com3
740 a=1
741 ##commendcomm
742 for k in range(1,10):
743
744    # Appel a GMSH pour le maillage
745
746    f=open("coque.geo","w")
747 #comm
748    if a==1:
749
750                          #comm
751
752       for i in x:
753 #comm
754 ##commendcomm
755 #comm
756 ##commendcomm
757 #comm
758         if x==3:
759 #comm
760           r=1
761         if w==4:
762 #comm
763
764            if k:
765
766 #comm
767              if g:
768
769 #comm
770
771                if t:
772                  a=5  
773 #comm
774 if 1:
775   a=2
776   b=3
777                # commenta
778 else:
779   # commen
780   # commen
781   a=3
782            # qqqqqqqqqqqqqqqq
783   c=5
784
785 b=5
786
787 if 1:
788   a=2
789                # commenta
790 else:
791   a=3
792 if 1:
793   if 2:
794      if 3:
795        a=1
796      elif 4:
797        b=1
798      else:
799        c=5
800   elif 3:
801      x=1
802   else:
803      y=4
804 elif 4:
805   s=1
806 else:
807   t=9
808 #com1
809 #com2
810
811 #com3
812 a=1
813 ##commendcomm
814 for k in range(1,10):
815
816    # Appel a GMSH pour le maillage
817
818    f=open("coque.geo","w")
819 #comm
820    if 1: 
821       if 2:
822          if 3:
823             a=1
824       else:
825          a=6
826 a=1
827 ##commendcomm
828 for k in range(1,10):
829
830    # Appel a GMSH pour le maillage
831
832    f=open("coque.geo","w")
833 #comm
834
835    if a==1:
836
837                          #comm
838
839       for i in x:
840 #comm
841 ##commendcomm
842 #comm
843 ##commendcomm
844 #comm
845         if x==3:
846 #comm
847           r=1
848
849    if 1:
850       if 2:
851          if 3:
852             a=1
853       else:
854          a=6
855
856 if 1:
857    if 2:
858       if 3:
859          r=1
860          # comm
861    else:
862       x=7
863       toto(a=1,
864 b=3)
865 SUP_=dict([(grand,0.) for grand in grand_obs])
866
867 for k in range(1,ns+1):
868    x=toto(a=1,b=2)
869 #   comm
870    if 1:
871      #com
872
873      #com
874       x=1
875      #com
876
877      #com
878    ##com
879    elif 3:
880    ##com
881       x=1
882    else:
883       y=3
884
885 def f():
886     return
887 ########################################################################
888
889 ########################################################################
890 # macro commande de post-traitement (ex POST_GOUJ2E)
891 # calcul des reactions cumulees suivant les filets
892
893 def POST_GOUJ_ops(self,TABLE):
894   ier=0
895
896 """
897     if len(sys.argv)== 2:
898        progname, input = sys.argv
899        f=open(input)
900        t=f.read()
901        f.close()
902     else:
903        t=text
904     txt = PARSEUR_PYTHON(t).get_texte()
905     print txt
906     compile(txt,"<string>",'exec')