Search in sources :

Example 6 with Statement

use of st.gravel.support.compiler.ast.Statement in project gravel by gravel-st.

the class ParserTest method testParseKeywordBinaryUnaryExpression4.

@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());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Example 7 with Statement

use of st.gravel.support.compiler.ast.Statement in project gravel by gravel-st.

the class ParserTest method testParse2ArgBlockNoTemps.

@Test
public void testParse2ArgBlockNoTemps() {
    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 :b | \na foo.\nb bar]", (String) _node.prettySourceString());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Example 8 with Statement

use of st.gravel.support.compiler.ast.Statement in project gravel by gravel-st.

the class ParserTest method testParseKeywordBinaryUnaryExpression1.

@Test
public void testParseKeywordBinaryUnaryExpression1() {
    final Statement _node;
    _node = Parser.factory.source_("2 bar + 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 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());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Example 9 with Statement

use of st.gravel.support.compiler.ast.Statement in project gravel by gravel-st.

the class ParserTest method testParseUnaryBlockWithTemps.

@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());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Example 10 with Statement

use of st.gravel.support.compiler.ast.Statement in project gravel by gravel-st.

the class ParserTest method testParse2ArgBlockNoTempsDotEnd.

@Test
public void testParse2ArgBlockNoTempsDotEnd() {
    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 :b | \na foo.\nb bar]", (String) _node.prettySourceString());
}
Also used : Statement(st.gravel.support.compiler.ast.Statement) Test(org.junit.Test)

Aggregations

Statement (st.gravel.support.compiler.ast.Statement)34 Test (org.junit.Test)21 VariableDeclarationNode (st.gravel.support.compiler.ast.VariableDeclarationNode)5 BinaryMessageNode (st.gravel.support.compiler.ast.BinaryMessageNode)3 Expression (st.gravel.support.compiler.ast.Expression)3 KeywordMessageNode (st.gravel.support.compiler.ast.KeywordMessageNode)3 MessageNode (st.gravel.support.compiler.ast.MessageNode)3 UnaryMessageNode (st.gravel.support.compiler.ast.UnaryMessageNode)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 SequenceNode (st.gravel.support.compiler.ast.SequenceNode)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 IntermediateStatement (st.gravel.support.compiler.ast.IntermediateStatement)1 PragmaNode (st.gravel.support.compiler.ast.PragmaNode)1 TypeNode (st.gravel.support.compiler.ast.TypeNode)1 VariableNode (st.gravel.support.compiler.ast.VariableNode)1 VariableScopeAnalyzerState (st.gravel.support.compiler.ast.VariableScopeAnalyzerState)1