Beispiel #1
0
        public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List <string> DefinesList = null)
        {
            if (string.IsNullOrEmpty(Text))
            {
                return(null);
            }
            ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(ICSharpCode.NRefactory.SupportedLanguage.VBNet, new StringReader(Text));
            syntax_tree_node cu   = null;
            ASTConverter     conv = new ASTConverter();

            if (ParseMode == ParseMode.Expression)
            {
                ICSharpCode.NRefactory.Ast.Expression expr = parser.ParseExpression();
                cu = conv.get_expression(expr);
            }
            else
            {
                parser.Parse();
                cu = conv.get_syntax_tree(parser.CompilationUnit, FileName);
            }
            parser.Dispose();
            return(cu);
        }
Beispiel #2
0
		public syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode)
		{
			if (string.IsNullOrEmpty(Text))
				return null;
			ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(ICSharpCode.NRefactory.SupportedLanguage.VBNet,new StringReader(Text));
			syntax_tree_node cu = null;
			ASTConverter conv = new ASTConverter();
			if (ParseMode == ParseMode.Expression)
			{
				ICSharpCode.NRefactory.Ast.Expression expr = parser.ParseExpression();
				cu = conv.get_expression(expr);
			}
			else
			{
				parser.Parse();
				cu = conv.get_syntax_tree(parser.CompilationUnit, FileName);
			}
			parser.Dispose();
			return cu;
		}