Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

field type in create statement #238

Open
eturella opened this issue Mar 25, 2020 · 0 comments
Open

field type in create statement #238

eturella opened this issue Mar 25, 2020 · 0 comments

Comments

@eturella
Copy link

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"),
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant