field type in create statement
eturella opened this issue · 0 comments
i need to use float or decimal field.
Lexer tag "float" as TokenIdentity when parser need TokenTypeFloat
the following test fails using "float" and "float(15)"
verifyTokens(t, CREATE TABLE articles ( ID int(11) NOT NULL AUTO_INCREMENT, value float NOT NULL DEFAULT '', PRIMARY KEY (ID), -- lets put comments in here CONSTRAINT emails_fk FOREIGN KEY (Email) REFERENCES Emails (Email) ) ENGINE=InnoDB AUTO_INCREMENT=4080 DEFAULT CHARSET=utf8 WITH stuff = "hello";
,
[]Token{
tv(TokenCreate, "CREATE"),
tv(TokenTable, "TABLE"),
tv(TokenIdentity, "articles"),
tv(TokenLeftParenthesis, "("),
tv(TokenIdentity, "ID"),
tv(TokenTypeInteger, "int"),
tv(TokenLeftParenthesis, "("),
tv(TokenInteger, "11"),
tv(TokenRightParenthesis, ")"),
tv(TokenNegate, "NOT"),
tv(TokenNull, "NULL"),
tv(TokenIdentity, "AUTO_INCREMENT"),
tv(TokenComma, ","),
tv(TokenIdentity, "value"),
tv(TokenTypeFloat, "float"),
// tv(TokenLeftParenthesis, "("),
// tv(TokenInteger, "15"),
// tv(TokenRightParenthesis, ")"),
tv(TokenNegate, "NOT"),
tv(TokenNull, "NULL"),
tv(TokenDefault, "DEFAULT"),
tv(TokenValue, ""),
tv(TokenComma, ","),
tv(TokenPrimary, "PRIMARY"),
tv(TokenKey, "KEY"),
tv(TokenLeftParenthesis, "("),
tv(TokenIdentity, "ID"),
tv(TokenRightParenthesis, ")"),
tv(TokenComma, ","),
tv(TokenCommentSingleLine, "--"),
tv(TokenComment, " lets put comments in here"),
tv(TokenConstraint, "CONSTRAINT"),
tv(TokenIdentity, "emails_fk"),
tv(TokenForeign, "FOREIGN"),
tv(TokenKey, "KEY"),
tv(TokenLeftParenthesis, "("),
tv(TokenIdentity, "Email"),
tv(TokenRightParenthesis, ")"),
tv(TokenReferences, "REFERENCES"),
tv(TokenIdentity, "Emails"),
tv(TokenLeftParenthesis, "("),
tv(TokenIdentity, "Email"),
tv(TokenRightParenthesis, ")"),
tv(TokenRightParenthesis, ")"),
tv(TokenEngine, "ENGINE"),
tv(TokenEqual, "="),
tv(TokenIdentity, "InnoDB"),
tv(TokenIdentity, "AUTO_INCREMENT"),
tv(TokenEqual, "="),
tv(TokenInteger, "4080"),
tv(TokenDefault, "DEFAULT"),
tv(TokenIdentity, "CHARSET"),
tv(TokenEqual, "="),
tv(TokenIdentity, "utf8"),
tv(TokenWith, "WITH"),
tv(TokenIdentity, "stuff"),
tv(TokenEqual, "="),
tv(TokenValue, "hello"),
})