From bb00ffa23f9b6ef0663af9c6b10fe50226503432 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 2 Jun 2024 22:12:34 +0200 Subject: [PATCH] Add grammar for SQL --- grammars/sql_grammar.json | 155 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 grammars/sql_grammar.json diff --git a/grammars/sql_grammar.json b/grammars/sql_grammar.json new file mode 100644 index 0000000..f951207 --- /dev/null +++ b/grammars/sql_grammar.json @@ -0,0 +1,155 @@ +{ + "": [ + [""] + ], + "": [ + ["", ";"] + ], + "": [ + ["": [ + ["SELECT ", "", " FROM ", "", ""], + ["SELECT ", "", " FROM ", "
", ""], + ["SELECT ", "", " FROM ", "
"] + ], + "": [ + ["", "
", " ON ", ""], + ["", "
", " USING (", "", ")"] + ], + "": [ + [" INNER JOIN "], + [" LEFT JOIN "], + [" RIGHT JOIN "], + [" FULL OUTER JOIN "] + ], + "": [ + ["* ", ""], + ["", ""] + ], + "": [ + [",", "", ""], + [] + ], + "": [ + [""], + ["", " AS ", ""] + ], + "
": [ + [""] + ], + "": [ + [" WHERE ", ""], + [] + ], + "": [ + [""], + ["(", "", ")"], + ["", "", ""] + ], + "": [ + ["", "", ""] + ], + "": [ + [" = "], + [" < "], + [" > "], + [" <= "], + [" >= "], + [" <> "], + [" LIKE "], + [" IN "], + [" BETWEEN "] + ], + "": [ + [" AND "], + [" OR "] + ], + "": [ + [""], + [""], + [""] + ], + "": [ + ["INSERT INTO ", "
", "(", "", ")", " VALUES ", "(", "", ")"] + ], + "": [ + ["", ",", ""], + [""] + ], + "": [ + ["UPDATE ", "
", " SET ", "", " = ", "", ""] + ], + "": [ + ["DELETE FROM ", "
", ""] + ], + "": [ + ["CREATE TABLE ", "
", "(", "", ")"] + ], + "": [ + ["", ",", ""], + [""] + ], + "": [ + ["", "", ""] + ], + "": [ + [" INT "], + [" VARCHAR ", "(", "", ")"], + [" TEXT "], + [" BOOLEAN "], + [" FLOAT "], + [" DOUBLE "], + [" DATE "], + [" TIME "], + [" DATETIME "] + ], + "": [ + [" PRIMARY KEY ", ""], + [" NOT NULL ", ""], + [" UNIQUE ", ""], + [" DEFAULT ", "", ""], + [] + ], + "": [ + ["", ""], + [] + ], + "": [ + [""] + ], + "": [ + ["0"], ["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"] + ], + "": [ + ["'", "", "'"], + ["\"", "", "\""] + ], + "": [ + ["", ""] + ], + "": [ + ["", ""], + [] + ], + "": [ + ["a"], ["b"], ["c"], ["d"], ["e"], ["f"], ["g"], ["h"], ["i"], ["j"], + ["k"], ["l"], ["m"], ["n"], ["o"], ["p"], ["q"], ["r"], ["s"], ["t"], + ["u"], ["v"], ["w"], ["x"], ["y"], ["z"], + ["A"], ["B"], ["C"], ["D"], ["E"], ["F"], ["G"], ["H"], ["I"], ["J"], + ["K"], ["L"], ["M"], ["N"], ["O"], ["P"], ["Q"], ["R"], ["S"], ["T"], + ["U"], ["V"], ["W"], ["X"], ["Y"], ["Z"], + ["0"], ["1"], ["2"], ["3"], ["4"], ["5"], ["6"], ["7"], ["8"], ["9"], + ["_"], ["-"] + ], + "": [ + ["NULL"] + ], + "": [ + [""] + ] +}