Skip to content
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

First Implementation of GQL parser #11

Merged
merged 4 commits into from
Sep 21, 2018
Merged

First Implementation of GQL parser #11

merged 4 commits into from
Sep 21, 2018

Conversation

dutor
Copy link
Contributor

@dutor dutor commented Sep 9, 2018

No description provided.

@dutor dutor closed this Sep 9, 2018
@dutor dutor reopened this Sep 9, 2018
@dutor
Copy link
Contributor Author

dutor commented Sep 9, 2018

jenkins please

@nebula-community-bot
Copy link
Member

Can one of the admins verify this patch?

@dutor dutor closed this Sep 9, 2018
@dutor dutor reopened this Sep 9, 2018
@dutor
Copy link
Contributor Author

dutor commented Sep 9, 2018

jenkins please

@nebula-community-bot
Copy link
Member

Build failed.

1 similar comment
@nebula-community-bot
Copy link
Member

Build failed.

@sherman-the-tank sherman-the-tank self-requested a review September 11, 2018 00:59
@sherman-the-tank sherman-the-tank added the do not review PR: not ready for the code review yet label Sep 11, 2018
@nebula-community-bot
Copy link
Member

Build failed.

@dutor dutor requested review from sherman-the-tank and removed request for sherman-the-tank September 19, 2018 09:45
@dutor dutor added feature and removed do not review PR: not ready for the code review yet labels Sep 19, 2018
@nebula-community-bot
Copy link
Member

Build succeeded.

@nebula-community-bot
Copy link
Member

Build succeeded.

@sherman-the-tank
Copy link
Member

Awesome work! I'll take a look this morning on the train

Copy link
Member

@sherman-the-tank sherman-the-tank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highly suggest to separate AstTypes into multiple files

@@ -0,0 +1,1148 @@
/* Copyright (c) 2018 - present, VE Software Inc. All rights reserved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to separate this file into multiple smaller files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this makes sense. But I am working on the INSERT and UPDATE syntax, I will get this done after that.

@nebula-community-bot
Copy link
Member

Build succeeded.

1 similar comment
@nebula-community-bot
Copy link
Member

Build succeeded.

Copy link
Member

@sherman-the-tank sherman-the-tank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!! LGTM

Please address the minor comments before committing

TEST(Parser, Go) {
{
GQLParser parser;
std::string query = "GO FROM 1 AS person";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this is the very early version. With more code added, we might want to check the correctness of the parsing results. It would be helpful to have a TODO comment here to remind ourselves

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, later we shall verify the validness of the parsing tree by inspecting the internal structures.

{ID} { yylval->strval = new std::string(yytext, yyleng); return TokenType::SYMBOL; }

[0-9]+ { yylval->intval = ::atoll(yytext); return TokenType::INTEGER; }
[0-9]+[Uu][Ll]? { yylval->intval = ::atoll(yytext); return TokenType::UINTEGER; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to support UInt. We will treat all integers long, so we don't need ""[Uu]" and "[Ll]" here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems an open question, since there would be some annoying issues without the support of unsigned integers. We could discuss about this later。

%parse-param { vesoft::Statement** statement }

%code requires {
#include <iostream>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use Cord instead of sstream :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I haven't grasped the use occasion of Cord. Besides, I intend to see if we could feed a normal string buffer to the scanner.

virtual std::string toString() const {
return "";
}
using ReturnType = boost::variant<int64_t, uint64_t, double, bool, std::string>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Styling: Would be nice to have a blank line above

static int64_t asInt(const ReturnType &value) {
return boost::get<int64_t>(value);
}
static uint64_t asUInt(const ReturnType &value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to support UInt. Objection?

In addition, added support for hexadecimal and octal numbers.
@nebula-community-bot
Copy link
Member

Build succeeded.

1 similar comment
@nebula-community-bot
Copy link
Member

Build succeeded.

@nebula-community-bot
Copy link
Member

Build succeeded.

Copy link
Member

@sherman-the-tank sherman-the-tank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome!!

@dutor dutor merged commit 23d44a3 into vesoft-inc:master Sep 21, 2018
@dutor dutor deleted the parser branch September 21, 2018 07:10
yixinglu referenced this pull request in yixinglu/nebula Feb 16, 2020
* First Implementation of GQL parser

* Address @sherman-the-tank 's comments

* Implement syntax of UPDATE/INSERT

In addition, added support for hexadecimal and octal numbers.

* Reserve space on the buffer in `toString`
tong-hao pushed a commit to tong-hao/nebula that referenced this pull request Jun 1, 2021
* First Implementation of GQL parser

* Address @sherman-the-tank 's comments

* Implement syntax of UPDATE/INSERT

In addition, added support for hexadecimal and octal numbers.

* Reserve space on the buffer in `toString`
@zedzhu zedzhu mentioned this pull request Nov 8, 2021
liwenhui-soul pushed a commit to liwenhui-soul/nebula that referenced this pull request May 10, 2022
Co-authored-by: Yee <2520865+yixinglu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants