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