-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP #122 support CQL comments #139
WIP #122 support CQL comments #139
Conversation
@@ -38,7 +38,7 @@ object CqlParser extends JavaTokenParsers | |||
parse(phrase(selectStatement <~ semicolon.?), input) | |||
|
|||
def parseDML(input: String): ParseResult[DataManipulation] = | |||
parse(phrase(dmlDefinition <~ semicolon.?), input) | |||
parse(phrase(dmlDefinition <~ semicolon.? <~ comment.?), input) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments wont't be supported inside queries. Instead they should be supported inside schema.cql file only.
def comment: Parser[Comment] = { | ||
import Comment._ | ||
|
||
def str = "[0-9a-fA-F]".r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sure we have this regex defined somewhere else we can reuse
def str = "[0-9a-fA-F]".r | ||
def dash = s"--$str".r ^^ SingleLineDash | ||
def slash = s"//$str".r ^^ SingleLineSlash | ||
def multi = s"/*$str*/".r ^^ MultiLine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work, the regex won't allow new lines.
Maybe write a test case first
|
||
// Comments Parser | ||
protected override val whiteSpace = """(\s|//.*|--.*|(?m)/\*(\*(?!/)|[^*])*\*/)+""".r | ||
def comment = ident+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line used?
@@ -74,11 +74,15 @@ object CqlParser extends JavaTokenParsers | |||
|
|||
str | blob | uuid | floats | int | boolean | nullConst | |||
} | |||
|
|||
// Comments Parser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment can be something line "Ignores comments"
user_time time, | ||
user_status boolean, | ||
user_balance double, | ||
user_trans_id bigint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding test for comments similar to those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the same file CreateTableParserTest.scala ??
#122