Is it possible, to ignore non relevant statements, without to write the complete t-sql syntax in the grammar file.
You could do something like this:
file
: unit* EOF
;
unit
: my_interesting_statement
| . // any token
;
my_interesting_statement
: createProcedure sqlBlock
| // other statements here?
;
// parser rules
// lexer rules
// Last lexer rule catches any character
ANY
: .
;
The rule file
will now match zero or more unit
s. A unit
will first try to match one of your my_interesting_statement
, and when this is not possible, the last alternative in the unit
rule, the .
, will match just a single token (that is right: a .
inside a parser rule matches a single token, not a single character).