Examples of ArrayLiteral


Examples of com.google.minijoe.compiler.ast.ArrayLiteral

      }
    }

    readToken(Token.OPERATOR_CLOSESQUARE);

    return new ArrayLiteral(Util.vectorToExpressionArray(arrayElements));
  }
View Full Code Here

Examples of com.google.minijoe.compiler.ast.ArrayLiteral

  }

  public void testArrayLiteral() throws CompilerException {
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                }
            )
        ),
        "[];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    null
                }
            )
        ),
        "[,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0)
                }
            )
        ),
        "[0.0];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    null,
                    new NumberLiteral(0.0)
                }
            )
        ),
        "[,0.0];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0)
                }
            )
        ),
        "[0.0,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null
                }
            )
        ),
        "[0.0,,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null,
                    new NumberLiteral(1.0)
                }
            )
        ),
        "[0.0,,1.0];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null,
                    new NumberLiteral(1.0)
                }
            )
        ),
        "[0.0,,1.0,];"
    );
    assertParserOutput(
        new ExpressionStatement(
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(0.0),
                    null,
                    new NumberLiteral(1.0),
                    null
View Full Code Here

Examples of com.google.minijoe.compiler.ast.ArrayLiteral

  public void testForInStatement() throws CompilerException {
    assertParserOutput(
        new ForInStatement(
            new Identifier("foo"),
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(1.0),
                    new NumberLiteral(2.0),
                    new NumberLiteral(3.0),
                    new NumberLiteral(4.0)
                }
            ),
            new EmptyStatement()
        ),
        "for (foo in [1, 2, 3, 4]);"
    );
    assertParserOutput(
        new ForInStatement(
            new PropertyExpression(
                new Identifier("foo"),
                new StringLiteral("bar")
            ),
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(1.0),
                    new NumberLiteral(2.0),
                    new NumberLiteral(3.0),
                    new NumberLiteral(4.0)
                }
            ),
            new EmptyStatement()
        ),
        "for (foo.bar in [1, 2, 3, 4]);"
    );
    assertParserOutput(
        new ForInStatement(
            new VariableDeclaration(
                new Identifier("foo"),
                null
            ),
            new ArrayLiteral(
                new Expression[] {
                    new NumberLiteral(1.0),
                    new NumberLiteral(2.0),
                    new NumberLiteral(3.0),
                    new NumberLiteral(4.0)
View Full Code Here

Examples of org.datanucleus.store.mapped.expression.ArrayLiteral

    {
        if (containerIsStoredInSingleColumn())
        {
            throw new NucleusUserException(LOCALISER.msg("041026", mmd.getFullFieldName())).setFatal();
        }
        return new ArrayLiteral(qs, this, value);
    }
View Full Code Here

Examples of org.datanucleus.store.rdbms.sql.expression.ArrayLiteral

            {
                Class elemCls = clr.classForName(arrExpr.getJavaTypeMapping().getType()).getComponentType();
                elemExpr = stmt.getQueryGenerator().bindVariable((UnboundExpression)elemExpr, elemCls);
            }

            ArrayLiteral lit = (ArrayLiteral)expr;
            Object array = lit.getValue();
            JavaTypeMapping m = exprFactory.getMappingForType(boolean.class, true);
            if (array == null || Array.getLength(array) == 0)
            {
                return exprFactory.newLiteral(stmt, m, true).eq(exprFactory.newLiteral(stmt, m, false));
            }

            // TODO If elemExpr is a parameter and collExpr is derived from a parameter ?
            BooleanExpression bExpr = null;
            List<SQLExpression> elementExprs = lit.getElementExpressions();
            for (int i=0; i<elementExprs.size(); i++)
            {
                SQLExpression arrElemExpr = elementExprs.get(i);
                if (bExpr == null)
                {
View Full Code Here

Examples of org.dtk.analysis.script.node.ArrayLiteral

    ce.setErrorReporter(errorReporter);
   
    Parser p = new Parser(ce, errorReporter);
    ScriptOrFnNode ast = p.parse(scriptSource, "script", 0);
   
    return new ArrayLiteral(ast.getFirstChild().getFirstChild().getFirstChild());
  }
View Full Code Here

Examples of org.dtk.analysis.script.node.ArrayLiteral

    }
  }
 
  @Test
  public void canParseEmptyLiteralNode() throws InvalidLiteralNode {   
    ArrayLiteral lit = getLiteralNode("[]");
    assertEquals(Collections.EMPTY_LIST, lit.getValueList());
 
View Full Code Here

Examples of org.dtk.analysis.script.node.ArrayLiteral

    assertEquals(Collections.EMPTY_LIST, lit.getValueList());
 

  @Test
  public void detectsStringValuesInArrayLiteral() throws InvalidLiteralNode 
    ArrayLiteral lit = getLiteralNode("[ 'value', 'other' ]");   
    assertEquals(Arrays.asList("value","other"), lit.getValueList());       
  }
View Full Code Here

Examples of org.dtk.analysis.script.node.ArrayLiteral

    assertEquals(Arrays.asList("value","other"), lit.getValueList());       
  }
 
  @Test
  public void detectsBooleanValuesInArrayLiteral() throws InvalidLiteralNode 
    ArrayLiteral lit = getLiteralNode("[ true, false]");   
    assertEquals(Arrays.asList(Boolean.TRUE, Boolean.FALSE), lit.getValueList());       
  }
View Full Code Here

Examples of org.dtk.analysis.script.node.ArrayLiteral

    assertEquals(Arrays.asList(Boolean.TRUE, Boolean.FALSE), lit.getValueList());       
  }
 
  @Test
  public void detectsNumberValuesInArrayLiteral() throws InvalidLiteralNode {         
    ArrayLiteral lit = getLiteralNode("[0, 1]");   
    assertEquals(Arrays.asList(0.0, 1.0), lit.getValueList());       
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.