Skip to content

This program, for a given Transact-SQL file, outputs tokens and elements of T-SQL grammar produced by ANTLR

Notifications You must be signed in to change notification settings

andre-wojtowicz/tsql-checker

Repository files navigation

T-SQL checker

This program, for a given Transact-SQL file, outputs tokens and elements of T-SQL grammar produced by ANTLR (ANother Tool for Language Recognition).

Binaries

Windows and Linux binaries can be downloaded from releases.

Usage

Input select.sql:

select * -- inline comment
From   TableName /* multiline
                      comment */
WHERE  someField > ALL (SELECT [val] FROM [AnotherTable]);

Execution:

./tsql-checker.exe select.sql

Output select.tokens:

select
*
From
TableName
WHERE
someField
>
ALL
(
SELECT
[val]
FROM
[AnotherTable]
)
;
<EOF>

Output select.grammar:

tsql_file
batch
sql_clauses
sql_clause
dml_clause
select_statement
query_expression
query_specification
select_list
select_list_elem
asterisk
table_sources
table_source
table_source_item_joined
table_source_item
table_name_with_hint
table_name
id
simple_id
search_condition
search_condition_and
search_condition_not
predicate
expression
full_column_name
id
simple_id
comparison_operator
subquery
select_statement
query_expression
query_specification
select_list
select_list_elem
column_elem
id
table_sources
table_source
table_source_item_joined
table_source_item
table_name_with_hint
table_name
id

Notes

  • TSqlLexer.h, TSqlLexer.cpp, TSqlParser.h and TSqlParser.cpp are generated by ANTLR. They can be updated to the newest version of ANTLR4 grammar for T-SQL by running PowerShell script update-parser-lexer.ps1.
  • The program does not support non-Unicode input files.

About

This program, for a given Transact-SQL file, outputs tokens and elements of T-SQL grammar produced by ANTLR

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages