From 017c71602f0b9e20b742c8dc6f47262fc3b98ab7 Mon Sep 17 00:00:00 2001 From: eficas <> Date: Thu, 18 Sep 2003 16:16:54 +0000 Subject: [PATCH] =?utf8?q?PN=20:=20correction=20de=20la=20fiche=20mx.textt?= =?utf8?q?ools=20=20=20=20=20=20pour=20eviter=20les=20modifs=20dans=20tabl?= =?utf8?q?es.py=20qui=20est=20g=C3=A9n=C3=A9r=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- convert/Parserv5/conv.py | 7 +- convert/Parserv5/tables.py | 995 ++++++++++++++++++------------------- 2 files changed, 501 insertions(+), 501 deletions(-) diff --git a/convert/Parserv5/conv.py b/convert/Parserv5/conv.py index 0b8cac83..b8e78079 100644 --- a/convert/Parserv5/conv.py +++ b/convert/Parserv5/conv.py @@ -23,11 +23,14 @@ try : import TextTools except : "" -from tables import ERRORS +try : + from tables import ERRORS +except : + "" # __version__="$Name: $" -__Id__="$Id: conv.py,v 1.2 2003/07/01 10:26:14 salome Exp $" +__Id__="$Id: conv.py,v 1.4 2003/08/08 10:14:37 eficas Exp $" # Keywords=('MAILLE_1','MAILLE_2','MAILLE_ESCL','MAILLE_FOND','MAILLE_MAIT','MAILLE_ORIG','MAILLE', diff --git a/convert/Parserv5/tables.py b/convert/Parserv5/tables.py index 8052f0c3..6962d251 100644 --- a/convert/Parserv5/tables.py +++ b/convert/Parserv5/tables.py @@ -25,14 +25,11 @@ XXX Ce fichier doit etre corrigé pour incorporer deux modifications réalisées dans la version V1_1p1 d'EFICAS """ -try : - from TextTools import * -except : - "" +from TextTools import * # -__version__="$Name: $" -__Id__="$Id: tables.py,v 1.2 2003/07/01 10:26:14 salome Exp $" +__version__="$Name: V1_4 $" +__Id__="$Id: tables.py,v 1.2 2002/05/15 15:32:00 eficas Exp $" # err0='ERR0 , erreur non identifiee : ' @@ -51,496 +48,496 @@ err11='ERR11 , ) attendue : ' ERRORS=(err0,err1,err2,err3,err4,err5,err6,err7,err8,err9, err10,err11) -try : - delim=" ();:=,!&*/%\n" - - whitespace = \ - (None,AllIn,' \t') - - opt_whitespace = \ - whitespace + (MatchOk,) - - t_opt_whitespace = \ - whitespace + (+1,) - - t_opt_whitenl = \ - (None,AllIn,' \t\n\r',+1) - - t_err = ( - (None,AllNotIn,';',+1), - (None,Is,';'), - (None,Skip,-1), - ) - - commespaces = \ - ('comments',Table,( - (None,IsInSet,white_set,+1,+4), - (None,Is,'%',MatchFail), - # - (None,AllNotIn,'\n\r',+1), - (None,AllIn,'\n\r',+1), - # - (None,AllInSet,white_set,+1), - (None,Is,'%',MatchOk,-3), - )) - - t_commespaces = ( - (None,IsInSet,white_set,+1,+4), - (None,Is,'%',MatchFail), - # - (None,AllNotIn,'\n\r',+1), - (None,AllIn,'\n\r',+1), - # - (None,AllInSet,white_set,+1), - (None,Is,'%',MatchOk,-3), - ) - - x_commespaces = \ - ('comments',Table,( - # - (None,Is,'%',+3,+1), - (None,AllNotIn,'\n\r',+1), - (None,AllIn,'\n\r',+1,-2), - (None,AllInSet,white_set,+1,-3), - )) - - t_ident = \ - ('ident',Table,( - (None,IsIn,alpha+'_'), - (None,AllIn,alpha+'_'+number,MatchOk), - )) - - t_identificateur = ( - (None,IsIn,alpha+'_'), - (None,AllIn,alpha+'_'+number,MatchOk), - ) - - t_identmc = ( - (None,IsIn,alpha+'_'), - (None,AllIn,alpha+'_'+number,+1), - (None,Table,t_commespaces,+1), - (None,Is,':',MatchFail), - ) - - n_ident = \ - (None,Table,( - (None,IsIn,alpha+'_'), - (None,AllIn,alpha+'_'+number,MatchOk), - )) - - n_string = \ - (None,Table,( - (None,Is,"'"), - # - (None,AllNotIn,"'",+1), - (None,Word,"''",+1,-1), - (None,Is,"'",MatchFail,MatchOk), - )) - - t_number = \ - ('num',Table,( - (None,IsIn,'-+',+1), - (None,Is,'.',+2), - (None,IsIn,number,MatchFail,+4), - # - (None,IsIn,number,MatchFail), - (None,AllIn,number,+1), - (None,Is,'.',+2), - # - (None,AllIn,number,+1), - # # si pas exposant termine number trouve - (None,IsIn,'deDE',MatchOk), - (None,IsIn,'-+',+1), - (None,AllIn,number,MatchFail,MatchOk), - )) - - n_number = \ - (None,Table,( - (None,IsIn,'-+',+1), - (None,Is,'.',+2), - (None,IsIn,number,MatchFail,+4), - # - (None,IsIn,number,MatchFail), - (None,AllIn,number,+1), - (None,Is,'.',+2), - # - (None,AllIn,number,+1), - # # si pas exposant termine number trouve - (None,IsIn,'deDE',MatchOk), - (None,IsIn,'-+',+1), - (None,AllIn,number,MatchFail,MatchOk), - )) - - t_complexe = \ - ('CPLX',Table,( - ("RI",Word,'RI',+7), - commespaces + (+1,), - t_number + (MatchFail,), # ce n est pas un complexe - commespaces + (+1,), # a partir d ici c est un complexe => produire erreurs - (None,Is,',',+1), - commespaces + (+1,), - t_number + (MatchFail,MatchOk), - # - ("MP",Word,'MP',MatchFail), - commespaces + (+1,), - t_number + (MatchFail,), # ce n est pas un complexe - commespaces + (+1,), # a partir d ici c est un complexe => produire erreurs - (None,Is,',',+1), - commespaces + (+1,), - t_number + (MatchFail,MatchOk), - # - (err7,Table,t_err,MatchFail,MatchOk), - )) - - # Table pour identifier le keyword PI - - t_PI = \ - ('PI',Table,( - (None,Word,'PI',MatchFail), - (None,IsIn,alpha+'_'+number,MatchOk,+1), - (None,Skip,-1), - (None,Jump,To,MatchFail), - )) - - t_vexpr = ( - ('par',Is,'(',+5,+1), - commespaces + (+1,), - ('vexpr',Table,ThisTable,+26), - commespaces + (+1,), - ('par2',Is,')',+25,+15), - t_number + (+1,+14), - t_complexe + (+1,+13), - ('sign',IsIn,'+-',+3,+1), - commespaces + (+1,), - ('vexpr',Table,ThisTable,+19,+10), - t_PI + (+1,+9), - t_ident + (MatchFail,), - commespaces + (+1,), - ('listpar',Is,'(',+6,+1), # on peut avoir une liste de parametres - # - commespaces + (+1,), - ('param',Table,ThisTable,+13), - commespaces + (+1,), - (None,Is,',',+1,-3), - ('finlist',Is,')',+11), - # - commespaces + (+1,), - ('exp',Word,'**',+3,+1), - commespaces + (+1,), - ('vexpr',Table,ThisTable,+6,MatchOk), - ('op',IsIn,'+-*/',+3,+1), - commespaces + (+1,), - ('vexpr',Table,ThisTable,+3,MatchOk), - (None,Jump,To,MatchOk), - # - (err0,Table,t_err,MatchFail,MatchOk), - # - (err10,Table,t_err,MatchFail,MatchOk), - # - (err9,Table,t_err,MatchFail,MatchOk), - ) - - t_liste_param = \ - ('liste',Table,( - t_ident, - commespaces + (+1,), - (None,Is,'('), - commespaces + (+1,), - t_vexpr + (MatchFail,), - # - commespaces + (+1,), - (None,Is,',',+3), - commespaces + (+1,), - t_vexpr + (+3,-3), - # - commespaces + (+1,), - (None,Is,')',+1,MatchOk), - # - (err7,Table,t_err,MatchFail,MatchOk), - )) - - t_eval_expr = \ - ('EVAL',Table,( - (None,Word,'EVAL'), - commespaces + (+1,), - (None,Is,'(',+5), - commespaces + (+1,), - ('vexpr',Table,t_vexpr,+3), - commespaces + (+1,), - (None,Is,')',+1,MatchOk), - # - (err7,Table,t_err,MatchFail,MatchOk), - )) - - t_entier = \ - ('entier',Table,( - (None,IsIn,number), - (None,AllIn,number,+1), - (None,IsIn,delim,MatchFail,+1), - (None,Skip,-1), - )) - - t_comment = \ - ('comment',Table,( - (None,Is,'%'), - (None,AllNotIn,'\n\r',+1), - (None,AllIn,'\n\r',MatchOk), - )) - - t_nullline = \ - ('Null',AllIn,' ;\t\n\r') - - t_passline = \ - ('passline',Table,( - (None,AllNotIn,newline,+1), - (None,IsIn,newline), - )) - - t_reste = \ - ('reste',Table,( - (None,AllNotIn,';',+1), - )) - - t_rest2 = \ - ('reste',Table,( - (None,AllNotIn,';',+1), - (None,Is,';'), - (None,AllNotIn,'\n',+1), - (None,Is,'\n',MatchOk,MatchOk), - )) - - t_formule = \ - ('formule',Table,( - commespaces + (+1,), - (None,Word,'!FORMULE'), - commespaces + (+1,), - (None,Is,'(',+32), - commespaces + (+1,), - ('type',Table,t_identificateur,+29), - commespaces + (+1,), - (None,Is,':',+27), - commespaces + (+1,), - (None,Is,'(',+26), - commespaces + (+1,), - ('id',Table,t_identificateur,+23), - commespaces + (+1,), - (None,Is,'(',+22), - # - commespaces + (+1,), - ('typ',Table,t_identmc,+1), - commespaces + (+1,), - ('id',Table,t_identificateur,+17), - commespaces + (+1,), - (None,Is,',',+1,-5), - commespaces + (+1,), - (None,Is,')',-7), - commespaces + (+1,), - (None,Is,'=',+11), - commespaces + (+1,), - ('vexpr',Table,t_vexpr,+9), - commespaces + (+1,), - (None,Is,')',+9), - commespaces + (+1,), - (None,Is,')',+7), - commespaces + (+1,), - (None,Is,';',+3), - (None,AllNotIn,'\n',+1), - (None,Is,'\n',MatchOk,MatchOk), - # - (err0,Table,t_err,MatchFail,MatchOk), - # - (err9,Table,t_err,MatchFail,MatchOk), - # - (err11,Table,t_err,MatchFail,MatchOk), - )) - - t_nom_ope = \ - ('nom_ope',Table,( - (None,Word,'EVAL',+1,MatchFail), # EVAL n est pas un nom d operateur, il est reserve - (None,IsIn,alpha+'_'), - (None,AllIn,alpha+'_'+number,+1), - commespaces + (+1,), - (None,Is,'(',MatchFail), - (None,Skip,-1), - )) - - t_arg = \ - ('arg',Table,( - n_string + (+1,MatchOk), - n_ident, - )) - - t_larg = \ - ('larg',Table,( - (None,Is,'(',MatchFail), - # - commespaces + (+1,), - t_complexe + (+1,+4), - t_number + (+1,+3), - t_eval_expr + (+1,+2), - t_arg + (MatchFail,+1), - # - commespaces + (+1,), - (None,Is,',',+1), - (None,Is,')',-7,MatchOk), - )) - - t_mcf = \ - ('mcf',Table,( - (None,Is,'(',MatchFail), - ("comments",Table,t_commespaces,+1), - (None,Is,')',+1,MatchOk), - t_ident + (MatchFail,), - ("comments",Table,t_commespaces,+1), - (None,Is,':',MatchFail), # a partir d ici on est dans un mot cle facteur (erreurs eventuelles) - # - ("comments",Table,t_commespaces,+1), - t_larg + (+1,+5), - t_complexe + (+1,+4), - t_number + (+1,+3), - t_eval_expr + (+1,+2), - t_arg + (+8,), - # - ("comments",Table,t_commespaces,+1), - (None,Is,',',+1), - ("comments",Table,t_commespaces,+1), - (None,Is,')',+1,MatchOk), - t_ident + (+3,), - ("comments",Table,t_commespaces,+1), - (None,Is,':',+1,-12), - # - (err7,Table,t_err,MatchFail,MatchOk), - )) - - t_comm = \ - ('comm',Table,( # on attend les arguments entre () sinon erreur - (None,Is,'(',+21), - commespaces + (+1,), - (None,Is,')',+1,MatchOk), - # - t_ident + (+18,), - commespaces + (+1,), - (None,Is,':',+16), - commespaces + (+1,), - t_mcf + (+5,), - # - commespaces + (+1,), - (None,Is,',',+1), - commespaces + (+1,), - t_mcf + (+7,-3), - # - t_larg + (+1,+5), - t_complexe + (+1,+4), - t_number + (+1,+3), - t_eval_expr + (+1,+2), - t_arg + (+5,), - # - commespaces + (+1,), - # - (None,Is,',',+1), - commespaces + (+1,), - (None,Is,')',-17,MatchOk), - # - (err1,Table,t_err,MatchFail,MatchOk), - )) - - t_affe = \ - ('affe',Table,( - commespaces + (+1,), - t_larg + (+1,+6), - t_complexe + (+1,+5), - t_number + (+1,+4), - t_eval_expr + (+1,+3), - t_arg + (+1,+2), - (None,Jump,To,+2), - # - (None,Jump,To,MatchOk), - # - (err0,Table,t_err,MatchFail,MatchOk), - )) - - t_reuse = \ - ('reuse',Table,( - t_opt_whitespace, - t_ident, - t_opt_whitespace, - (None,Is,'=',+5), - t_opt_whitespace, - t_nom_ope + (+2,+1), - # - t_comm + (MatchFail,MatchOk), - # - t_affe + (MatchFail,MatchOk), - # - (err8,Table,t_err,MatchFail,MatchOk), - )) - - t_noreuse = \ - ('noreuse',Table,( - t_opt_whitespace, - t_ident, - t_opt_whitenl, - (None,Is,'=',+3,+1), # on a affaire a un operateur ou une affectation - t_opt_whitespace, - t_nom_ope + (+4,+3), - (None,Is,'(',+5,+1), - (None,Skip,-1), - # - t_comm + (+2,MatchOk), - # - t_affe + (+1,MatchOk), - # - (err0,Table,t_err,MatchFail,MatchOk), - # - (err8,Table,t_err,MatchFail,MatchOk), - )) - - t_fin = \ - ('commande',Table,( - ('noreuse',Table,( - t_opt_whitespace, - ('ident',Word,"FIN"), - t_opt_whitenl, - (None,Is,'(',MatchFail), # On est vraiment sur d avoir la commande FIN apres avoir identifie ( - # On recule d un caractere pour identifier les arguments entre parenthèses - (None,Skip,-1), - t_comm + (+1,MatchOk), - (err0,Table,t_err,MatchFail,MatchOk), - )), - commespaces + (+1,), - (None,Is,';',+1,MatchOk), - # - (err0,Table,t_err,MatchFail,MatchOk), - )) - - t_commande = \ - ('commande',Table,( - t_opt_whitespace, - (None,Is,'&',+2,+1), - t_reuse + (MatchFail,+2), - t_noreuse + (MatchFail,), - # - commespaces + (+1,), - (None,Is,';',+1,MatchOk), - # - (err0,Table,t_err,MatchFail,MatchOk), - )) - - aster_script = ( - # - t_nullline + (+1,+0), - t_comment + (+1,-1), - t_formule + (+1,-2), - t_fin + (+1,+4), - t_commande + (+1,-4), - t_passline + (+1,-5), - (None,EOF,Here,-6), - # - t_nullline + (+1,+0), - t_passline + (+1,-1), - (None,EOF,Here,-2), - ) - -except: - print "Textools non importe" - +white_set=set(whitespace) + +delim=" ();:=,!&*/%\n" + +whitespace = \ + (None,AllIn,' \t') + +opt_whitespace = \ + whitespace + (MatchOk,) + +t_opt_whitespace = \ + whitespace + (+1,) + +t_opt_whitenl = \ + (None,AllIn,' \t\n\r',+1) + +t_err = ( + (None,AllNotIn,';',+1), + (None,Is,';'), + (None,Skip,-1), +) + +commespaces = \ + ('comments',Table,( + (None,IsInSet,white_set,+1,+4), + (None,Is,'%',MatchFail), + # + (None,AllNotIn,'\n\r',+1), + (None,AllIn,'\n\r',+1), + # + (None,AllInSet,white_set,+1), + (None,Is,'%',MatchOk,-3), + )) + +t_commespaces = ( + (None,IsInSet,white_set,+1,+4), + (None,Is,'%',MatchFail), + # + (None,AllNotIn,'\n\r',+1), + (None,AllIn,'\n\r',+1), + # + (None,AllInSet,white_set,+1), + (None,Is,'%',MatchOk,-3), +) + +x_commespaces = \ + ('comments',Table,( + # + (None,Is,'%',+3,+1), + (None,AllNotIn,'\n\r',+1), + (None,AllIn,'\n\r',+1,-2), + (None,AllInSet,white_set,+1,-3), + )) + +t_ident = \ + ('ident',Table,( + (None,IsIn,alpha+'_'), + (None,AllIn,alpha+'_'+number,MatchOk), + )) + +t_identificateur = ( + (None,IsIn,alpha+'_'), + (None,AllIn,alpha+'_'+number,MatchOk), +) + +t_identmc = ( + (None,IsIn,alpha+'_'), + (None,AllIn,alpha+'_'+number,+1), + (None,Table,t_commespaces,+1), + (None,Is,':',MatchFail), +) + +n_ident = \ + (None,Table,( + (None,IsIn,alpha+'_'), + (None,AllIn,alpha+'_'+number,MatchOk), + )) + +n_string = \ + (None,Table,( + (None,Is,"'"), + # + (None,AllNotIn,"'",+1), + (None,Word,"''",+1,-1), + (None,Is,"'",MatchFail,MatchOk), + )) + +t_number = \ + ('num',Table,( + (None,IsIn,'-+',+1), + (None,Is,'.',+2), + (None,IsIn,number,MatchFail,+4), + # + (None,IsIn,number,MatchFail), + (None,AllIn,number,+1), + (None,Is,'.',+2), + # + (None,AllIn,number,+1), + # # si pas exposant termine number trouve + (None,IsIn,'deDE',MatchOk), + (None,IsIn,'-+',+1), + (None,AllIn,number,MatchFail,MatchOk), + )) + +n_number = \ + (None,Table,( + (None,IsIn,'-+',+1), + (None,Is,'.',+2), + (None,IsIn,number,MatchFail,+4), + # + (None,IsIn,number,MatchFail), + (None,AllIn,number,+1), + (None,Is,'.',+2), + # + (None,AllIn,number,+1), + # # si pas exposant termine number trouve + (None,IsIn,'deDE',MatchOk), + (None,IsIn,'-+',+1), + (None,AllIn,number,MatchFail,MatchOk), + )) + +t_complexe = \ + ('CPLX',Table,( + ("RI",Word,'RI',+7), + commespaces + (+1,), + t_number + (MatchFail,), # ce n est pas un complexe + commespaces + (+1,), # a partir d ici c est un complexe => produire erreurs + (None,Is,',',+1), + commespaces + (+1,), + t_number + (MatchFail,MatchOk), + # + ("MP",Word,'MP',MatchFail), + commespaces + (+1,), + t_number + (MatchFail,), # ce n est pas un complexe + commespaces + (+1,), # a partir d ici c est un complexe => produire erreurs + (None,Is,',',+1), + commespaces + (+1,), + t_number + (MatchFail,MatchOk), + # + (err7,Table,t_err,MatchFail,MatchOk), + )) + +# Table pour identifier le keyword PI + +t_PI = \ + ('PI',Table,( + (None,Word,'PI',MatchFail), + (None,IsIn,alpha+'_'+number,MatchOk,+1), + (None,Skip,-1), + (None,Jump,To,MatchFail), + )) + +t_vexpr = ( + ('par',Is,'(',+5,+1), + commespaces + (+1,), + ('vexpr',Table,ThisTable,+26), + commespaces + (+1,), + ('par2',Is,')',+25,+15), + t_number + (+1,+14), + t_complexe + (+1,+13), + ('sign',IsIn,'+-',+3,+1), + commespaces + (+1,), + ('vexpr',Table,ThisTable,+19,+10), + t_PI + (+1,+9), + t_ident + (MatchFail,), + commespaces + (+1,), + ('listpar',Is,'(',+6,+1), # on peut avoir une liste de parametres + # + commespaces + (+1,), + ('param',Table,ThisTable,+13), + commespaces + (+1,), + (None,Is,',',+1,-3), + ('finlist',Is,')',+11), + # + commespaces + (+1,), + ('exp',Word,'**',+3,+1), + commespaces + (+1,), + ('vexpr',Table,ThisTable,+6,MatchOk), + ('op',IsIn,'+-*/',+3,+1), + commespaces + (+1,), + ('vexpr',Table,ThisTable,+3,MatchOk), + (None,Jump,To,MatchOk), + # + (err0,Table,t_err,MatchFail,MatchOk), + # + (err10,Table,t_err,MatchFail,MatchOk), + # + (err9,Table,t_err,MatchFail,MatchOk), +) + +t_liste_param = \ + ('liste',Table,( + t_ident, + commespaces + (+1,), + (None,Is,'('), + commespaces + (+1,), + t_vexpr + (MatchFail,), + # + commespaces + (+1,), + (None,Is,',',+3), + commespaces + (+1,), + t_vexpr + (+3,-3), + # + commespaces + (+1,), + (None,Is,')',+1,MatchOk), + # + (err7,Table,t_err,MatchFail,MatchOk), + )) + +t_eval_expr = \ + ('EVAL',Table,( + (None,Word,'EVAL'), + commespaces + (+1,), + (None,Is,'(',+5), + commespaces + (+1,), + ('vexpr',Table,t_vexpr,+3), + commespaces + (+1,), + (None,Is,')',+1,MatchOk), + # + (err7,Table,t_err,MatchFail,MatchOk), + )) + +t_entier = \ + ('entier',Table,( + (None,IsIn,number), + (None,AllIn,number,+1), + (None,IsIn,delim,MatchFail,+1), + (None,Skip,-1), + )) + +t_comment = \ + ('comment',Table,( + (None,Is,'%'), + (None,AllNotIn,'\n\r',+1), + (None,AllIn,'\n\r',MatchOk), + )) + +t_nullline = \ + ('Null',AllIn,' ;\t\n\r') + +t_passline = \ + ('passline',Table,( + (None,AllNotIn,newline,+1), + (None,IsIn,newline), + )) + +t_reste = \ + ('reste',Table,( + (None,AllNotIn,';',+1), + )) + +t_rest2 = \ + ('reste',Table,( + (None,AllNotIn,';',+1), + (None,Is,';'), + (None,AllNotIn,'\n',+1), + (None,Is,'\n',MatchOk,MatchOk), + )) + +t_formule = \ + ('formule',Table,( + commespaces + (+1,), + (None,Word,'!FORMULE'), + commespaces + (+1,), + (None,Is,'(',+32), + commespaces + (+1,), + ('type',Table,t_identificateur,+29), + commespaces + (+1,), + (None,Is,':',+27), + commespaces + (+1,), + (None,Is,'(',+26), + commespaces + (+1,), + ('id',Table,t_identificateur,+23), + commespaces + (+1,), + (None,Is,'(',+22), + # + commespaces + (+1,), + ('typ',Table,t_identmc,+1), + commespaces + (+1,), + ('id',Table,t_identificateur,+17), + commespaces + (+1,), + (None,Is,',',+1,-5), + commespaces + (+1,), + (None,Is,')',-7), + commespaces + (+1,), + (None,Is,'=',+11), + commespaces + (+1,), + ('vexpr',Table,t_vexpr,+9), + commespaces + (+1,), + (None,Is,')',+9), + commespaces + (+1,), + (None,Is,')',+7), + commespaces + (+1,), + (None,Is,';',+3), + (None,AllNotIn,'\n',+1), + (None,Is,'\n',MatchOk,MatchOk), + # + (err0,Table,t_err,MatchFail,MatchOk), + # + (err9,Table,t_err,MatchFail,MatchOk), + # + (err11,Table,t_err,MatchFail,MatchOk), + )) + +t_nom_ope = \ + ('nom_ope',Table,( + (None,Word,'EVAL',+1,MatchFail), # EVAL n est pas un nom d operateur, il est reserve + (None,IsIn,alpha+'_'), + (None,AllIn,alpha+'_'+number,+1), + commespaces + (+1,), + (None,Is,'(',MatchFail), + (None,Skip,-1), + )) + +t_arg = \ + ('arg',Table,( + n_string + (+1,MatchOk), + n_ident, + )) + +t_larg = \ + ('larg',Table,( + (None,Is,'(',MatchFail), + # + commespaces + (+1,), + t_complexe + (+1,+4), + t_number + (+1,+3), + t_eval_expr + (+1,+2), + t_arg + (MatchFail,+1), + # + commespaces + (+1,), + (None,Is,',',+1), + (None,Is,')',-7,MatchOk), + )) + +t_mcf = \ + ('mcf',Table,( + (None,Is,'(',MatchFail), + ("comments",Table,t_commespaces,+1), + (None,Is,')',+1,MatchOk), + t_ident + (MatchFail,), + ("comments",Table,t_commespaces,+1), + (None,Is,':',MatchFail), # a partir d ici on est dans un mot cle facteur (erreurs eventuelles) + # + ("comments",Table,t_commespaces,+1), + t_larg + (+1,+5), + t_complexe + (+1,+4), + t_number + (+1,+3), + t_eval_expr + (+1,+2), + t_arg + (+8,), + # + ("comments",Table,t_commespaces,+1), + (None,Is,',',+1), + ("comments",Table,t_commespaces,+1), + (None,Is,')',+1,MatchOk), + t_ident + (+3,), + ("comments",Table,t_commespaces,+1), + (None,Is,':',+1,-12), + # + (err7,Table,t_err,MatchFail,MatchOk), + )) + +t_comm = \ + ('comm',Table,( # on attend les arguments entre () sinon erreur + (None,Is,'(',+21), + commespaces + (+1,), + (None,Is,')',+1,MatchOk), + # + t_ident + (+18,), + commespaces + (+1,), + (None,Is,':',+16), + commespaces + (+1,), + t_mcf + (+5,), + # + commespaces + (+1,), + (None,Is,',',+1), + commespaces + (+1,), + t_mcf + (+7,-3), + # + t_larg + (+1,+5), + t_complexe + (+1,+4), + t_number + (+1,+3), + t_eval_expr + (+1,+2), + t_arg + (+5,), + # + commespaces + (+1,), + # + (None,Is,',',+1), + commespaces + (+1,), + (None,Is,')',-17,MatchOk), + # + (err1,Table,t_err,MatchFail,MatchOk), + )) + +t_affe = \ + ('affe',Table,( + commespaces + (+1,), + t_larg + (+1,+6), + t_complexe + (+1,+5), + t_number + (+1,+4), + t_eval_expr + (+1,+3), + t_arg + (+1,+2), + (None,Jump,To,+2), + # + (None,Jump,To,MatchOk), + # + (err0,Table,t_err,MatchFail,MatchOk), + )) + +t_reuse = \ + ('reuse',Table,( + t_opt_whitespace, + t_ident, + t_opt_whitespace, + (None,Is,'=',+5), + t_opt_whitespace, + t_nom_ope + (+2,+1), + # + t_comm + (MatchFail,MatchOk), + # + t_affe + (MatchFail,MatchOk), + # + (err8,Table,t_err,MatchFail,MatchOk), + )) + +t_noreuse = \ + ('noreuse',Table,( + t_opt_whitespace, + t_ident, + t_opt_whitenl, + (None,Is,'=',+3,+1), # on a affaire a un operateur ou une affectation + t_opt_whitespace, + t_nom_ope + (+4,+3), + (None,Is,'(',+5,+1), + (None,Skip,-1), + # + t_comm + (+2,MatchOk), + # + t_affe + (+1,MatchOk), + # + (err0,Table,t_err,MatchFail,MatchOk), + # + (err8,Table,t_err,MatchFail,MatchOk), + )) + +t_fin = \ + ('commande',Table,( + ('noreuse',Table,( + t_opt_whitespace, + ('ident',Word,"FIN"), + t_opt_whitenl, + (None,Is,'(',MatchFail), # On est vraiment sur d avoir la commande FIN apres avoir identifie ( + # On recule d un caractere pour identifier les arguments entre parenthèses + (None,Skip,-1), + t_comm + (+1,MatchOk), + (err0,Table,t_err,MatchFail,MatchOk), + )), + commespaces + (+1,), + (None,Is,';',+1,MatchOk), + # + (err0,Table,t_err,MatchFail,MatchOk), + )) + +t_commande = \ + ('commande',Table,( + t_opt_whitespace, + (None,Is,'&',+2,+1), + t_reuse + (MatchFail,+2), + t_noreuse + (MatchFail,), + # + commespaces + (+1,), + (None,Is,';',+1,MatchOk), + # + (err0,Table,t_err,MatchFail,MatchOk), + )) + +aster_script = ( + # + t_nullline + (+1,+0), + t_comment + (+1,-1), + t_formule + (+1,-2), + t_fin + (+1,+4), + t_commande + (+1,-4), + t_passline + (+1,-5), + (None,EOF,Here,-6), + # + t_nullline + (+1,+0), + t_passline + (+1,-1), + (None,EOF,Here,-2), +) + + + -- 2.39.2