cloudspannerecosystem / memefish

memefish is the foundation to analyze Spanner SQL
https://cloudspannerecosystem.dev/memefish/
MIT License
76 stars 19 forks source link

Introduce `parseCommaSeparatedList` #141

Closed makenowjust closed 4 weeks ago

makenowjust commented 4 weeks ago

Discussed in https://github.com/cloudspannerecosystem/memefish/pull/111#discussion_r1804685005

This PR introduces a new function parseCommaSeparatedList. This function is a replacement of the following idiom to parse comma separated list:

    xxxs := []*ast.XXX{p.parseXXX()}
    for p.Token.Kind == "," {
        p.nextToken()
        xxxs = append(xxxs, p.parseXXX())
    }

In fact, this PR reduces about 60 lines of code.