Search in sources :

Example 1 with PostfixNotationSymbol

use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.

the class ConcourseCompilerTest method testParseCclValueWithoutQuotesAnd.

@Test
public void testParseCclValueWithoutQuotesAnd() {
    String ccl = "name = jeff nelson and favorite_player != Lebron James";
    Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
    Assert.assertEquals(3, symbols.size());
    for (int i = 0; i < 2; ++i) {
        ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
        Assert.assertTrue(expr.values().get(0).value().toString().contains(" "));
    }
}
Also used : PostfixNotationSymbol(com.cinchapi.ccl.grammar.PostfixNotationSymbol) ExpressionSymbol(com.cinchapi.ccl.grammar.ExpressionSymbol) Test(org.junit.Test)

Example 2 with PostfixNotationSymbol

use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.

the class ConcourseCompilerTest method testParseCclValueAndTimestampPhraseWithoutQuotesAnd.

@Test
public void testParseCclValueAndTimestampPhraseWithoutQuotesAnd() {
    String ccl = "name = jeff nelson on last christmas day and favorite_player != Lebron James during last week";
    Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
    Assert.assertEquals(3, symbols.size());
    for (int i = 0; i < 2; ++i) {
        ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
        Assert.assertTrue(expr.values().get(0).value().toString().contains(" "));
        // this means a
        Assert.assertNotEquals(0, expr.raw().timestamp());
    // timestamp was
    // parsed
    }
}
Also used : PostfixNotationSymbol(com.cinchapi.ccl.grammar.PostfixNotationSymbol) ExpressionSymbol(com.cinchapi.ccl.grammar.ExpressionSymbol) Test(org.junit.Test)

Example 3 with PostfixNotationSymbol

use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.

the class ConcourseCompilerTest method testReproGH_113.

@Test
public void testReproGH_113() {
    String ccl = "location = \"Atlanta (HQ)\"";
    Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
    Assert.assertEquals(1, symbols.size());
    ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
    Assert.assertEquals("Atlanta (HQ)", expr.raw().values().get(0));
}
Also used : PostfixNotationSymbol(com.cinchapi.ccl.grammar.PostfixNotationSymbol) ExpressionSymbol(com.cinchapi.ccl.grammar.ExpressionSymbol) Test(org.junit.Test)

Example 4 with PostfixNotationSymbol

use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.

the class ConcourseCompilerTest method testParseCclValueAndTimestampPhraseWithoutQuotes.

@Test
public void testParseCclValueAndTimestampPhraseWithoutQuotes() {
    String ccl = "name = jeff nelson on last christmas day";
    Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
    ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
    Assert.assertEquals("jeff nelson", expr.values().get(0).value());
    // this means a
    Assert.assertNotEquals(0, expr.raw().timestamp());
// timestamp was
// parsed
}
Also used : PostfixNotationSymbol(com.cinchapi.ccl.grammar.PostfixNotationSymbol) ExpressionSymbol(com.cinchapi.ccl.grammar.ExpressionSymbol) Test(org.junit.Test)

Example 5 with PostfixNotationSymbol

use of com.cinchapi.ccl.grammar.PostfixNotationSymbol in project concourse by cinchapi.

the class ConcourseCompilerTest method testParseCclTimestampBasicPhrase.

@Test
public void testParseCclTimestampBasicPhrase() {
    String ccl = "name = jeff at \"now\"";
    Queue<PostfixNotationSymbol> symbols = ConcourseCompiler.get().arrange((ConditionTree) ConcourseCompiler.get().parse(ccl));
    ExpressionSymbol expr = (ExpressionSymbol) symbols.poll();
    // this means a
    Assert.assertNotEquals(0, expr.raw().timestamp());
// timestamp was
// parsed
}
Also used : PostfixNotationSymbol(com.cinchapi.ccl.grammar.PostfixNotationSymbol) ExpressionSymbol(com.cinchapi.ccl.grammar.ExpressionSymbol) Test(org.junit.Test)

Aggregations

ExpressionSymbol (com.cinchapi.ccl.grammar.ExpressionSymbol)12 PostfixNotationSymbol (com.cinchapi.ccl.grammar.PostfixNotationSymbol)12 Test (org.junit.Test)12 KeySymbol (com.cinchapi.ccl.grammar.KeySymbol)2 OperatorSymbol (com.cinchapi.ccl.grammar.OperatorSymbol)2 ValueSymbol (com.cinchapi.ccl.grammar.ValueSymbol)2