Example #1
0
 public static Expression analyse(string source)
 {
     Expression.source = source;
     index             = 0;
     prochainJeton();
     return(OperateurOu.parse());
 }
Example #2
0
        // partie analyse syntaxique
        public static new Expression parse()
        {
            Expression resultatGauche, resultatDroit;

            resultatGauche = OperateurEt.parse();
            while ((jeton != null) && (jeton == "ou"))
            {
                prochainJeton();
                resultatDroit  = OperateurEt.parse();
                resultatGauche = new OperateurOu(resultatGauche,
                                                 resultatDroit);
            }
            return(resultatGauche);
        }
Example #3
0
        public static Expression parse()
        {
            Expression resultat;

            if (jeton == "(")
            {
                prochainJeton();
                resultat = OperateurOu.parse();
                if (jeton == null)
                {
                    throw new Exception("Erreur de syntaxe");
                }
                if (jeton != ")")
                {
                    throw new Exception("Erreur de syntaxe");
                }
                prochainJeton();
            }
            else
            {
                resultat = MotCle.parse();
            }
            return(resultat);
        }