Exemplo n.º 1
0
        private static bool TryBind(string code, ErlangValue value)
        {
            var frame        = new ErlangStackFrame("test", "test", 0);
            var expression   = ErlangSyntaxNode.ParseExpression(new TokenBuffer(ErlangToken.Tokenize(new TextBuffer(code))));
            var compiledExpr = ErlangExpression.Compile(expression);

            return(ErlangBinder.TryBindParameter(compiledExpr, value, frame));
        }
Exemplo n.º 2
0
        private static ErlangValue BindAndFetchVariable(string code, ErlangValue valueToBind, string variable)
        {
            var frame        = new ErlangStackFrame("test", "test", 0);
            var expression   = ErlangSyntaxNode.ParseExpression(new TokenBuffer(ErlangToken.Tokenize(new TextBuffer(code))));
            var compiledExpr = ErlangExpression.Compile(expression);

            Assert.True(ErlangBinder.TryBindParameter(compiledExpr, valueToBind, frame), $"Failure binding to '{code}'.");
            return(frame.GetVariable(variable));
        }
Exemplo n.º 3
0
 public void ParseOtp()
 {
     foreach (var file in Directory.EnumerateFiles(OTPSources, "*.erl"))
     {
         Console.WriteLine($"Parsing {file}.");
         var code         = File.ReadAllText(file);
         var expression   = ErlangSyntaxNode.ParseExpression(new TokenBuffer(ErlangToken.Tokenize(new TextBuffer(code))));
         var compiledExpr = ErlangExpression.Compile(expression);
     }
 }