fixed multiple comment blocks parsing
This commit is contained in:
		
							parent
							
								
									baf4857bee
								
							
						
					
					
						commit
						2124b77a2a
					
				| 
						 | 
					@ -440,7 +440,7 @@ func getQueryTableInfo(app App, selectQuery string) ([]*TableInfoRow, error) {
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	joinReplaceRegex     = regexp.MustCompile(`(?im)\s+(full\s+outer\s+join|left\s+outer\s+join|right\s+outer\s+join|full\s+join|cross\s+join|inner\s+join|outer\s+join|left\s+join|right\s+join|join)\s+?`)
 | 
						joinReplaceRegex     = regexp.MustCompile(`(?im)\s+(full\s+outer\s+join|left\s+outer\s+join|right\s+outer\s+join|full\s+join|cross\s+join|inner\s+join|outer\s+join|left\s+join|right\s+join|join)\s+?`)
 | 
				
			||||||
	discardReplaceRegex  = regexp.MustCompile(`(?im)\s+(where|group\s+by|having|order|limit|with)\s+?`)
 | 
						discardReplaceRegex  = regexp.MustCompile(`(?im)\s+(where|group\s+by|having|order|limit|with)\s+?`)
 | 
				
			||||||
	commentsReplaceRegex = regexp.MustCompile(`(?m)(\/\*[\s\S]+\*\/)|(--.+$)`)
 | 
						commentsReplaceRegex = regexp.MustCompile(`(?m)(\/\*[\s\S]*?\*\/)|(--.+$)`)
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type identifier struct {
 | 
					type identifier struct {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -249,8 +249,8 @@ func TestCreateViewFields(t *testing.T) {
 | 
				
			||||||
				demo1.id,
 | 
									demo1.id,
 | 
				
			||||||
				demo1.text,
 | 
									demo1.text,
 | 
				
			||||||
				/* multi
 | 
									/* multi
 | 
				
			||||||
					line comment */
 | 
									 * line comment block */
 | 
				
			||||||
				demo1.url, demo1.created, demo2.updated from demo1
 | 
									demo1.url, demo1.created, demo1.updated from/* inline comment block with no spaces between the identifiers */demo1
 | 
				
			||||||
				-- comment before join
 | 
									-- comment before join
 | 
				
			||||||
				join demo2 ON (
 | 
									join demo2 ON (
 | 
				
			||||||
					-- comment inside join
 | 
										-- comment inside join
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue