add anonymous annotation (#134)

* rebase upstream

* rebase

* trim no need line

* trim no need line

* trim no need line

* update doc

* remove update

* remove no need

* remove no need

* goctl add jwt support

* goctl add jwt support

* goctl add jwt support

* goctl support import

* goctl support import

* support return ()

* revert

* refactor and rename folder to group

* remove no need

* add anonymous annotation

* optimized

* rename

* rename

* update test

* optimized new command

Co-authored-by: kingxt <dream4kingxt@163.com>
This commit is contained in:
kingxt
2020-10-16 19:35:18 +08:00
committed by GitHub
parent 7e83895c6e
commit 1d9c4a4c4b
8 changed files with 79 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ import (
type Parser struct {
r *bufio.Reader
typeDef string
api *ApiStruct
}
func NewParser(filename string) (*Parser, error) {
@@ -29,7 +30,7 @@ func NewParser(filename string) (*Parser, error) {
return nil, err
}
apiStruct, err := MatchStruct(string(api))
apiStruct, err := ParseApi(string(api))
if err != nil {
return nil, err
}
@@ -55,6 +56,7 @@ func NewParser(filename string) (*Parser, error) {
return &Parser{
r: bufio.NewReader(buffer),
typeDef: apiStruct.StructBody,
api: apiStruct,
}, nil
}
@@ -66,7 +68,7 @@ func (p *Parser) Parse() (api *spec.ApiSpec, err error) {
return nil, err
}
api.Types = types
var lineNumber = 1
var lineNumber = p.api.serviceBeginLine
st := newRootState(p.r, &lineNumber)
for {
st, err = st.process(api)