parseBareWordAsString parses any word-like token (identifier or keyword) and returns its value as a string. This is used in contexts where arbitrary user-defined names may collide with SQL keywords (e.g. DCPROPERTIES keys). It advances the parser position and returns "" if no word-like token is fou
()
| 983 | // user-defined names may collide with SQL keywords (e.g. DCPROPERTIES keys). |
| 984 | // It advances the parser position and returns "" if no word-like token is found. |
| 985 | func (p *Parser) parseBareWordAsString() string { |
| 986 | typ := p.currentToken.Token.Type |
| 987 | // Reject punctuation / operator / structural tokens. |
| 988 | switch typ { |
| 989 | case models.TokenTypeEOF, models.TokenTypeEq, models.TokenTypeComma, |
| 990 | models.TokenTypeLParen, models.TokenTypeRParen, |
| 991 | models.TokenTypeLBracket, models.TokenTypeRBracket, |
| 992 | models.TokenTypeLBrace, models.TokenTypeRBrace, |
| 993 | models.TokenTypeSemicolon, models.TokenTypePeriod, |
| 994 | models.TokenTypeUnknown: |
| 995 | return "" |
| 996 | } |
| 997 | if p.currentToken.Token.Value == "" { |
| 998 | return "" |
| 999 | } |
| 1000 | val := p.currentToken.Token.Value |
| 1001 | p.advance() |
| 1002 | return val |
| 1003 | } |
| 1004 | |
| 1005 | // parseObjectName parses an object name (possibly qualified) |
| 1006 | func (p *Parser) parseObjectName() ast.ObjectName { |
no test coverage detected