Skip to content

Commit 888f466

Browse files
committed
Add AS keyword support for function parameter declarations
Handle optional AS keyword in function parameter syntax like @param AS datatype. This applies to CREATE FUNCTION, ALTER FUNCTION, and CREATE OR ALTER FUNCTION statements.
1 parent 38fd44b commit 888f466

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

parser/marshal.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10285,6 +10285,11 @@ func (p *Parser) parseAlterFunctionStatement() (*ast.AlterFunctionStatement, err
1028510285
p.nextToken()
1028610286
}
1028710287

10288+
// Skip optional AS keyword (e.g., @param AS int)
10289+
if p.curTok.Type == TokenAs {
10290+
p.nextToken()
10291+
}
10292+
1028810293
// Parse data type if present
1028910294
if p.curTok.Type != TokenRParen && p.curTok.Type != TokenComma && p.curTok.Type != TokenEquals {
1029010295
dataType, err := p.parseDataType()
@@ -10992,6 +10997,11 @@ func (p *Parser) parseCreateFunctionStatement() (*ast.CreateFunctionStatement, e
1099210997
p.nextToken()
1099310998
}
1099410999

11000+
// Skip optional AS keyword (e.g., @param AS int)
11001+
if p.curTok.Type == TokenAs {
11002+
p.nextToken()
11003+
}
11004+
1099511005
// Parse data type if present
1099611006
if p.curTok.Type != TokenRParen && p.curTok.Type != TokenComma {
1099711007
dataType, err := p.parseDataTypeReference()
@@ -11452,6 +11462,11 @@ func (p *Parser) parseCreateOrAlterFunctionStatement() (*ast.CreateOrAlterFuncti
1145211462
p.nextToken()
1145311463
}
1145411464

11465+
// Skip optional AS keyword (e.g., @param AS int)
11466+
if p.curTok.Type == TokenAs {
11467+
p.nextToken()
11468+
}
11469+
1145511470
// Parse data type if present
1145611471
if p.curTok.Type != TokenRParen && p.curTok.Type != TokenComma {
1145711472
dataType, err := p.parseDataTypeReference()

0 commit comments

Comments
 (0)