Repository: taozhi8833998/node-sql-parser

Issue:
astify (sqlite) exception: Expected "#", "*", "--", "/*", or [ \\t\\n\\r] but "\\"" found.
**Describe the bug**
When calling astify for a valid sqlite query, we get an exception.

**Database Engine**
sqlite

**To Reproduce**
```
const sql_orig = "SELECT \"m\".\"model_family\", COUNT(*) AS \"total_mentions\" FROM \"brand_mentions\" AS \"bm\" INNER JOIN \"model_responses\" AS \"mr\" ON \"bm\".\"response_id\" = \"mr\".\"response_id\" INNER JOIN \"models\" AS \"m\" ON \"mr\".\"model_id\" = \"m\".\"model_id\" WHERE \"bm\".\"brand_name\" = 'ketch' AND \"m\".\"model_family\" IN ('a', 'b', 'c') AND \"mr\".\"error_occurred\" = 0 GROUP BY \"m\".\"model_family\" LIMIT 100";

const SqlParse = require('node-sql-parser');
const parser = new SqlParse.Parser();

const ast = parser.astify(sql_orig, {database: 'sqlite'});
```

**Exception**
Expected "#", "*", "--", "/*", or [ \\t\\n\\r] but "\\"" found.


Discussion:

Solution patch:
diff --git a/pegjs/sqlite.pegjs b/pegjs/sqlite.pegjs
index 8edbcd1..b65fd3f 100644
--- a/pegjs/sqlite.pegjs
+++ b/pegjs/sqlite.pegjs
@@ -14,6 +14,7 @@
     'CASE': true,
     'CREATE': true,
     'CONTAINS': true,
+    'COUNT': true,
     'CURRENT_DATE': true,
     'CURRENT_TIME': true,
     'CURRENT_TIMESTAMP': true,
@@ -2590,13 +2591,13 @@ literal_string
         value: ca.join('')
       };
   }
-  / ca:("'" single_char* "'") {
+  / ca:("'" single_char* "'") __ !(DOT / LPAREN) {
       return {
         type: 'single_quote_string',
         value: ca[1].join('')
       };
     }
-  / ca:("\"" single_quote_char* "\"") {
+  / ca:("\"" single_quote_char* "\"") __ !(DOT / LPAREN) {
       return {
         type: 'double_quote_string',
         value: ca[1].join('')



Test patch:
diff --git a/test/sqlite.spec.js b/test/sqlite.spec.js
index 08a1148..544a257 100644
--- a/test/sqlite.spec.js
+++ b/test/sqlite.spec.js
@@ -152,6 +152,8 @@ describe('sqlite', () => {
     expect(getParsedSql(sql)).to.be.equal('SELECT "column_name" FROM "table_name" WHERE "type" = "abc"')
     sql = "SELECT partition from table_name where partition like '%'"
     expect(getParsedSql(sql)).to.be.equal(`SELECT "partition" FROM "table_name" WHERE "partition" LIKE '%'`)
+    sql = `SELECT "m"."model_family", COUNT(*) AS "total_mentions" FROM "brand_mentions" AS "bm" INNER JOIN "model_responses" AS "mr" ON "bm"."response_id" = "mr"."response_id" INNER JOIN "models" AS "m" ON "mr"."model_id" = "m"."model_id" WHERE "bm"."brand_name" = 'ketch' AND "m"."model_family" IN ('a', 'b', 'c') AND "mr"."error_occurred" = 0 GROUP BY "m"."model_family" LIMIT 100`
+    expect(getParsedSql(sql)).to.be.equal(`SELECT "m"."model_family", COUNT(*) AS "total_mentions" FROM "brand_mentions" AS "bm" INNER JOIN "model_responses" AS "mr" ON "bm"."response_id" = "mr"."response_id" INNER JOIN "models" AS "m" ON "mr"."model_id" = "m"."model_id" WHERE "bm"."brand_name" = 'ketch' AND "m"."model_family" IN ('a', 'b', 'c') AND "mr"."error_occurred" = 0 GROUP BY "m"."model_family" LIMIT 100`)
   })
 
   it('should support sqlify autoincrement to other db', () => {