Tue Sep 4 13:37:23 PDT 2007
- Previous message: [Slony1-commit] slony1-engine/src/parsestatements Makefile cstylecomments.expected cstylecomments.sql scanner.c test_sql.expected test_sql.sql
- Next message: [Slony1-commit] slony1-engine RELEASE config.h.in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/parsestatements In directory main.slony.info:/tmp/cvs-serv4361 Modified Files: Makefile scanner.c Added Files: cstylecomments.expected cstylecomments.sql Log Message: Make C-style comments work, add in test for them --- NEW FILE: cstylecomments.expected --- Input: -- Have two statements separated by a C-style string select * from a; /* select count(distinct person_id) from person join dictionary on dic_category_id=11 left join person_settings on ps_person_id=person_id and ps_did=dic_id where ps_person_id is null -- only 9000! */ select * from b; /************ *foooo* /- * / here is a tremendously ugly C-style comment * * * * * / -- **{***(***[****/ select * from c; /* lets have a comment and a /* nested comment */ */ -- Force a query to be at the end... create table foo; statement 0 ------------------------------------------- -- Have two statements separated by a C-style string select * from a; statement 1 ------------------------------------------- /* select count(distinct person_id) from person join dictionary on dic_category_id=11 left join person_settings on ps_person_id=person_id and ps_did=dic_id where ps_person_id is null -- only 9000! */ select * from b; statement 2 ------------------------------------------- /************ *foooo* /- * / here is a tremendously ugly C-style comment * * * * * / -- **{***(***[****/ select * from c; statement 3 ------------------------------------------- /* lets have a comment and a /* nested comment */ */ -- Force a query to be at the end... create table foo; Index: scanner.c =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/parsestatements/scanner.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** scanner.c 21 Aug 2007 22:17:55 -0000 1.4 --- scanner.c 4 Sep 2007 20:37:21 -0000 1.5 *************** *** 42,45 **** --- 42,47 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; + case ')': if (state == Q_NORMAL_STATE) { *************** *** 47,50 **** --- 49,53 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; case '[': if (state == Q_NORMAL_STATE) { *************** *** 52,55 **** --- 55,59 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; case ']': if (state == Q_NORMAL_STATE) { *************** *** 57,60 **** --- 61,65 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; case '{': if (state == Q_NORMAL_STATE) { *************** *** 62,65 **** --- 67,72 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; + case '}': if (state == Q_NORMAL_STATE) { *************** *** 68,71 **** --- 75,79 ---- } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; case '/': if (state == Q_NORMAL_STATE) { *************** *** 83,86 **** --- 91,99 ---- break; } + if (state == Q_CCOMMENT) { + state = Q_HOPE_CEND; + break; + } + break; case '\\': *************** *** 92,95 **** --- 105,109 ---- } } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case '$': *************** *** 132,135 **** --- 146,150 ---- } } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case '"': *************** *** 146,149 **** --- 161,165 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case '\'': *************** *** 160,163 **** --- 176,180 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case '-': *************** *** 170,173 **** --- 187,191 ---- break; } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case '\n': *************** *** 177,180 **** --- 195,199 ---- if (state == Q_DOLLAR_BUILDING) state = Q_NORMAL_STATE; if (state == Q_DOLLAR_UNBUILDING) state = Q_DOLLAR_QUOTING; + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case '\r': *************** *** 184,191 **** --- 203,212 ---- if (state == Q_DOLLAR_BUILDING) state = Q_NORMAL_STATE; if (state == Q_DOLLAR_UNBUILDING) state = Q_DOLLAR_QUOTING; + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case ' ': if (state == Q_DOLLAR_BUILDING) state = Q_NORMAL_STATE; if (state == Q_DOLLAR_UNBUILDING) state = Q_DOLLAR_QUOTING; + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; case ';': *************** *** 196,201 **** --- 217,224 ---- } } + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; default: + if (state == Q_HOPE_CEND) state = Q_CCOMMENT; break; } Index: Makefile =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/parsestatements/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 1 Jun 2006 08:33:04 -0000 1.4 --- Makefile 4 Sep 2007 20:37:21 -0000 1.5 *************** *** 24,27 **** --- 24,29 ---- ./test-scanner < ./test_sql.sql > test_sql.log cmp ./test_sql.log ./test_sql.expected$(SUFFIX) + ./test-scanner < ./cstylecomments.sql > cstylecomments.log + cmp ./cstylecomments.log ./cstylecomments.expected$(SUFFIX) install: --- NEW FILE: cstylecomments.sql --- -- Have two statements separated by a C-style string select * from a; /* select count(distinct person_id) from person join dictionary on dic_category_id=11 left join person_settings on ps_person_id=person_id and ps_did=dic_id where ps_person_id is null -- only 9000! */ select * from b; /************ *foooo* /- * / here is a tremendously ugly C-style comment * * * * * / -- **{***(***[****/ select * from c; /* lets have a comment and a /* nested comment */ */ -- Force a query to be at the end... create table foo;
- Previous message: [Slony1-commit] slony1-engine/src/parsestatements Makefile cstylecomments.expected cstylecomments.sql scanner.c test_sql.expected test_sql.sql
- Next message: [Slony1-commit] slony1-engine RELEASE config.h.in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list