dimanche 26 avril 2015

Antlr4 mssql convert function grammar

I am looking for grammar for convert(datetime, convert(varchar(10), getdate(), 120))

I have following type of grammar defined,but it throws exception as below

getdate_fn: GETDATE LPAREN RPAREN;
varchar_fn: VARCHAR LPAREN INT RPAREN;
convert_fn: CONVERT LPAREN ( (DATETIME|varchar_fn) COMMA (convert_fn|getdate_fn) ) ((COMMA INT)?) RPAREN;

Exception:

MSSQL::convert_fn:1:34: mismatched input '10' expecting INT
MSSQL::convert_fn:1:49: mismatched input '120' expecting INT

1 commentaire: