public CompilationUnit ParseFile(string content) { using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(content))) { try { parser.Parse(); LastErrors = parser.Errors; } catch (Exception) { } return(parser.CompilationUnit); } }
public Expression ParseExpression(string expressionText) { expressionText = expressionText.Trim(); using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(expressionText))) { Expression result = null; try { result = parser.ParseExpression(); LastErrors = parser.Errors; } catch (Exception) { } return(result); } }
public TypeReference ParseTypeReference(string content) { content = content.Trim(); using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(content))) { try { var result = parser.ParseTypeReference(); LastErrors = parser.Errors; return(result); } catch (Exception) { } } return(null); }
public Expression ParseExpression (string expressionText) { expressionText = expressionText.Trim (); using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser (SupportedLanguage.CSharp, new StringReader (expressionText))) { Expression result = null; try { result = parser.ParseExpression (); LastErrors = parser.Errors; } catch (Exception) { } return result; } }
public INode ParseText (string text) { text = text.Trim (); using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser (SupportedLanguage.CSharp, new StringReader (text))) { if (text.EndsWith (";") || text.EndsWith ("}")) { BlockStatement block = null ; try { block = parser.ParseBlock (); LastErrors = parser.Errors; } catch (Exception) { } if (block != null) return block; } return parser.ParseExpression (); } }
public INode ParseText(string text) { text = text.Trim(); using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(text))) { if (text.EndsWith(";") || text.EndsWith("}")) { BlockStatement block = null; try { block = parser.ParseBlock(); LastErrors = parser.Errors; } catch (Exception) { } if (block != null) { return(block); } } return(parser.ParseExpression()); } }
public CompilationUnit ParseFile (string content) { using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser (SupportedLanguage.CSharp, new StringReader (content))) { try { parser.Parse (); LastErrors = parser.Errors; } catch (Exception) { } return parser.CompilationUnit; } }
public TypeReference ParseTypeReference (string content) { content = content.Trim (); using (ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser (SupportedLanguage.CSharp, new StringReader (content))) { try { var result = parser.ParseTypeReference (); LastErrors = parser.Errors; return result; } catch (Exception) { } } return null; }