Search in sources :

Example 16 with Parser

use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.

the class ParserTestCase method testParser18.

public void testParser18() {
    try {
        Parser p = new Parser();
        ASTNode obj = p.parse("(a+b)[x]");
        assertEquals(obj.toString(), "Plus(a, b)[x]");
    } catch (Exception e) {
        e.printStackTrace();
        assertEquals("", e.getMessage());
    }
}
Also used : ASTNode(org.matheclipse.parser.client.ast.ASTNode) Parser(org.matheclipse.parser.client.Parser)

Example 17 with Parser

use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.

the class ParserTestCase method testParser4.

public void testParser4() {
    try {
        Parser p = new Parser();
        ASTNode obj = p.parse("$a=2");
        assertEquals(obj.toString(), "Set($a, 2)");
    } catch (Exception e) {
        e.printStackTrace();
        assertEquals("", e.getMessage());
    }
}
Also used : ASTNode(org.matheclipse.parser.client.ast.ASTNode) Parser(org.matheclipse.parser.client.Parser)

Example 18 with Parser

use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.

the class ParserTestCase method testParser5.

public void testParser5() {
    try {
        Parser p = new Parser();
        ASTNode obj = p.parse("4.7942553860420304E-1");
        assertEquals(obj.toString(), "4.7942553860420304E-1");
    } catch (Exception e) {
        e.printStackTrace();
        assertEquals("", e.getMessage());
    }
}
Also used : ASTNode(org.matheclipse.parser.client.ast.ASTNode) Parser(org.matheclipse.parser.client.Parser)

Example 19 with Parser

use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.

the class ParserTestCase method testParser2.

public void testParser2() {
    try {
        Parser p = new Parser();
        ASTNode obj = p.parse("a[][0][1]f[[x]]");
        assertEquals(obj.toString(), "Times(a()[0][1], Part(f, x))");
    } catch (Exception e) {
        e.printStackTrace();
        assertEquals("", e.getMessage());
    }
}
Also used : ASTNode(org.matheclipse.parser.client.ast.ASTNode) Parser(org.matheclipse.parser.client.Parser)

Example 20 with Parser

use of org.matheclipse.parser.client.Parser in project symja_android_library by axkr.

the class ParserTestCase method testParser1.

public void testParser1() {
    try {
        Parser p = new Parser();
        ASTNode obj = p.parse("Integrate[Sin[x]^2+3*x^4, x]");
        assertEquals(obj.toString(), "Integrate(Plus(Power(Sin(x), 2), Times(3, Power(x, 4))), x)");
    } catch (Exception e) {
        e.printStackTrace();
        assertEquals("", e.getMessage());
    }
}
Also used : ASTNode(org.matheclipse.parser.client.ast.ASTNode) Parser(org.matheclipse.parser.client.Parser)

Aggregations

Parser (org.matheclipse.parser.client.Parser)40 ASTNode (org.matheclipse.parser.client.ast.ASTNode)32 FileReader (java.io.FileReader)2 IOException (java.io.IOException)2 EvalEngine (org.matheclipse.core.eval.EvalEngine)2 IExpr (org.matheclipse.core.interfaces.IExpr)2 FunctionNode (org.matheclipse.parser.client.ast.FunctionNode)2 BufferedReader (java.io.BufferedReader)1 StringWriter (java.io.StringWriter)1 CSVFormat (org.apache.commons.csv.CSVFormat)1 CSVRecord (org.apache.commons.csv.CSVRecord)1 AST2Expr (org.matheclipse.core.convert.AST2Expr)1 EvalUtilities (org.matheclipse.core.eval.EvalUtilities)1 TimeConstrainedEvaluator (org.matheclipse.core.eval.TimeConstrainedEvaluator)1 WrongNumberOfArguments (org.matheclipse.core.eval.exception.WrongNumberOfArguments)1 OutputFormFactory (org.matheclipse.core.form.output.OutputFormFactory)1 IAST (org.matheclipse.core.interfaces.IAST)1 IStringX (org.matheclipse.core.interfaces.IStringX)1