diff --git a/Makefile b/Makefile index 7c730e1..763f0cc 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,11 @@ install: rerun-install: rerun -watch . -ignore out -run sh -c 'go install .' -rerun: +rerun-1: rerun -watch . -ignore out -run sh -c 'go run . -s _examples/e1.ridl' +rerun-2: + rerun -watch . -ignore out -run sh -c 'go run . -s _examples/e2.ridl' + test: go test -v -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/_examples/e1.ridl b/_examples/e1.ridl index 69d90ff..5e18a09 100755 --- a/_examples/e1.ridl +++ b/_examples/e1.ridl @@ -71,7 +71,7 @@ service ExampleService # oof @ auth : ApiKeyAuth @ who dsa : J W T ## dadsadadsa - Ping() - Status() => (status: bool) - @ internal @ public ## dsada s dsa + @ internal @ public @ stringo : " string with spaces" ## dsada s dsa - Version() => (version: Version) @public - GetUser ( header : map < string , string > , userID : uint64 ) => ( code : uint32 , user : User ) diff --git a/formatter/processor.go b/formatter/processor.go index 93521dd..9c6e5f7 100644 --- a/formatter/processor.go +++ b/formatter/processor.go @@ -263,7 +263,12 @@ func (f *form) formatLine(line string) (string, error) { case 1: as = fmt.Sprintf("%s@%s", as, removeSpaces(ap[0])) case 2: - as = fmt.Sprintf("%s@%s:%s", as, removeSpaces(ap[0]), removeSpaces(ap[1])) + v := strings.TrimSpace(ap[1]) + if !strings.HasPrefix(v, `"`) && !strings.HasSuffix(v, `"`) { + v = removeSpaces(v) + } + + as = fmt.Sprintf("%s@%s:%s", as, removeSpaces(ap[0]), v) default: return "", fmt.Errorf("unexpected amount of parts for one anotation parts=(%d) %s", len(ap), line) } diff --git a/main_test.go b/main_test.go index a63edb9..aa57d7f 100644 --- a/main_test.go +++ b/main_test.go @@ -156,7 +156,7 @@ service ExampleService # oof @ auth : ApiKeyAuth @ who dsa : J W T ## dadsadadsa - Ping() - Status() => (status: bool) - @ internal @ public ## dsada s dsa + @ internal @ public @ stringo : " string with spaces " ## dsada s dsa - Version() => (version: Version) @public - GetUser ( header : map < string , string > , userID : uint64 ) => ( code : uint32 , user : User ) @@ -248,7 +248,7 @@ service ExampleService # oof @auth:ApiKeyAuth @whodsa:JWT ## dadsadadsa - Ping() - Status() => (status: bool) - @internal @public ## dsada s dsa + @internal @public @stringo:" string with spaces " ## dsada s dsa - Version() => (version: Version) @public - GetUser(header: map, userID: uint64) => (code: uint32, user: User)