public static bool validar(string polinomio) { try { polinomio = polinomio.Replace("\\s+", ""); StringReader read = new StringReader(polinomio); Lexico lex = new Lexico(read); Sintatico sintatico = new Sintatico(); sintatico.parse(lex, new SemanticoDummy()); return true; } catch (LexicalError e) { Console.WriteLine(e); } catch (SyntaticError e) { Console.WriteLine(e); } catch (SemanticError e) { Console.WriteLine(e); } return false; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static Polinomio criarPolinomio(String pol) throws Analisador.AnalysisError public static Polinomio criarPolinomio(string pol) { pol = pol.Replace("\\s+", ""); pol = pol.Replace("\\.", "*"); StringReader read = new StringReader(pol); Lexico lex = new Lexico(read); Sintatico sintatico = new Sintatico(); Semantico semantico = new Semantico(); sintatico.parse(lex, semantico); return semantico.Polinomio; }