Salome HOME
b86e77a145f881c14b0a1fddfa7556d7077ac54a
[tools/eficas.git] / convert / autre_parseur.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2013   EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 import sys,string,re,tokenize
21 import cStringIO
22
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(u"+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( "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 # parse: +affectation
641 ff=23 # parametre bidon
642
643 # parse: -all
644 a=45
645 #commment1
646 ##toto = FORMULE(REEL='(REEL:A) = A',
647 ##               X=2
648 ##              );
649 # parse: +all
650 b=45
651 #commment2
652 ##toto = FORMULE(REEL='(REEL:A) = A',
653 ##               X=2
654 ##              );
655 # parse: -comment
656 c=45
657 #commment3
658 ##toto = FORMULE(REEL='(REEL:A) = A',
659 ##               X=2
660 ##              );
661 # parse: +comment
662 d=45
663 #commment5
664 ##toto = FORMULE(REEL='(REEL:A) = A',
665 ##               X=2
666 ##              );
667 p=sin(ff)
668
669 e=toto(a=1)
670 e=toto(a=1,b=3)
671 e=toto(1,b=3)
672 e=toto(a,b=3)
673 e=toto()
674 sensible=[2.1E11, 0.3,  1.E-6,   1.E-6,   ]
675
676 n=len(sensible)
677 # parse: -affectation
678
679 PS=[None]*n
680
681 for i in range(n):
682     PS[i]=DEFI_PARA_SENSI(VALE=sensible[i])
683 # parse: +affectation
684
685 TEST_RESU(RESU=(_F(RESULTAT   = U3L,
686                    INST       = 1.0,
687                    NOM_CHAM   = 'DEPL',
688                    GROUP_NO   = 'PPA',
689                    NOM_CMP    = 'DX',
690                    VALE       = 2.86E-5,
691                    PRECISION  = 5.E-2,
692                    REFERENCE  = 'AUTRE_ASTER',
693                    VERSION    = '7.1.11',
694                    ),
695                 )
696        )#
697 #
698 FIN()
699 #
700
701 TEST_RESU(RESU=(_F(RESULTAT   = U3L,
702                    INST       = 1.0,
703                    NOM_CHAM   = 'DEPL',
704                    GROUP_NO   = 'PPA',
705                    NOM_CMP    = 'DX',
706                    VALE       = 2.86E-5,
707                    PRECISION  = 5.E-2,
708                    REFERENCE  = 'AUTRE_ASTER',
709                    VERSION    = '7.1.11',
710                    ),
711                 )
712        ) #a
713
714 titi = FORMULE(REEL='(REEL:A) = A',
715 ) # commentaire inline
716 titi = FORMULE(REEL='(REEL:A) = A',
717  ) # commentaire inline
718
719 def f(x):return x
720 #comment
721 def f(x):
722 #comment
723   for i in range(10): s=0
724
725 #com1
726 #com2
727
728 #com3
729 a=1
730 ##commendcomm
731 for k in range(1,10):
732
733    # Appel a GMSH pour le maillage
734
735    f=open("coque.geo","w")
736 #comm
737    if a==1:
738
739                          #comm
740
741       for i in x:
742 #comm
743 ##commendcomm
744 #comm
745 ##commendcomm
746 #comm
747         if x==3:
748 #comm
749           r=1
750         if w==4:
751 #comm
752
753            if k:
754
755 #comm
756              if g:
757
758 #comm
759
760                if t:
761                  a=5  
762 #comm
763 if 1:
764   a=2
765   b=3
766                # commenta
767 else:
768   # commen
769   # commen
770   a=3
771            # qqqqqqqqqqqqqqqq
772   c=5
773
774 b=5
775
776 if 1:
777   a=2
778                # commenta
779 else:
780   a=3
781 if 1:
782   if 2:
783      if 3:
784        a=1
785      elif 4:
786        b=1
787      else:
788        c=5
789   elif 3:
790      x=1
791   else:
792      y=4
793 elif 4:
794   s=1
795 else:
796   t=9
797 #com1
798 #com2
799
800 #com3
801 a=1
802 ##commendcomm
803 for k in range(1,10):
804
805    # Appel a GMSH pour le maillage
806
807    f=open("coque.geo","w")
808 #comm
809    if 1: 
810       if 2:
811          if 3:
812             a=1
813       else:
814          a=6
815 a=1
816 ##commendcomm
817 for k in range(1,10):
818
819    # Appel a GMSH pour le maillage
820
821    f=open("coque.geo","w")
822 #comm
823
824    if a==1:
825
826                          #comm
827
828       for i in x:
829 #comm
830 ##commendcomm
831 #comm
832 ##commendcomm
833 #comm
834         if x==3:
835 #comm
836           r=1
837
838    if 1:
839       if 2:
840          if 3:
841             a=1
842       else:
843          a=6
844
845 if 1:
846    if 2:
847       if 3:
848          r=1
849          # comm
850    else:
851       x=7
852       toto(a=1,
853 b=3)
854 SUP_=dict([(grand,0.) for grand in grand_obs])
855
856 for k in range(1,ns+1):
857    x=toto(a=1,b=2)
858 #   comm
859    if 1:
860      #com
861
862      #com
863       x=1
864      #com
865
866      #com
867    ##com
868    elif 3:
869    ##com
870       x=1
871    else:
872       y=3
873
874 def f():
875     return
876 ########################################################################
877
878 ########################################################################
879 # macro commande de post-traitement (ex POST_GOUJ2E)
880 # calcul des reactions cumulees suivant les filets
881
882 def POST_GOUJ_ops(self,TABLE):
883   ier=0
884
885 """
886     if len(sys.argv)== 2:
887        progname, input = sys.argv
888        f=open(input)
889        t=f.read()
890        f.close()
891     else:
892        t=text
893     txt = PARSEUR_PYTHON(t).get_texte()
894     print (txt)
895     compile(txt,"<string>",'exec')