memgraph/tests/manual/antlr_parser.cpp
Marko Budiselic 2cee2cf480 youcompleteme config has been added to the repo
Summary: youcompleteme config has been added to the repo

Test Plan: manual

Reviewers: mislav.bradac

Reviewed By: mislav.bradac

Subscribers: pullbot, buda

Differential Revision: https://phabricator.memgraph.io/D53
2017-02-20 14:17:41 +01:00

30 lines
761 B
C++

#include <iostream>
#include "antlr4-runtime.h"
#include "query/frontend/opencypher/generated/CypherLexer.h"
#include "query/frontend/opencypher/generated/CypherParser.h"
using namespace antlropencypher;
using namespace antlr4;
int main(int, const char **a) {
const char *query = a[1];
ANTLRInputStream input(query);
CypherLexer lexer(&input);
CommonTokenStream tokens(&lexer);
tokens.fill();
for (auto token : tokens.getTokens()) {
std::cout << "TYPE: " << token->getType() << "; TEXT: " << token->getText()
<< "; STRING: " << token->toString() << std::endl;
}
CypherParser parser(&tokens);
tree::ParseTree *tree = parser.cypher();
std::cout << tree->toStringTree(&parser) << std::endl << std::endl;
return 0;
}