From 973eab9a08adb32c2c7bc5fe94c1c4a32b8232c9 Mon Sep 17 00:00:00 2001 From: Matts966 Date: Fri, 22 Apr 2022 02:31:08 +0900 Subject: [PATCH] Fix missing comments --- .bazelversion | 2 +- .gitignore | 4 ++++ WORKSPACE | 16 ++++++++++++++++ zetasql/public/sql_formatter.cc | 1 - 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.bazelversion b/.bazelversion index fcdb2e10..ee74734a 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.0.0 +4.1.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..85703949 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +/external +/bazel-* +/compile_commands.json +/.cache/ diff --git a/WORKSPACE b/WORKSPACE index e849df07..bec816cd 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -98,3 +98,19 @@ git_repository( remote = "https://github.com/gflags/gflags.git", tag = "v2.2.2" ) + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# Hedron's Compile Commands Extractor for Bazel +# https://github.com/hedronvision/bazel-compile-commands-extractor +http_archive( + name = "hedron_compile_commands", + + # Replace the commit hash in both places (below) with the latest, rather than using the stale one here. + # Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README). + url = "https://github.com/hedronvision/bazel-compile-commands-extractor/archive/af9af15f7bc16fc3e407e2231abfcb62907d258f.tar.gz", + strip_prefix = "bazel-compile-commands-extractor-af9af15f7bc16fc3e407e2231abfcb62907d258f", + # When you first run this tool, it'll recommend a sha256 hash to put here with a message like: "DEBUG: Rule 'hedron_compile_commands' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = ..." +) +load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup") +hedron_compile_commands_setup() diff --git a/zetasql/public/sql_formatter.cc b/zetasql/public/sql_formatter.cc index 58c4a0a0..543c0fcf 100644 --- a/zetasql/public/sql_formatter.cc +++ b/zetasql/public/sql_formatter.cc @@ -61,7 +61,6 @@ absl::Status FormatSql(absl::string_view sql, std::string* formatted_sql) { GetParseTokens(options, &location, &parse_tokens); if (token_status.ok()) { for (const auto& parse_token : parse_tokens) { - if (parse_token.IsEndOfInput()) break; if (parse_token.IsComment()) { comments.push_back(std::make_pair(parse_token.GetSQL(), parse_token.GetLocationRange().start())); }