From 1e23a6a0d1d2a7a9c1ab45218312880b2b70917d Mon Sep 17 00:00:00 2001 From: Toby Mao Date: Wed, 13 Mar 2019 15:39:47 -0700 Subject: [PATCH] Revert "Add in slash comment functionality" This reverts commit 170010e7d709f2145169d23482d006dc56856256. --- sqlparse/keywords.py | 4 ++-- tests/files/slashcomment.sql | 5 ----- tests/test_split.py | 16 ---------------- 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 tests/files/slashcomment.sql diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py index 761d14ea..7ad74baf 100644 --- a/sqlparse/keywords.py +++ b/sqlparse/keywords.py @@ -22,10 +22,10 @@ def is_keyword(value): SQL_REGEX = { 'root': [ - (r'(--|//|# )\+.*?(\r\n|\r|\n|$)', tokens.Comment.Single.Hint), + (r'(--|# )\+.*?(\r\n|\r|\n|$)', tokens.Comment.Single.Hint), (r'/\*\+[\s\S]*?\*/', tokens.Comment.Multiline.Hint), - (r'(--|//|# ).*?(\r\n|\r|\n|$)', tokens.Comment.Single), + (r'(--|# ).*?(\r\n|\r|\n|$)', tokens.Comment.Single), (r'/\*[\s\S]*?\*/', tokens.Comment.Multiline), (r'(\r\n|\r|\n)', tokens.Newline), diff --git a/tests/files/slashcomment.sql b/tests/files/slashcomment.sql deleted file mode 100644 index 90e3089d..00000000 --- a/tests/files/slashcomment.sql +++ /dev/null @@ -1,5 +0,0 @@ -select * from user; -//select * from host; -select * from user; -select * // foo; -from foo; diff --git a/tests/test_split.py b/tests/test_split.py index ccb84a89..a93e3d40 100644 --- a/tests/test_split.py +++ b/tests/test_split.py @@ -52,22 +52,6 @@ def test_split_dashcomments_eol(s): assert len(stmts) == 1 -def test_split_slashcomments(load_file): - sql = load_file('slashcomment.sql') - stmts = sqlparse.parse(sql) - assert len(stmts) == 3 - assert ''.join(str(q) for q in stmts) == sql - - -@pytest.mark.parametrize('s', ['select foo; // comment\n', - 'select foo; // comment\r', - 'select foo; // comment\r\n', - 'select foo; // comment']) -def test_split_slashcomments_eol(s): - stmts = sqlparse.parse(s) - assert len(stmts) == 1 - - def test_split_begintag(load_file): sql = load_file('begintag.sql') stmts = sqlparse.parse(sql)