Search in sources :

Example 21 with AST2Expr

use of org.matheclipse.core.convert.AST2Expr in project symja_android_library by axkr.

the class UnitTestingFunctions method readFile.

public static IAST readFile(EvalEngine engine, String str) {
    final List<ASTNode> node = FileFunctions.parseReader(str, engine);
    IExpr temp;
    int i = 0;
    AST2Expr ast2Expr = new AST2Expr(engine.isRelaxedSyntax(), engine);
    IASTAppendable list = F.ListAlloc(node.size());
    while (i < node.size()) {
        temp = ast2Expr.convert(node.get(i++));
        list.append(temp);
    }
    return list;
}
Also used : IASTAppendable(org.matheclipse.core.interfaces.IASTAppendable) ASTNode(org.matheclipse.parser.client.ast.ASTNode) IExpr(org.matheclipse.core.interfaces.IExpr) AST2Expr(org.matheclipse.core.convert.AST2Expr)

Aggregations

AST2Expr (org.matheclipse.core.convert.AST2Expr)21 IExpr (org.matheclipse.core.interfaces.IExpr)18 ASTNode (org.matheclipse.parser.client.ast.ASTNode)17 EvalEngine (org.matheclipse.core.eval.EvalEngine)8 IAST (org.matheclipse.core.interfaces.IAST)8 Parser (org.matheclipse.parser.client.Parser)7 IOException (java.io.IOException)5 IASTAppendable (org.matheclipse.core.interfaces.IASTAppendable)5 PatternMatcher (org.matheclipse.core.patternmatching.PatternMatcher)5 FileReader (java.io.FileReader)4 CSVFormat (org.apache.commons.csv.CSVFormat)4 CSVRecord (org.apache.commons.csv.CSVRecord)4 SyntaxError (org.matheclipse.parser.client.SyntaxError)4 OutputFormFactory (org.matheclipse.core.form.output.OutputFormFactory)3 IStringX (org.matheclipse.core.interfaces.IStringX)3 Extension (org.matheclipse.core.io.Extension)3 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)2 FlowControlException (org.matheclipse.core.eval.exception.FlowControlException)2 Context (org.matheclipse.core.expression.Context)2 ContextPath (org.matheclipse.core.expression.ContextPath)2