diff --git a/src/scanner/scanFunction.go b/src/scanner/scanFunction.go index 9a51bdf..f66c1bb 100644 --- a/src/scanner/scanFunction.go +++ b/src/scanner/scanFunction.go @@ -15,7 +15,7 @@ func (s *Scanner) scanFunction(file *fs.File, tokens token.List, i int) (int, er var ( groupLevel = 0 blockLevel = 0 - nameStart = -1 + nameStart = i paramsStart = -1 paramsEnd = -1 bodyStart = -1 @@ -23,29 +23,7 @@ func (s *Scanner) scanFunction(file *fs.File, tokens token.List, i int) (int, er typeEnd = -1 ) - // Function name - for i < len(tokens) { - if tokens[i].Kind == token.Identifier { - nameStart = i - i++ - break - } - - if tokens[i].Kind == token.NewLine || tokens[i].Kind == token.Comment { - i++ - continue - } - - if tokens[i].Kind == token.Invalid { - return i, errors.New(&errors.InvalidCharacter{Character: tokens[i].Text(file.Bytes)}, file, tokens[i].Position) - } - - if tokens[i].Kind == token.EOF { - return i, nil - } - - return i, errors.New(errors.ExpectedFunctionName, file, tokens[i].Position) - } + i++ // Function parameters for i < len(tokens) {