diff --git a/ANTLR4ParseTreeVisualizer.Dev.sln b/ANTLR4ParseTreeVisualizer.Dev.sln
index 9d715d5..e9b5d89 100644
--- a/ANTLR4ParseTreeVisualizer.Dev.sln
+++ b/ANTLR4ParseTreeVisualizer.Dev.sln
@@ -39,18 +39,29 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Standard.Package", "Standar
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_visualizerTestNoRef", "_visualizerTestNoRef\_visualizerTestNoRef.csproj", "{CADA5CBA-1FE0-48A2-BF4F-7158C1CFF44F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_visualizerTestStandard", "_visualizerTestStandard\_visualizerTestStandard.csproj", "{1363D6B6-6D48-4A62-A533-3432F74A04F9}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_visualizerTestStandard", "_visualizerTestStandard\_visualizerTestStandard.csproj", "{1363D6B6-6D48-4A62-A533-3432F74A04F9}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_visualizerTestStandardNoRef", "_visualizerTestStandardNoRef\_visualizerTestStandardNoRef.csproj", "{05FA4741-B091-4075-8355-53C2BC48AACD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_visualizerTestStandardNoRef", "_visualizerTestStandardNoRef\_visualizerTestStandardNoRef.csproj", "{05FA4741-B091-4075-8355-53C2BC48AACD}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{74A0EB35-5FC5-40D6-BD6A-199A070ED68D}"
+EndProject
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Test.Shared", "Test\Test.Shared\Test.Shared.shproj", "{ED8BAF15-5B0B-4027-9B23-DD14B24739DB}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.Legacy", "Test\Test.Legacy\Test.Legacy.csproj", "{01945C0C-2E1A-4FB7-A26B-544FACEA3DA5}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.Standard", "Test\Test.Standard\Test.Standard.csproj", "{0268B6F3-FD77-452C-AFB4-75FA81BF5947}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
+ Test\Test.Shared\Test.Shared.projitems*{01945c0c-2e1a-4fb7-a26b-544facea3da5}*SharedItemsImports = 5
+ Test\Test.Shared\Test.Shared.projitems*{0268b6f3-fd77-452c-afb4-75fa81bf5947}*SharedItemsImports = 5
Debuggee\Debuggee.projitems*{127b215f-f3f8-44df-a2d1-9aaf95b3f8f3}*SharedItemsImports = 13
Visualizer\Visualizer.projitems*{3c553ffd-fa4e-4eab-ad03-9534c7cb8f3e}*SharedItemsImports = 13
Debuggee\Debuggee.projitems*{ae5a655c-c17c-4fbb-be45-13e49a5c7bc8}*SharedItemsImports = 5
Serialization\Serialization.projitems*{ae5a655c-c17c-4fbb-be45-13e49a5c7bc8}*SharedItemsImports = 5
UI\UI.projitems*{e2b06997-76f1-48de-abe6-cf90427423bb}*SharedItemsImports = 13
Serialization\Serialization.projitems*{e3b0367b-3649-4b77-878a-85a8a11c4c09}*SharedItemsImports = 13
+ Test\Test.Shared\Test.Shared.projitems*{ed8baf15-5b0b-4027-9b23-dd14b24739db}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -101,6 +112,14 @@ Global
{05FA4741-B091-4075-8355-53C2BC48AACD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05FA4741-B091-4075-8355-53C2BC48AACD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05FA4741-B091-4075-8355-53C2BC48AACD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {01945C0C-2E1A-4FB7-A26B-544FACEA3DA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {01945C0C-2E1A-4FB7-A26B-544FACEA3DA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {01945C0C-2E1A-4FB7-A26B-544FACEA3DA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {01945C0C-2E1A-4FB7-A26B-544FACEA3DA5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0268B6F3-FD77-452C-AFB4-75FA81BF5947}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0268B6F3-FD77-452C-AFB4-75FA81BF5947}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0268B6F3-FD77-452C-AFB4-75FA81BF5947}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0268B6F3-FD77-452C-AFB4-75FA81BF5947}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -112,6 +131,9 @@ Global
{74F8A769-77D2-4889-BB81-2FF397C220B9} = {C0ADF39C-DD3F-4EBD-AC9C-7D1E5D5CD0A8}
{F09CFEBD-151C-487C-BC87-1EA68B5A4043} = {5F2046EA-A159-4673-B7B9-F1F3179C5D6C}
{D7950FB3-F80E-4249-99D1-F08E3A64CA0E} = {C0ADF39C-DD3F-4EBD-AC9C-7D1E5D5CD0A8}
+ {ED8BAF15-5B0B-4027-9B23-DD14B24739DB} = {74A0EB35-5FC5-40D6-BD6A-199A070ED68D}
+ {01945C0C-2E1A-4FB7-A26B-544FACEA3DA5} = {74A0EB35-5FC5-40D6-BD6A-199A070ED68D}
+ {0268B6F3-FD77-452C-AFB4-75FA81BF5947} = {74A0EB35-5FC5-40D6-BD6A-199A070ED68D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2A19EFC-E356-4E97-8752-D94ABBE584B0}
diff --git a/ANTLR4ParseTreeVisualizer.sln b/ANTLR4ParseTreeVisualizer.sln
index 6f82dee..9f8e9cb 100644
--- a/ANTLR4ParseTreeVisualizer.sln
+++ b/ANTLR4ParseTreeVisualizer.sln
@@ -33,14 +33,25 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Legacy.Package", "Legacy\Pa
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Standard.Package", "Standard\Package\Standard.Package.csproj", "{D7950FB3-F80E-4249-99D1-F08E3A64CA0E}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{740AF50E-F735-4E54-8091-7DF29ABBD05A}"
+EndProject
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Test.Shared", "Test\Test.Shared\Test.Shared.shproj", "{ED8BAF15-5B0B-4027-9B23-DD14B24739DB}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.Legacy", "Test\Test.Legacy\Test.Legacy.csproj", "{22587B08-85CE-4383-B754-86808D0713E4}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.Standard", "Test\Test.Standard\Test.Standard.csproj", "{40F8B1E1-E78C-4231-8ACE-3EE5A9486609}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Debuggee\Debuggee.projitems*{127b215f-f3f8-44df-a2d1-9aaf95b3f8f3}*SharedItemsImports = 13
+ Test\Test.Shared\Test.Shared.projitems*{22587b08-85ce-4383-b754-86808d0713e4}*SharedItemsImports = 5
Visualizer\Visualizer.projitems*{3c553ffd-fa4e-4eab-ad03-9534c7cb8f3e}*SharedItemsImports = 13
+ Test\Test.Shared\Test.Shared.projitems*{40f8b1e1-e78c-4231-8ace-3ee5a9486609}*SharedItemsImports = 5
Debuggee\Debuggee.projitems*{ae5a655c-c17c-4fbb-be45-13e49a5c7bc8}*SharedItemsImports = 5
Serialization\Serialization.projitems*{ae5a655c-c17c-4fbb-be45-13e49a5c7bc8}*SharedItemsImports = 5
UI\UI.projitems*{e2b06997-76f1-48de-abe6-cf90427423bb}*SharedItemsImports = 13
Serialization\Serialization.projitems*{e3b0367b-3649-4b77-878a-85a8a11c4c09}*SharedItemsImports = 13
+ Test\Test.Shared\Test.Shared.projitems*{ed8baf15-5b0b-4027-9b23-dd14b24739db}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -71,6 +82,14 @@ Global
{D7950FB3-F80E-4249-99D1-F08E3A64CA0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7950FB3-F80E-4249-99D1-F08E3A64CA0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7950FB3-F80E-4249-99D1-F08E3A64CA0E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {22587B08-85CE-4383-B754-86808D0713E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {22587B08-85CE-4383-B754-86808D0713E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {22587B08-85CE-4383-B754-86808D0713E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {22587B08-85CE-4383-B754-86808D0713E4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {40F8B1E1-E78C-4231-8ACE-3EE5A9486609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {40F8B1E1-E78C-4231-8ACE-3EE5A9486609}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {40F8B1E1-E78C-4231-8ACE-3EE5A9486609}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {40F8B1E1-E78C-4231-8ACE-3EE5A9486609}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -82,6 +101,9 @@ Global
{74F8A769-77D2-4889-BB81-2FF397C220B9} = {C0ADF39C-DD3F-4EBD-AC9C-7D1E5D5CD0A8}
{F09CFEBD-151C-487C-BC87-1EA68B5A4043} = {5F2046EA-A159-4673-B7B9-F1F3179C5D6C}
{D7950FB3-F80E-4249-99D1-F08E3A64CA0E} = {C0ADF39C-DD3F-4EBD-AC9C-7D1E5D5CD0A8}
+ {ED8BAF15-5B0B-4027-9B23-DD14B24739DB} = {740AF50E-F735-4E54-8091-7DF29ABBD05A}
+ {22587B08-85CE-4383-B754-86808D0713E4} = {740AF50E-F735-4E54-8091-7DF29ABBD05A}
+ {40F8B1E1-E78C-4231-8ACE-3EE5A9486609} = {740AF50E-F735-4E54-8091-7DF29ABBD05A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A2A19EFC-E356-4E97-8752-D94ABBE584B0}
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..ad53bdf
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,7 @@
+
+
+ true
+ enable
+ 9.0
+
+
diff --git a/Legacy/Debuggee/Legacy.Debuggee.csproj b/Legacy/Debuggee/Legacy.Debuggee.csproj
index 41ff9a8..1e94692 100644
--- a/Legacy/Debuggee/Legacy.Debuggee.csproj
+++ b/Legacy/Debuggee/Legacy.Debuggee.csproj
@@ -15,7 +15,7 @@
-
+
..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.DebuggerVisualizers.dll
diff --git a/Legacy/Debugger/Legacy.Debugger.csproj b/Legacy/Debugger/Legacy.Debugger.csproj
index b1f643e..941abc6 100644
--- a/Legacy/Debugger/Legacy.Debugger.csproj
+++ b/Legacy/Debugger/Legacy.Debugger.csproj
@@ -13,8 +13,8 @@
-
-
+
+
..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.DebuggerVisualizers.dll
diff --git a/Legacy/Package/Legacy.Package.csproj b/Legacy/Package/Legacy.Package.csproj
index 10c180a..80940a2 100644
--- a/Legacy/Package/Legacy.Package.csproj
+++ b/Legacy/Package/Legacy.Package.csproj
@@ -1,7 +1,7 @@

- net472
+ net472
ParseTreeVisualizer
ParseTreeVisualizer.UI.Legacy
9.0
@@ -25,8 +25,8 @@
-
-
+
+
diff --git a/Serialization/VisualizerData.cs b/Serialization/VisualizerData.cs
index c4f01f5..a646bdf 100644
--- a/Serialization/VisualizerData.cs
+++ b/Serialization/VisualizerData.cs
@@ -23,10 +23,6 @@ public class VisualizerData {
public bool CanSelectLexer { get; }
public bool CanSelectParser { get; }
- private static readonly string[] ignnoreLoadErrors = new[] {
- "Microsoft.Xaml.Behaviors"
- };
-
public VisualizerData(object o, Config config) {
if (config is null) { throw new ArgumentNullException(nameof(config)); }
@@ -42,12 +38,10 @@ T createInstance(string typename, object[]? args = null) =>
.Where(x => x != GetType().Assembly)
.SelectMany(x => {
var ret = Empty();
- if (!x.FullName.StartsWithAny(ignnoreLoadErrors)) {
- try {
- ret = x.GetTypes();
- } catch {
- AssemblyLoadErrors.Add(x.FullName);
- }
+ try {
+ ret = x.GetTypes();
+ } catch {
+ AssemblyLoadErrors.Add(x.FullName);
}
return ret;
})
diff --git a/Standard/Debuggee/Standard.Debuggee.csproj b/Standard/Debuggee/Standard.Debuggee.csproj
index ef13dc2..90637c3 100644
--- a/Standard/Debuggee/Standard.Debuggee.csproj
+++ b/Standard/Debuggee/Standard.Debuggee.csproj
@@ -12,7 +12,7 @@
-
+
..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.DebuggerVisualizers.dll
diff --git a/Standard/Debugger/Standard.Debugger.csproj b/Standard/Debugger/Standard.Debugger.csproj
index ea19455..8e195a7 100644
--- a/Standard/Debugger/Standard.Debugger.csproj
+++ b/Standard/Debugger/Standard.Debugger.csproj
@@ -13,8 +13,8 @@
-
-
+
+
..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.DebuggerVisualizers.dll
diff --git a/Standard/Package/Standard.Package.csproj b/Standard/Package/Standard.Package.csproj
index 55775b5..6f870f9 100644
--- a/Standard/Package/Standard.Package.csproj
+++ b/Standard/Package/Standard.Package.csproj
@@ -24,8 +24,8 @@
-
-
+
+
diff --git a/Test/Test.Legacy/Test.Legacy.csproj b/Test/Test.Legacy/Test.Legacy.csproj
new file mode 100644
index 0000000..b4ef715
--- /dev/null
+++ b/Test/Test.Legacy/Test.Legacy.csproj
@@ -0,0 +1,47 @@
+
+
+
+ net5.0-windows
+ ParseTreeVisualizer.Test
+ false
+ true
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+ MSBuild:Compile
+ ParseTreeVisualizer.Test
+ False
+ False
+
+
+
+ MSBuild:Compile
+ ParseTreeVisualizer.Test
+ False
+ False
+
+
+
+
+
+
+
diff --git a/Test/Test.Shared/Extensions.cs b/Test/Test.Shared/Extensions.cs
new file mode 100644
index 0000000..4428dae
--- /dev/null
+++ b/Test/Test.Shared/Extensions.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace ParseTreeVisualizer.Test {
+ public static class Extensions {
+ public static TheoryData ToTheoryData(this IEnumerable<(T1, T2)> src) {
+ var ret = new TheoryData();
+ foreach (var (a, b) in src) {
+ ret.Add(a, b);
+ }
+ return ret;
+ }
+ public static TheoryData ToTheoryData(this IEnumerable<(T1, T2, T3, T4)> src) {
+ var ret = new TheoryData();
+ foreach (var (a, b, c, d) in src) {
+ ret.Add(a, b, c, d);
+ }
+ return ret;
+ }
+ }
+}
diff --git a/Tests.Shared/GlobalSuppressions.cs b/Test/Test.Shared/GlobalSuppressions.cs
similarity index 100%
rename from Tests.Shared/GlobalSuppressions.cs
rename to Test/Test.Shared/GlobalSuppressions.cs
diff --git a/Test/Test.Shared/Grammar/SQLiteLexer.g4 b/Test/Test.Shared/Grammar/SQLiteLexer.g4
new file mode 100644
index 0000000..0dd1918
--- /dev/null
+++ b/Test/Test.Shared/Grammar/SQLiteLexer.g4
@@ -0,0 +1,267 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 by Martin Mirchev
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
+ * associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Project : sqlite-parser; an ANTLR4 grammar for SQLite https://github.com/bkiers/sqlite-parser
+ * Developed by : Bart Kiers, bart@big-o.nl
+ */
+
+// $antlr-format alignTrailingComments on, columnLimit 150, maxEmptyLinesToKeep 1, reflowComments off, useTab off
+// $antlr-format allowShortRulesOnASingleLine on, alignSemicolons ownLine
+
+lexer grammar SQLiteLexer;
+
+SCOL: ';';
+DOT: '.';
+OPEN_PAR: '(';
+CLOSE_PAR: ')';
+COMMA: ',';
+ASSIGN: '=';
+STAR: '*';
+PLUS: '+';
+MINUS: '-';
+TILDE: '~';
+PIPE2: '||';
+DIV: '/';
+MOD: '%';
+LT2: '<<';
+GT2: '>>';
+AMP: '&';
+PIPE: '|';
+LT: '<';
+LT_EQ: '<=';
+GT: '>';
+GT_EQ: '>=';
+EQ: '==';
+NOT_EQ1: '!=';
+NOT_EQ2: '<>';
+
+// http://www.sqlite.org/lang_keywords.html
+ABORT_: A B O R T;
+ACTION_: A C T I O N;
+ADD_: A D D;
+AFTER_: A F T E R;
+ALL_: A L L;
+ALTER_: A L T E R;
+ANALYZE_: A N A L Y Z E;
+AND_: A N D;
+AS_: A S;
+ASC_: A S C;
+ATTACH_: A T T A C H;
+AUTOINCREMENT_: A U T O I N C R E M E N T;
+BEFORE_: B E F O R E;
+BEGIN_: B E G I N;
+BETWEEN_: B E T W E E N;
+BY_: B Y;
+CASCADE_: C A S C A D E;
+CASE_: C A S E;
+CAST_: C A S T;
+CHECK_: C H E C K;
+COLLATE_: C O L L A T E;
+COLUMN_: C O L U M N;
+COMMIT_: C O M M I T;
+CONFLICT_: C O N F L I C T;
+CONSTRAINT_: C O N S T R A I N T;
+CREATE_: C R E A T E;
+CROSS_: C R O S S;
+CURRENT_DATE_: C U R R E N T '_' D A T E;
+CURRENT_TIME_: C U R R E N T '_' T I M E;
+CURRENT_TIMESTAMP_: C U R R E N T '_' T I M E S T A M P;
+DATABASE_: D A T A B A S E;
+DEFAULT_: D E F A U L T;
+DEFERRABLE_: D E F E R R A B L E;
+DEFERRED_: D E F E R R E D;
+DELETE_: D E L E T E;
+DESC_: D E S C;
+DETACH_: D E T A C H;
+DISTINCT_: D I S T I N C T;
+DROP_: D R O P;
+EACH_: E A C H;
+ELSE_: E L S E;
+END_: E N D;
+ESCAPE_: E S C A P E;
+EXCEPT_: E X C E P T;
+EXCLUSIVE_: E X C L U S I V E;
+EXISTS_: E X I S T S;
+EXPLAIN_: E X P L A I N;
+FAIL_: F A I L;
+FOR_: F O R;
+FOREIGN_: F O R E I G N;
+FROM_: F R O M;
+FULL_: F U L L;
+GLOB_: G L O B;
+GROUP_: G R O U P;
+HAVING_: H A V I N G;
+IF_: I F;
+IGNORE_: I G N O R E;
+IMMEDIATE_: I M M E D I A T E;
+IN_: I N;
+INDEX_: I N D E X;
+INDEXED_: I N D E X E D;
+INITIALLY_: I N I T I A L L Y;
+INNER_: I N N E R;
+INSERT_: I N S E R T;
+INSTEAD_: I N S T E A D;
+INTERSECT_: I N T E R S E C T;
+INTO_: I N T O;
+IS_: I S;
+ISNULL_: I S N U L L;
+JOIN_: J O I N;
+KEY_: K E Y;
+LEFT_: L E F T;
+LIKE_: L I K E;
+LIMIT_: L I M I T;
+MATCH_: M A T C H;
+NATURAL_: N A T U R A L;
+NO_: N O;
+NOT_: N O T;
+NOTNULL_: N O T N U L L;
+NULL_: N U L L;
+OF_: O F;
+OFFSET_: O F F S E T;
+ON_: O N;
+OR_: O R;
+ORDER_: O R D E R;
+OUTER_: O U T E R;
+PLAN_: P L A N;
+PRAGMA_: P R A G M A;
+PRIMARY_: P R I M A R Y;
+QUERY_: Q U E R Y;
+RAISE_: R A I S E;
+RECURSIVE_: R E C U R S I V E;
+REFERENCES_: R E F E R E N C E S;
+REGEXP_: R E G E X P;
+REINDEX_: R E I N D E X;
+RELEASE_: R E L E A S E;
+RENAME_: R E N A M E;
+REPLACE_: R E P L A C E;
+RESTRICT_: R E S T R I C T;
+RIGHT_: R I G H T;
+ROLLBACK_: R O L L B A C K;
+ROW_: R O W;
+ROWS_: R O W S;
+SAVEPOINT_: S A V E P O I N T;
+SELECT_: S E L E C T;
+SET_: S E T;
+TABLE_: T A B L E;
+TEMP_: T E M P;
+TEMPORARY_: T E M P O R A R Y;
+THEN_: T H E N;
+TO_: T O;
+TRANSACTION_: T R A N S A C T I O N;
+TRIGGER_: T R I G G E R;
+UNION_: U N I O N;
+UNIQUE_: U N I Q U E;
+UPDATE_: U P D A T E;
+USING_: U S I N G;
+VACUUM_: V A C U U M;
+VALUES_: V A L U E S;
+VIEW_: V I E W;
+VIRTUAL_: V I R T U A L;
+WHEN_: W H E N;
+WHERE_: W H E R E;
+WITH_: W I T H;
+WITHOUT_: W I T H O U T;
+FIRST_VALUE_: F I R S T '_' V A L U E;
+OVER_: O V E R;
+PARTITION_: P A R T I T I O N;
+RANGE_: R A N G E;
+PRECEDING_: P R E C E D I N G;
+UNBOUNDED_: U N B O U N D E D;
+CURRENT_: C U R R E N T;
+FOLLOWING_: F O L L O W I N G;
+CUME_DIST_: C U M E '_' D I S T;
+DENSE_RANK_: D E N S E '_' R A N K;
+LAG_: L A G;
+LAST_VALUE_: L A S T '_' V A L U E;
+LEAD_: L E A D;
+NTH_VALUE_: N T H '_' V A L U E;
+NTILE_: N T I L E;
+PERCENT_RANK_: P E R C E N T '_' R A N K;
+RANK_: R A N K;
+ROW_NUMBER_: R O W '_' N U M B E R;
+GENERATED_: G E N E R A T E D;
+ALWAYS_: A L W A Y S;
+STORED_: S T O R E D;
+TRUE_: T R U E;
+FALSE_: F A L S E;
+WINDOW_: W I N D O W;
+NULLS_: N U L L S;
+FIRST_: F I R S T;
+LAST_: L A S T;
+FILTER_: F I L T E R;
+GROUPS_: G R O U P S;
+EXCLUDE_: E X C L U D E;
+TIES_: T I E S;
+OTHERS_: O T H E R S;
+DO_: D O;
+NOTHING_: N O T H I N G;
+
+IDENTIFIER:
+ '"' (~'"' | '""')* '"'
+ | '`' (~'`' | '``')* '`'
+ | '[' ~']'* ']'
+ | [a-zA-Z_] [a-zA-Z_0-9]*
+; // TODO check: needs more chars in set
+
+NUMERIC_LITERAL: ((DIGIT+ ('.' DIGIT*)?) | ('.' DIGIT+)) (E [-+]? DIGIT+)? | '0x' HEX_DIGIT+;
+
+BIND_PARAMETER: '?' DIGIT* | [:@$] IDENTIFIER;
+
+STRING_LITERAL: '\'' ( ~'\'' | '\'\'')* '\'';
+
+BLOB_LITERAL: X STRING_LITERAL;
+
+SINGLE_LINE_COMMENT: '--' ~[\r\n]* (('\r'? '\n') | EOF) -> channel(HIDDEN);
+
+MULTILINE_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
+
+SPACES: [ \u000B\t\r\n] -> channel(HIDDEN);
+
+UNEXPECTED_CHAR: .;
+
+fragment HEX_DIGIT: [0-9a-fA-F];
+fragment DIGIT: [0-9];
+
+fragment A: [aA];
+fragment B: [bB];
+fragment C: [cC];
+fragment D: [dD];
+fragment E: [eE];
+fragment F: [fF];
+fragment G: [gG];
+fragment H: [hH];
+fragment I: [iI];
+fragment J: [jJ];
+fragment K: [kK];
+fragment L: [lL];
+fragment M: [mM];
+fragment N: [nN];
+fragment O: [oO];
+fragment P: [pP];
+fragment Q: [qQ];
+fragment R: [rR];
+fragment S: [sS];
+fragment T: [tT];
+fragment U: [uU];
+fragment V: [vV];
+fragment W: [wW];
+fragment X: [xX];
+fragment Y: [yY];
+fragment Z: [zZ];
diff --git a/Test/Test.Shared/Grammar/SQLiteParser.g4 b/Test/Test.Shared/Grammar/SQLiteParser.g4
new file mode 100644
index 0000000..ff411c6
--- /dev/null
+++ b/Test/Test.Shared/Grammar/SQLiteParser.g4
@@ -0,0 +1,904 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014 by Bart Kiers
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
+ * associated documentation files (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge, publish, distribute,
+ * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all copies or
+ * substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
+ * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Project : sqlite-parser; an ANTLR4 grammar for SQLite https://github.com/bkiers/sqlite-parser
+ * Developed by:
+ * Bart Kiers, bart@big-o.nl
+ * Martin Mirchev, marti_2203@abv.bg
+ * Mike Lische, mike@lischke-online.de
+ */
+
+// $antlr-format alignTrailingComments on, columnLimit 130, minEmptyLines 1, maxEmptyLinesToKeep 1, reflowComments off
+// $antlr-format useTab off, allowShortRulesOnASingleLine off, allowShortBlocksOnASingleLine on, alignSemicolons ownLine
+
+parser grammar SQLiteParser;
+
+options {
+ tokenVocab = SQLiteLexer;
+}
+
+parse: (sql_stmt_list)* EOF
+;
+
+sql_stmt_list:
+ SCOL* sql_stmt (SCOL+ sql_stmt)* SCOL*
+;
+
+sql_stmt: (EXPLAIN_ (QUERY_ PLAN_)?)? (
+ alter_table_stmt
+ | analyze_stmt
+ | attach_stmt
+ | begin_stmt
+ | commit_stmt
+ | create_index_stmt
+ | create_table_stmt
+ | create_trigger_stmt
+ | create_view_stmt
+ | create_virtual_table_stmt
+ | delete_stmt
+ | delete_stmt_limited
+ | detach_stmt
+ | drop_stmt
+ | insert_stmt
+ | pragma_stmt
+ | reindex_stmt
+ | release_stmt
+ | rollback_stmt
+ | savepoint_stmt
+ | select_stmt
+ | update_stmt
+ | update_stmt_limited
+ | vacuum_stmt
+ )
+;
+
+alter_table_stmt:
+ ALTER_ TABLE_ (schema_name DOT)? table_name (
+ RENAME_ (
+ TO_ new_table_name
+ | COLUMN_? old_column_name = column_name TO_ new_column_name = column_name
+ )
+ | ADD_ COLUMN_? column_def
+ )
+;
+
+analyze_stmt:
+ ANALYZE_ (schema_name | (schema_name DOT)? table_or_index_name)?
+;
+
+attach_stmt:
+ ATTACH_ DATABASE_? expr AS_ schema_name
+;
+
+begin_stmt:
+ BEGIN_ (DEFERRED_ | IMMEDIATE_ | EXCLUSIVE_)? (
+ TRANSACTION_ transaction_name?
+ )?
+;
+
+commit_stmt: (COMMIT_ | END_) TRANSACTION_?
+;
+
+rollback_stmt:
+ ROLLBACK_ TRANSACTION_? (TO_ SAVEPOINT_? savepoint_name)?
+;
+
+savepoint_stmt:
+ SAVEPOINT_ savepoint_name
+;
+
+release_stmt:
+ RELEASE_ SAVEPOINT_? savepoint_name
+;
+
+create_index_stmt:
+ CREATE_ UNIQUE_? INDEX_ (IF_ NOT_ EXISTS_)? (schema_name DOT)? index_name ON_ table_name OPEN_PAR
+ indexed_column (COMMA indexed_column)* CLOSE_PAR (WHERE_ expr)?
+;
+
+indexed_column: (column_name | expr) (COLLATE_ collation_name)? asc_desc?
+;
+
+create_table_stmt:
+ CREATE_ (TEMP_ | TEMPORARY_)? TABLE_ (IF_ NOT_ EXISTS_)? (
+ schema_name DOT
+ )? table_name (
+ OPEN_PAR column_def (COMMA column_def)*? (COMMA table_constraint)* CLOSE_PAR (
+ WITHOUT_ row_ROW_ID = IDENTIFIER
+ )?
+ | AS_ select_stmt
+ )
+;
+
+column_def:
+ column_name type_name? column_constraint*
+;
+
+type_name:
+ name+? (
+ OPEN_PAR signed_number CLOSE_PAR
+ | OPEN_PAR signed_number COMMA signed_number CLOSE_PAR
+ )?
+;
+
+column_constraint: (CONSTRAINT_ name)? (
+ (PRIMARY_ KEY_ asc_desc? conflict_clause? AUTOINCREMENT_?)
+ | (NOT_ NULL_ | UNIQUE_) conflict_clause?
+ | CHECK_ OPEN_PAR expr CLOSE_PAR
+ | DEFAULT_ (signed_number | literal_value | OPEN_PAR expr CLOSE_PAR)
+ | COLLATE_ collation_name
+ | foreign_key_clause
+ | (GENERATED_ ALWAYS_)? AS_ OPEN_PAR expr CLOSE_PAR (
+ STORED_
+ | VIRTUAL_
+ )?
+ )
+;
+
+signed_number: (PLUS | MINUS)? NUMERIC_LITERAL
+;
+
+table_constraint: (CONSTRAINT_ name)? (
+ (PRIMARY_ KEY_ | UNIQUE_) OPEN_PAR indexed_column (
+ COMMA indexed_column
+ )* CLOSE_PAR conflict_clause?
+ | CHECK_ OPEN_PAR expr CLOSE_PAR
+ | FOREIGN_ KEY_ OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR foreign_key_clause
+ )
+;
+
+foreign_key_clause:
+ REFERENCES_ foreign_table (
+ OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR
+ )? (
+ ON_ (DELETE_ | UPDATE_) (
+ SET_ (NULL_ | DEFAULT_)
+ | CASCADE_
+ | RESTRICT_
+ | NO_ ACTION_
+ )
+ | MATCH_ name
+ )* (NOT_? DEFERRABLE_ (INITIALLY_ (DEFERRED_ | IMMEDIATE_))?)?
+;
+
+conflict_clause:
+ ON_ CONFLICT_ (
+ ROLLBACK_
+ | ABORT_
+ | FAIL_
+ | IGNORE_
+ | REPLACE_
+ )
+;
+
+create_trigger_stmt:
+ CREATE_ (TEMP_ | TEMPORARY_)? TRIGGER_ (IF_ NOT_ EXISTS_)? (
+ schema_name DOT
+ )? trigger_name (BEFORE_ | AFTER_ | INSTEAD_ OF_)? (
+ DELETE_
+ | INSERT_
+ | UPDATE_ (OF_ column_name ( COMMA column_name)*)?
+ ) ON_ table_name (FOR_ EACH_ ROW_)? (WHEN_ expr)? BEGIN_ (
+ (update_stmt | insert_stmt | delete_stmt | select_stmt) SCOL
+ )+ END_
+;
+
+create_view_stmt:
+ CREATE_ (TEMP_ | TEMPORARY_)? VIEW_ (IF_ NOT_ EXISTS_)? (
+ schema_name DOT
+ )? view_name (OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR)? AS_ select_stmt
+;
+
+create_virtual_table_stmt:
+ CREATE_ VIRTUAL_ TABLE_ (IF_ NOT_ EXISTS_)? (schema_name DOT)? table_name USING_ module_name (
+ OPEN_PAR module_argument (COMMA module_argument)* CLOSE_PAR
+ )?
+;
+
+with_clause:
+ WITH_ RECURSIVE_? cte_table_name AS_ OPEN_PAR select_stmt CLOSE_PAR (
+ COMMA cte_table_name AS_ OPEN_PAR select_stmt CLOSE_PAR
+ )*
+;
+
+cte_table_name:
+ table_name (OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR)?
+;
+
+recursive_cte:
+ cte_table_name AS_ OPEN_PAR initial_select UNION_ ALL_? recursive__select CLOSE_PAR
+;
+
+common_table_expression:
+ table_name (OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR)? AS_ OPEN_PAR select_stmt CLOSE_PAR
+;
+
+delete_stmt:
+ with_clause? DELETE_ FROM_ qualified_table_name (WHERE_ expr)?
+;
+
+delete_stmt_limited:
+ with_clause? DELETE_ FROM_ qualified_table_name (WHERE_ expr)? (
+ order_by_stmt? limit_stmt
+ )?
+;
+
+detach_stmt:
+ DETACH_ DATABASE_? schema_name
+;
+
+drop_stmt:
+ DROP_ object = (INDEX_ | TABLE_ | TRIGGER_ | VIEW_) (
+ IF_ EXISTS_
+ )? (schema_name DOT)? any_name
+;
+
+/*
+ SQLite understands the following binary operators, in order from highest to lowest precedence:
+ ||
+ * / %
+ + -
+ << >> & |
+ < <= > >=
+ = == != <> IS IS NOT IN LIKE GLOB MATCH REGEXP
+ AND
+ OR
+ */
+expr:
+ literal_value
+ | BIND_PARAMETER
+ | ((schema_name DOT)? table_name DOT)? column_name
+ | unary_operator expr
+ | expr PIPE2 expr
+ | expr ( STAR | DIV | MOD) expr
+ | expr ( PLUS | MINUS) expr
+ | expr ( LT2 | GT2 | AMP | PIPE) expr
+ | expr ( LT | LT_EQ | GT | GT_EQ) expr
+ | expr (
+ ASSIGN
+ | EQ
+ | NOT_EQ1
+ | NOT_EQ2
+ | IS_
+ | IS_ NOT_
+ | IN_
+ | LIKE_
+ | GLOB_
+ | MATCH_
+ | REGEXP_
+ ) expr
+ | expr AND_ expr
+ | expr OR_ expr
+ | function_name OPEN_PAR ((DISTINCT_? expr ( COMMA expr)*) | STAR)? CLOSE_PAR filter_clause? over_clause?
+ | OPEN_PAR expr (COMMA expr)* CLOSE_PAR
+ | CAST_ OPEN_PAR expr AS_ type_name CLOSE_PAR
+ | expr COLLATE_ collation_name
+ | expr NOT_? (LIKE_ | GLOB_ | REGEXP_ | MATCH_) expr (
+ ESCAPE_ expr
+ )?
+ | expr ( ISNULL_ | NOTNULL_ | NOT_ NULL_)
+ | expr IS_ NOT_? expr
+ | expr NOT_? BETWEEN_ expr AND_ expr
+ | expr NOT_? IN_ (
+ OPEN_PAR (select_stmt | expr ( COMMA expr)*)? CLOSE_PAR
+ | ( schema_name DOT)? table_name
+ | (schema_name DOT)? table_function_name OPEN_PAR (expr (COMMA expr)*)? CLOSE_PAR
+ )
+ | ((NOT_)? EXISTS_)? OPEN_PAR select_stmt CLOSE_PAR
+ | CASE_ expr? (WHEN_ expr THEN_ expr)+ (ELSE_ expr)? END_
+ | raise_function
+;
+
+raise_function:
+ RAISE_ OPEN_PAR (
+ IGNORE_
+ | (ROLLBACK_ | ABORT_ | FAIL_) COMMA error_message
+ ) CLOSE_PAR
+;
+
+literal_value:
+ NUMERIC_LITERAL
+ | STRING_LITERAL
+ | BLOB_LITERAL
+ | NULL_
+ | TRUE_
+ | FALSE_
+ | CURRENT_TIME_
+ | CURRENT_DATE_
+ | CURRENT_TIMESTAMP_
+;
+
+insert_stmt:
+ with_clause? (
+ INSERT_
+ | REPLACE_
+ | INSERT_ OR_ (
+ REPLACE_
+ | ROLLBACK_
+ | ABORT_
+ | FAIL_
+ | IGNORE_
+ )
+ ) INTO_ (schema_name DOT)? table_name (AS_ table_alias)? (
+ OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR
+ )? (
+ (
+ VALUES_ OPEN_PAR expr (COMMA expr)* CLOSE_PAR (
+ COMMA OPEN_PAR expr ( COMMA expr)* CLOSE_PAR
+ )*
+ | select_stmt
+ ) upsert_clause?
+ )
+ | DEFAULT_ VALUES_
+;
+
+upsert_clause:
+ ON_ CONFLICT_ (
+ OPEN_PAR indexed_column (COMMA indexed_column)* CLOSE_PAR (WHERE_ expr)?
+ )? DO_ (
+ NOTHING_
+ | UPDATE_ SET_ (
+ (column_name | column_name_list) EQ expr (
+ COMMA (column_name | column_name_list) EQ expr
+ )* (WHERE_ expr)?
+ )
+ )
+;
+
+pragma_stmt:
+ PRAGMA_ (schema_name DOT)? pragma_name (
+ ASSIGN pragma_value
+ | OPEN_PAR pragma_value CLOSE_PAR
+ )?
+;
+
+pragma_value:
+ signed_number
+ | name
+ | STRING_LITERAL
+;
+
+reindex_stmt:
+ REINDEX_ (collation_name | (schema_name DOT)? (table_name | index_name))?
+;
+
+select_stmt:
+ common_table_stmt? select_core (compound_operator select_core)* order_by_stmt? limit_stmt?
+;
+
+join_clause:
+ table_or_subquery (join_operator table_or_subquery join_constraint?)*
+;
+
+select_core:
+ (
+ SELECT_ (DISTINCT_ | ALL_)? result_column (COMMA result_column)* (
+ FROM_ (table_or_subquery (COMMA table_or_subquery)* | join_clause)
+ )? (WHERE_ expr)? (GROUP_ BY_ expr (COMMA expr)* (HAVING_ expr)?)? (
+ WINDOW_ window_name AS_ window_defn (
+ COMMA window_name AS_ window_defn
+ )*
+ )?
+ )
+ | VALUES_ OPEN_PAR expr (COMMA expr)* CLOSE_PAR (
+ COMMA OPEN_PAR expr ( COMMA expr)* CLOSE_PAR
+ )*
+;
+
+factored_select_stmt:
+ select_stmt
+;
+
+simple_select_stmt:
+ common_table_stmt? select_core order_by_stmt? limit_stmt?
+;
+
+compound_select_stmt:
+ common_table_stmt? select_core (
+ (UNION_ ALL_? | INTERSECT_ | EXCEPT_) select_core
+ )+ order_by_stmt? limit_stmt?
+;
+
+table_or_subquery: (
+ (schema_name DOT)? table_name (AS_? table_alias)? (
+ INDEXED_ BY_ index_name
+ | NOT_ INDEXED_
+ )?
+ )
+ | (schema_name DOT)? table_function_name OPEN_PAR expr (COMMA expr)* CLOSE_PAR (
+ AS_? table_alias
+ )?
+ | OPEN_PAR (table_or_subquery (COMMA table_or_subquery)* | join_clause) CLOSE_PAR
+ | OPEN_PAR select_stmt CLOSE_PAR (AS_? table_alias)?
+;
+
+result_column:
+ STAR
+ | table_name DOT STAR
+ | expr ( AS_? column_alias)?
+;
+
+join_operator:
+ COMMA
+ | NATURAL_? (LEFT_ OUTER_? | INNER_ | CROSS_)? JOIN_
+;
+
+join_constraint:
+ ON_ expr
+ | USING_ OPEN_PAR column_name ( COMMA column_name)* CLOSE_PAR
+;
+
+compound_operator:
+ UNION_ ALL_?
+ | INTERSECT_
+ | EXCEPT_
+;
+
+update_stmt:
+ with_clause? UPDATE_ (
+ OR_ (ROLLBACK_ | ABORT_ | REPLACE_ | FAIL_ | IGNORE_)
+ )? qualified_table_name SET_ (column_name | column_name_list) ASSIGN expr (
+ COMMA (column_name | column_name_list) ASSIGN expr
+ )* (WHERE_ expr)?
+;
+
+column_name_list:
+ OPEN_PAR column_name (COMMA column_name)* CLOSE_PAR
+;
+
+update_stmt_limited:
+ with_clause? UPDATE_ (
+ OR_ (ROLLBACK_ | ABORT_ | REPLACE_ | FAIL_ | IGNORE_)
+ )? qualified_table_name SET_ (column_name | column_name_list) ASSIGN expr (
+ COMMA (column_name | column_name_list) ASSIGN expr
+ )* (WHERE_ expr)? (order_by_stmt? limit_stmt)?
+;
+
+qualified_table_name: (schema_name DOT)? table_name (AS_ alias)? (
+ INDEXED_ BY_ index_name
+ | NOT_ INDEXED_
+ )?
+;
+
+vacuum_stmt:
+ VACUUM_ schema_name? (INTO_ filename)?
+;
+
+filter_clause:
+ FILTER_ OPEN_PAR WHERE_ expr CLOSE_PAR
+;
+
+window_defn:
+ OPEN_PAR base_window_name? (PARTITION_ BY_ expr (COMMA expr)*)? (
+ ORDER_ BY_ ordering_term (COMMA ordering_term)*
+ ) frame_spec? CLOSE_PAR
+;
+
+over_clause:
+ OVER_ (
+ window_name
+ | OPEN_PAR base_window_name? (PARTITION_ BY_ expr (COMMA expr)*)? (
+ ORDER_ BY_ ordering_term (COMMA ordering_term)*
+ )? frame_spec? CLOSE_PAR
+ )
+;
+
+frame_spec:
+ frame_clause (
+ EXCLUDE_ (NO_ OTHERS_)
+ | CURRENT_ ROW_
+ | GROUP_
+ | TIES_
+ )?
+;
+
+frame_clause: (RANGE_ | ROWS_ | GROUPS_) (
+ frame_single
+ | BETWEEN_ frame_left AND_ frame_right
+ )
+;
+
+simple_function_invocation:
+ simple_func OPEN_PAR (expr (COMMA expr)* | STAR) CLOSE_PAR
+;
+
+aggregate_function_invocation:
+ aggregate_func OPEN_PAR (DISTINCT_? expr (COMMA expr)* | STAR)? CLOSE_PAR filter_clause?
+;
+
+window_function_invocation:
+ window_function OPEN_PAR (expr (COMMA expr)* | STAR)? CLOSE_PAR filter_clause? OVER_ (
+ window_defn
+ | window_name
+ )
+;
+
+common_table_stmt: //additional structures
+ WITH_ RECURSIVE_? common_table_expression (COMMA common_table_expression)*
+;
+
+order_by_stmt:
+ ORDER_ BY_ ordering_term (COMMA ordering_term)*
+;
+
+limit_stmt:
+ LIMIT_ expr ((OFFSET_ | COMMA) expr)?
+;
+
+ordering_term:
+ expr (COLLATE_ collation_name)? asc_desc? (NULLS_ (FIRST_ | LAST_))?
+;
+
+asc_desc:
+ ASC_
+ | DESC_
+;
+
+frame_left:
+ expr PRECEDING_
+ | expr FOLLOWING_
+ | CURRENT_ ROW_
+ | UNBOUNDED_ PRECEDING_
+;
+
+frame_right:
+ expr PRECEDING_
+ | expr FOLLOWING_
+ | CURRENT_ ROW_
+ | UNBOUNDED_ FOLLOWING_
+;
+
+frame_single:
+ expr PRECEDING_
+ | UNBOUNDED_ PRECEDING_
+ | CURRENT_ ROW_
+;
+
+// unknown
+
+window_function:
+ (FIRST_VALUE_ | LAST_VALUE_) OPEN_PAR expr CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc frame_clause
+ ? CLOSE_PAR
+ | (CUME_DIST_ | PERCENT_RANK_) OPEN_PAR CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr? CLOSE_PAR
+ | (DENSE_RANK_ | RANK_ | ROW_NUMBER_) OPEN_PAR CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc
+ CLOSE_PAR
+ | (LAG_ | LEAD_) OPEN_PAR expr of_OF_fset? default_DEFAULT__value? CLOSE_PAR OVER_ OPEN_PAR partition_by?
+ order_by_expr_asc_desc CLOSE_PAR
+ | NTH_VALUE_ OPEN_PAR expr COMMA signed_number CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc
+ frame_clause? CLOSE_PAR
+ | NTILE_ OPEN_PAR expr CLOSE_PAR OVER_ OPEN_PAR partition_by? order_by_expr_asc_desc CLOSE_PAR
+;
+
+of_OF_fset:
+ COMMA signed_number
+;
+
+default_DEFAULT__value:
+ COMMA signed_number
+;
+
+partition_by:
+ PARTITION_ BY_ expr+
+;
+
+order_by_expr:
+ ORDER_ BY_ expr+
+;
+
+order_by_expr_asc_desc:
+ ORDER_ BY_ order_by_expr_asc_desc
+;
+
+expr_asc_desc:
+ expr asc_desc? (COMMA expr asc_desc?)*
+;
+
+//TODO BOTH OF THESE HAVE TO BE REWORKED TO FOLLOW THE SPEC
+initial_select:
+ select_stmt
+;
+
+recursive__select:
+ select_stmt
+;
+
+unary_operator:
+ MINUS
+ | PLUS
+ | TILDE
+ | NOT_
+;
+
+error_message:
+ STRING_LITERAL
+;
+
+module_argument: // TODO check what exactly is permitted here
+ expr
+ | column_def
+;
+
+column_alias:
+ IDENTIFIER
+ | STRING_LITERAL
+;
+
+keyword:
+ ABORT_
+ | ACTION_
+ | ADD_
+ | AFTER_
+ | ALL_
+ | ALTER_
+ | ANALYZE_
+ | AND_
+ | AS_
+ | ASC_
+ | ATTACH_
+ | AUTOINCREMENT_
+ | BEFORE_
+ | BEGIN_
+ | BETWEEN_
+ | BY_
+ | CASCADE_
+ | CASE_
+ | CAST_
+ | CHECK_
+ | COLLATE_
+ | COLUMN_
+ | COMMIT_
+ | CONFLICT_
+ | CONSTRAINT_
+ | CREATE_
+ | CROSS_
+ | CURRENT_DATE_
+ | CURRENT_TIME_
+ | CURRENT_TIMESTAMP_
+ | DATABASE_
+ | DEFAULT_
+ | DEFERRABLE_
+ | DEFERRED_
+ | DELETE_
+ | DESC_
+ | DETACH_
+ | DISTINCT_
+ | DROP_
+ | EACH_
+ | ELSE_
+ | END_
+ | ESCAPE_
+ | EXCEPT_
+ | EXCLUSIVE_
+ | EXISTS_
+ | EXPLAIN_
+ | FAIL_
+ | FOR_
+ | FOREIGN_
+ | FROM_
+ | FULL_
+ | GLOB_
+ | GROUP_
+ | HAVING_
+ | IF_
+ | IGNORE_
+ | IMMEDIATE_
+ | IN_
+ | INDEX_
+ | INDEXED_
+ | INITIALLY_
+ | INNER_
+ | INSERT_
+ | INSTEAD_
+ | INTERSECT_
+ | INTO_
+ | IS_
+ | ISNULL_
+ | JOIN_
+ | KEY_
+ | LEFT_
+ | LIKE_
+ | LIMIT_
+ | MATCH_
+ | NATURAL_
+ | NO_
+ | NOT_
+ | NOTNULL_
+ | NULL_
+ | OF_
+ | OFFSET_
+ | ON_
+ | OR_
+ | ORDER_
+ | OUTER_
+ | PLAN_
+ | PRAGMA_
+ | PRIMARY_
+ | QUERY_
+ | RAISE_
+ | RECURSIVE_
+ | REFERENCES_
+ | REGEXP_
+ | REINDEX_
+ | RELEASE_
+ | RENAME_
+ | REPLACE_
+ | RESTRICT_
+ | RIGHT_
+ | ROLLBACK_
+ | ROW_
+ | ROWS_
+ | SAVEPOINT_
+ | SELECT_
+ | SET_
+ | TABLE_
+ | TEMP_
+ | TEMPORARY_
+ | THEN_
+ | TO_
+ | TRANSACTION_
+ | TRIGGER_
+ | UNION_
+ | UNIQUE_
+ | UPDATE_
+ | USING_
+ | VACUUM_
+ | VALUES_
+ | VIEW_
+ | VIRTUAL_
+ | WHEN_
+ | WHERE_
+ | WITH_
+ | WITHOUT_
+ | FIRST_VALUE_
+ | OVER_
+ | PARTITION_
+ | RANGE_
+ | PRECEDING_
+ | UNBOUNDED_
+ | CURRENT_
+ | FOLLOWING_
+ | CUME_DIST_
+ | DENSE_RANK_
+ | LAG_
+ | LAST_VALUE_
+ | LEAD_
+ | NTH_VALUE_
+ | NTILE_
+ | PERCENT_RANK_
+ | RANK_
+ | ROW_NUMBER_
+ | GENERATED_
+ | ALWAYS_
+ | STORED_
+ | TRUE_
+ | FALSE_
+ | WINDOW_
+ | NULLS_
+ | FIRST_
+ | LAST_
+ | FILTER_
+ | GROUPS_
+ | EXCLUDE_
+;
+
+// TODO: check all names below
+
+name:
+ any_name
+;
+
+function_name:
+ any_name
+;
+
+schema_name:
+ any_name
+;
+
+table_name:
+ any_name
+;
+
+table_or_index_name:
+ any_name
+;
+
+new_table_name:
+ any_name
+;
+
+column_name:
+ any_name
+;
+
+collation_name:
+ any_name
+;
+
+foreign_table:
+ any_name
+;
+
+index_name:
+ any_name
+;
+
+trigger_name:
+ any_name
+;
+
+view_name:
+ any_name
+;
+
+module_name:
+ any_name
+;
+
+pragma_name:
+ any_name
+;
+
+savepoint_name:
+ any_name
+;
+
+table_alias:
+ any_name
+;
+
+transaction_name:
+ any_name
+;
+
+window_name:
+ any_name
+;
+
+alias:
+ any_name
+;
+
+filename:
+ any_name
+;
+
+base_window_name:
+ any_name
+;
+
+simple_func:
+ any_name
+;
+
+aggregate_func:
+ any_name
+;
+
+table_function_name:
+ any_name
+;
+
+any_name:
+ IDENTIFIER
+ | keyword
+ | STRING_LITERAL
+ | OPEN_PAR any_name CLOSE_PAR
+;
diff --git a/Test/Test.Shared/Test.Shared.projitems b/Test/Test.Shared/Test.Shared.projitems
new file mode 100644
index 0000000..ec0f731
--- /dev/null
+++ b/Test/Test.Shared/Test.Shared.projitems
@@ -0,0 +1,27 @@
+
+
+
+ $(MSBuildAllProjects);$(MSBuildThisFileFullPath)
+ true
+ ed8baf15-5b0b-4027-9b23-dd14b24739db
+
+
+ Test.Shared
+
+
+
+ Always
+
+
+ Always
+
+
+ Always
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Tests.Shared/Tests.Shared.shproj b/Test/Test.Shared/Test.Shared.shproj
similarity index 87%
rename from Tests.Shared/Tests.Shared.shproj
rename to Test/Test.Shared/Test.Shared.shproj
index ff630d8..8886d1d 100644
--- a/Tests.Shared/Tests.Shared.shproj
+++ b/Test/Test.Shared/Test.Shared.shproj
@@ -1,13 +1,13 @@
- 20337a6c-c920-43c8-8b34-665d91eadf89
+ ed8baf15-5b0b-4027-9b23-dd14b24739db
14.0
-
+
diff --git a/Test/Test.Shared/TestContainer.cs b/Test/Test.Shared/TestContainer.cs
new file mode 100644
index 0000000..3b87be4
--- /dev/null
+++ b/Test/Test.Shared/TestContainer.cs
@@ -0,0 +1,60 @@
+using System;
+using System.Linq;
+using Xunit;
+using static ZSpitz.Util.Functions;
+using Antlr4.Runtime;
+using ZSpitz.Util;
+using Antlr4.Runtime.Tree;
+using ParseTreeVisualizer.Serialization;
+using static System.IO.File;
+
+namespace ParseTreeVisualizer.Test {
+ public class TestContainer {
+ public static readonly TheoryData