Ejemplo n.º 1
0
        public static string Package(string source)
        {
            var lexer  = new MeanLexer(source);
            var parser = new MeanParser(lexer);

            var result = parser.Parse();

            if (!result.IsSuccess)
            {
                var errors = new StringBuilder();
                foreach (var error in result.Errors)
                {
                    Console.WriteLine($"{error}");
                    errors.Append($"<<<{error}>>>");
                }

                return(errors.ToString());
            }
            else
            {
                Console.WriteLine($"{source} ==> {Tr(result.Root)}");

                return(Tr(result.Root));
            }
        }
Ejemplo n.º 2
0
        public static ParseResult Unit(string source)
        {
            var lexer  = new MeanLexer(source);
            var parser = new MeanParser(lexer);

            var result = parser.Parse();

            return(result);
        }