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

error #229

Open
nIxedoahz opened this issue Mar 3, 2023 · 6 comments
Open

error #229

nIxedoahz opened this issue Mar 3, 2023 · 6 comments

Comments

@nIxedoahz
Copy link

CREATE TABLE students (
name TEXT,
student_number INTEGER,
city TEXT,grade DOUBLE,
credits BIGINT
)

@dey4ss
Copy link
Member

dey4ss commented Mar 3, 2023

Can you provide some details of the error you get? Currently, I am able to parse the statement successfully.

@nIxedoahz
Copy link
Author

nIxedoahz commented Mar 4, 2023

@dey4ss
like this
Sql is :
CREATE
TABLE XIAOZHAO.table1 (column1 CHAR(11),column2 VARCHAR(100),column3 VARCHAR(100));

Result is :
Given string is not a valid SQL query.
syntax error, unexpected TABLE, expecting SELECT or '(' (L0:0)

@dey4ss
Copy link
Member

dey4ss commented Mar 6, 2023

Does your system use Windows-style line feeds (\r\n instead of \n)? This could be a problem, since we explicitly only allow space, tab, and linefeed (not carriage return) as whitespace in the lexer:

[ \t\n]+ /* skip whitespace */;

@nIxedoahz
Copy link
Author

@dey4ss
My system use Linux
is \n

@nIxedoahz
Copy link
Author

@dey4ss
Will there be other effects if I change it to the following?
[ \t\n]+ /* skip whitespace */ {yymore()};

@dey4ss
Copy link
Member

dey4ss commented Mar 7, 2023

Unfortunately, I won't be able to look into this in the next three to four days. In the meanwhile, could you please also let us know how you invoke the parser (e.g., CLI, inside your code, ...) with a minimal example/snippet and provide some more information about your setup.

Will there be other effects if I change it to the following?
[ \t\n]+ /* skip whitespace */ {yymore()};

Sorry, I cannot answer this right away but will come back on that in a couple of days.
From what I quickly found (no guarantees) here:

yymore will cause the next token's yytext to include the current yytext

it should mess up the tokenization since the whitespaces are included in every following token.

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

2 participants