Package de.tuhrig.thofu.parser

Examples of de.tuhrig.thofu.parser.DefaultParser


    defaultSyntax.addActionListener(new ActionListener() {
     
      @Override
      public void actionPerformed(ActionEvent e) {
     
        interpreter.setParser(new DefaultParser());
       
        repl.setSyntax(SyntaxConstants.SYNTAX_STYLE_LISP);
        editor.setSyntax(SyntaxConstants.SYNTAX_STYLE_LISP);
       
        log.log("Default syntax");
View Full Code Here


  @Test
  public void cons() {

    LObject o;

    o = cons.run(environment, new DefaultParser().parse("(1 2)"));
    Assert.assertEquals("'(1 . 2)", o.toString());
    Assert.assertTrue(o instanceof LTupel);
    Assert.assertTrue(((LTupel) o).getFirst() instanceof LNumber);
    Assert.assertTrue(((LTupel) o).getRest() instanceof LNumber);

    o = cons.run(environment, new DefaultParser().parse("(1 null)"));
    Assert.assertEquals("'(1)", o.toString());
    Assert.assertTrue(o instanceof LTupel);
    Assert.assertTrue(((LTupel) o).getFirst() instanceof LNumber);
    Assert.assertTrue(((LTupel) o).getRest() instanceof LNull);

    o = cons.run(environment, new DefaultParser().parse("(null 1)"));
    Assert.assertEquals("'(() . 1)", o.toString());
    Assert.assertTrue(o instanceof LTupel);
    Assert.assertTrue(((LTupel) o).getFirst() instanceof LNull);
    Assert.assertTrue(((LTupel) o).getRest() instanceof LNumber);

    o = cons.run(environment, new DefaultParser().parse("((cons 1 2) 3)"));
    Assert.assertEquals("'((1 . 2) . 3)", o.toString());
    Assert.assertTrue(o instanceof LTupel);
    Assert.assertTrue(((LTupel) o).getFirst() instanceof LTupel);
    Assert.assertTrue(((LTupel) o).getRest() instanceof LNumber);
  }
View Full Code Here

TOP

Related Classes of de.tuhrig.thofu.parser.DefaultParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.