C-style multiple comments fails
When joining subqueries together, having comment in the 2 subqueries is preventing from parsing correctly. Removing any of those comments prevents the issue
The real query can't be shared, I reproduced the pattern with a minimal query following the same pattern
$ transqlate -v -dialect mysql
16:48:31 DEBUG Running transqlate. version=v0.6.5
Type SQL snippet and terminate with ^D
SELECT *
FROM
(
/* some comment */
SELECT *
FROM real_table
) t2
LEFT JOIN
(
/* some other comment */
SELECT *
FROM real_table2
) t4 ON (t4.some_col = t2.another_col AND t4.some_col2 = t2.another_col2)
16:48:33 DEBUG Parsing SQL. source=- dialect=mysql
enter: parseSnippet
┊ enter: parseStatement
┊ ┊ enter: parseExpression precedence=0
┊ ┊ ┊ enter: parseSelect
┊ ┊ ┊ ┊ consume: Keyword "SELECT " pos=1:1
┊ ┊ ┊ ┊ enter: parseAliasedExpression
┊ ┊ ┊ ┊ ┊ enter: parseExpression precedence=0
┊ ┊ ┊ ┊ ┊ ┊ enter: parseLeaf
┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Punctuation "* " pos=1:8
┊ ┊ ┊ ┊ enter: parseFrom
┊ ┊ ┊ ┊ ┊ consume: Keyword "FROM " pos=2:1
┊ ┊ ┊ ┊ ┊ enter: parseFromTables
┊ ┊ ┊ ┊ ┊ ┊ enter: parseTableExpression
┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseExpression precedence=0
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseList
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Punctuation "( " pos=3:1
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseItems
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseExpression precedence=0
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseSelect
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Keyword "SELECT " pos=11:3
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseAliasedExpression
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseExpression precedence=0
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseLeaf
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Punctuation "* " pos=11:10
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseFrom
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Keyword "FROM " pos=12:3
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseFromTables
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseTableExpression
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseExpression precedence=0
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseLeaf
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Identifier "real_table2 " pos=12:8
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Punctuation ") " pos=13:1
┊ ┊ ┊ ┊ ┊ ┊ ┊ enter: parseAlias
┊ ┊ ┊ ┊ ┊ ┊ ┊ ┊ consume: Identifier "t4 " pos=13:3
┊ ┊ error: unexpected: Keyword "ON" pos=13:6
unexpected Keyword: ON at +13:6 -
) t4 ON (t4.some_col = t2.another_col AND t4.some_col2 = t2.another_col2)