Package st.gravel.support.compiler.ast

Examples of st.gravel.support.compiler.ast.Statement


    assertEquals((String) "2 bar + 7\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString());
  }

  @Test
  public void testParseKeywordBinaryUnaryExpression2() {
    final Statement _node;
    _node = Parser.factory.source_("2 bar foo: 7 bar: 4 baz foo: 2 + 1 boo: 3 foo + 2 roo: 3 + 2 foo noo: 3 hoo + 2 joo").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), KeywordMessageNode.factory));
    assertEquals((String) "2 bar\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString());
  }
View Full Code Here


    assertEquals((String) "2 bar\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString());
  }

  @Test
  public void testParseKeywordBinaryUnaryExpression3() {
    final Statement _node;
    _node = Parser.factory.source_("2 + 7 foo: 7 bar: 4 baz foo: 2 + 1 boo: 3 foo + 2 roo: 3 + 2 foo noo: 3 hoo + 2 joo").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), KeywordMessageNode.factory));
    assertEquals((String) "2 + 7\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString());
  }
View Full Code Here

    assertEquals((String) "2 + 7\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString());
  }

  @Test
  public void testParseKeywordBinaryUnaryExpression4() {
    final Statement _node;
    _node = Parser.factory.source_("2 + 7 bar foo: 7 bar: 4 baz foo: 2 + 1 boo: 3 foo + 2 roo: 3 + 2 foo noo: 3 hoo + 2 joo").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), KeywordMessageNode.factory));
    assertEquals((String) "2 + 7 bar\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString());
  }
View Full Code Here

    assertEquals((String) "2 + 7 bar\n\tfoo: 7\n\tbar: 4 baz\n\tfoo: 2 + 1\n\tboo: 3 foo + 2\n\troo: 3 + 2 foo\n\tnoo: 3 hoo + 2 joo", (String) _node.prettySourceString());
  }

  @Test
  public void testParseKeywordExpression() {
    final Statement _node;
    _node = Parser.factory.source_(" 3 foo: 7 bar: 4 ").parseExpression();
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) KeywordMessageNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((String) "3 foo: 7 bar: 4", (String) _node.prettySourceString());
  }
View Full Code Here

    assertEquals(-123, (int) _node.value());
  }

  @Test
  public void testParseNestedExpression() {
    final Statement _node;
    _node = Parser.factory.source_(" 3 + (4 + 5) ").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BinaryMessageNode.factory));
    assertEquals((String) "3 + (4 + 5)", (String) _node.prettySourceString());
  }
View Full Code Here

    assertEquals((String) "3 + (4 + 5)", (String) _node.prettySourceString());
  }

  @Test
  public void testParseNilaryBlockNoTemps() {
    final Statement _node;
    _node = Parser.factory.source_("[1 foo. 2 bar]").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "\n[\n1 foo.\n2 bar]", (String) _node.prettySourceString());
  }
View Full Code Here

    assertEquals((String) "\n[\n1 foo.\n2 bar]", (String) _node.prettySourceString());
  }

  @Test
  public void testParseNilaryBlockWithTemps() {
    final Statement _node;
    _node = Parser.factory.source_("[| a b | a foo. b bar]").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "\n[\n| a b |\na foo.\nb bar]", (String) _node.prettySourceString());
  }
View Full Code Here

    assertEquals((String) "+ arg {String | Nil}\n\t^bar", (String) _node.prettySourceString());
  }

  @Test
  public void testParseReturn() {
    final Statement _node;
    _node = Parser.factory.source_("[:a | ^a]").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "[:a | ^a]", (String) _node.prettySourceString());
  }
View Full Code Here

    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.value(), st.gravel.core.Symbol.value("foo")));
  }

  @Test
  public void testParseUnaryBlockNoTemps() {
    final Statement _node;
    _node = Parser.factory.source_("[:a | a foo. 2 bar]").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "\n[:a | \na foo.\n2 bar]", (String) _node.prettySourceString());
  }
View Full Code Here

    assertEquals((String) "\n[:a | \na foo.\n2 bar]", (String) _node.prettySourceString());
  }

  @Test
  public void testParseUnaryBlockWithTemps() {
    final Statement _node;
    _node = Parser.factory.source_("[:a | | b | a foo. b bar]").parseExpression();
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), BlockNode.factory));
    assertEquals((String) "\n[:a | \n| b |\na foo.\nb bar]", (String) _node.prettySourceString());
  }
View Full Code Here

TOP

Related Classes of st.gravel.support.compiler.ast.Statement

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.