Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

  • CCL is pronounced like the name Cecil (/ˈsiːsəl/)
  • Even though there are parser building tools like ANTLR, we are building our own because we don't want to deal with the overhead of an additional dependency at this time and we only want to do very simple parsing. Moreover, our parsing is merely designed to convert text to a Criteria object, which is what we use on the backend to handle queries. Its possible we may expand "language" support in Concourse in the future, at which point it might make sense to reconsider ANTLR or some other parsing tool.
  • The accept() method for the ValueState has a corner case where it must deal with the "at" keyword which signals that the next token is a timestamp, but doesn't actually transition to a new state
    • Code Block
      private boolean readyToAcceptTimestamp = false;
      public State accept(String input){
          if(readyToAcceptTimestamp){
              return at(input); //TODO need to convert the input string to a Timestamp object
          }
          else if(input.equalsIgnoreCase("at")){
              readyToAcceptTimeStamp = true;
              return this;
          }
          else{
              return value(Convert.stringToJava(input));
          }
      }
    • This approach also means that its possible for users to input a CCL statement with a hanging "at" that'll actually be parsed correctly (i.e. key = value at)

...

TaskNotes
Define Grammar
Add accept() method to each State 
Move splitStringByDelimiterAndRespectQuotes() method to concourse project Create a util class called "Strings" in org.cinchapi.concourse.util package. This method must respect single and double quotes equally. Right now the current implementation in the concourse-import project only respects double quotes.
Add parse method to Criteria class See the above psuedocode. There are lots of error cases to handle (i.e. NullPointerException if the stack is empty prematurely, too many elements being on the stack meaning that there were parenthesis in the wrong place, exceptions thrown from states when they can't accept certain input, etc)
Unit testsUnit tests should focus on whether input was correctly parsed. In almost all cases, the Criteria that is parsed should have a toString output that matches the original input