Search in sources :

Example 1 with StringLiteralNode

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

the class ParserTest method testParseString2.

@Test
public void testParseString2() {
    final StringLiteralNode _node;
    _node = ((StringLiteralNode) Parser.factory.source_("\'from\'\'age\'").parseExpression());
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), StringLiteralNode.factory));
    assertTrue(st.gravel.support.jvm.StringExtensions.equals_(_node.value(), "from\'age"));
}
Also used : StringLiteralNode(st.gravel.support.compiler.ast.StringLiteralNode) Test(org.junit.Test)

Example 2 with StringLiteralNode

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

the class MethodNode method primitiveIn_.

public String[] primitiveIn_(final String _className) {
    final PragmaNode _pragma;
    final Expression _argument;
    final ArrayLiteralNode _arrayNode;
    _pragma = this.primitivePragma();
    if (_pragma == null) {
        return null;
    }
    _argument = _pragma.expression().argument();
    if (_argument.isStringLiteralNode()) {
        return MethodNode.this.localPrimitiveIn_nameNode_(_className, ((StringLiteralNode) _argument));
    }
    if (!_argument.isArrayLiteralNode()) {
        return null;
    }
    _arrayNode = ((ArrayLiteralNode) _argument);
    return st.gravel.support.jvm.ArrayExtensions.collect_(_arrayNode.value(), ((st.gravel.support.jvm.Block1<String, Object>) (new st.gravel.support.jvm.Block1<String, Object>() {

        @Override
        public String value_(final Object _e) {
            final String _str;
            _str = ((String) _e);
            return (String) _str;
        }
    })));
}
Also used : PragmaNode(st.gravel.support.compiler.ast.PragmaNode) Expression(st.gravel.support.compiler.ast.Expression) ArrayLiteralNode(st.gravel.support.compiler.ast.ArrayLiteralNode) StringLiteralNode(st.gravel.support.compiler.ast.StringLiteralNode)

Example 3 with StringLiteralNode

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

the class ParserTest method testParseString1.

@Test
public void testParseString1() {
    final StringLiteralNode _node;
    _node = ((StringLiteralNode) Parser.factory.source_("\'fromage\'").parseExpression());
    assertTrue(st.gravel.support.jvm.ObjectExtensions.equals_(_node.factory(), StringLiteralNode.factory));
    assertTrue(st.gravel.support.jvm.StringExtensions.equals_(_node.value(), "fromage"));
}
Also used : StringLiteralNode(st.gravel.support.compiler.ast.StringLiteralNode) Test(org.junit.Test)

Aggregations

StringLiteralNode (st.gravel.support.compiler.ast.StringLiteralNode)3 Test (org.junit.Test)2 ArrayLiteralNode (st.gravel.support.compiler.ast.ArrayLiteralNode)1 Expression (st.gravel.support.compiler.ast.Expression)1 PragmaNode (st.gravel.support.compiler.ast.PragmaNode)1