diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 21be33c..63f6eea --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ cmd/sub-demo/sub-demo cmd/auth-demo/auth-demo .vscode/ +**/.DS_Store + diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/arvelie/arvelie.go b/arvelie/arvelie.go new file mode 100755 index 0000000..88e59f5 --- /dev/null +++ b/arvelie/arvelie.go @@ -0,0 +1,61 @@ +package arvelie + +import ( + "fmt" + "math" + "strconv" + "strings" + "time" +) + +type Arvelie string + +func (a *Arvelie) isValid() bool { + if a != nil { + return strings.EqualFold(string(*a), string(FromDate(ToDate(*a)))) + } + return false +} + +func ToDate(a Arvelie) time.Time { + y := string(a)[0:2] + m := string(a)[2:3] + d, _ := strconv.Atoi(string(a)[3:5]) + + var mon int + if m == "+" { + mon = 26 + } else { + mon = (int(m[0]) - 65) + } + + doty := (math.Floor(float64(mon)*14) + math.Floor(float64(d)) - 1) + yr, _ := strconv.Atoi(fmt.Sprintf("20%s", y)) + return time.Date(yr, 1, 1, 0, 0, 0, 0, time.UTC).AddDate(0, 0, int(doty)) +} + +func FromDate(date time.Time) Arvelie { + y := date.Format("06") + doty := date.YearDay() + + var m string + if doty == 365 || doty == 366 { + m = "+" + } else { + m = strings.ToUpper(string([]byte{byte(97 + math.Floor(float64(doty/14)))})) + } + + var d string + switch doty { + case 365: + d = fmt.Sprintf("%02d", 1) + break + case 366: + d = fmt.Sprintf("%02d", 2) + break + default: + d = fmt.Sprintf("%02d", (doty % 14)) + } + + return Arvelie(fmt.Sprintf("%s%s%s", y, m, d)) +} diff --git a/arvelie/arvelie_test.go b/arvelie/arvelie_test.go new file mode 100755 index 0000000..166702c --- /dev/null +++ b/arvelie/arvelie_test.go @@ -0,0 +1,53 @@ +package arvelie_test + +import ( + "fmt" + "strings" + "testing" + "time" + + "github.com/jchenry/libs/arvelie" +) + +func TestFromDate(t *testing.T) { + tests := [][]string{ + {"02A01", "2002-01-01"}, + {"13B12", "2013-01-26"}, + {"24C01", "2024-01-29"}, + {"01D07", "2001-02-18"}, + {"02E07", "2002-03-04"}, + {"03+01", "2003-12-31"}, + } + + for i := range tests { + dt, _ := time.Parse("2006-01-02", tests[i][1]) + a := arvelie.FromDate(dt) + expected := tests[i][0] + if !strings.EqualFold(string(a), expected) { + fmt.Printf("%v != %v\n", expected, a) + t.Fail() + } + + } +} + +func TestToDate(t *testing.T) { + tests := [][]string{ + {"02A01", "2002-01-01"}, + {"13B12", "2013-01-26"}, + {"24C01", "2024-01-29"}, + {"01D07", "2001-02-18"}, + {"02E07", "2002-03-04"}, + {"03+01", "2003-12-31"}, + } + + for i := range tests { + d1, _ := time.Parse("2006-01-02", tests[i][1]) + dt := arvelie.ToDate(arvelie.Arvelie(tests[i][0])) + if !d1.Equal(dt) { + fmt.Printf("%s != %s\n", d1, dt) + t.Fail() + } + } + +} diff --git a/arvelie/doc.go b/arvelie/doc.go new file mode 100755 index 0000000..f1d5d2e --- /dev/null +++ b/arvelie/doc.go @@ -0,0 +1,15 @@ +package arvelie + +// The Arvelie Calendar has 26 months of 14 days each. +// Each month has 2 weeks of 7 days, and each month's name is one of the 26 letters of the alphabet. +// The 365th day of the year is the Year Day(+01), preceded by the Leap Day(+02) on leap years. +// +//Examples: +// 02A01 2002-01-01 +// 13B12 2013-01-26 +// 24C01 2024-01-29 +// 01D07 2001-02-18 +// 02E07 2002-03-04 +// 03+01 2003-12-31 + +// Boosted lovingly from https://github.com/XXIIVV/Oscean/blob/master/scripts/lib/arvelie.js diff --git a/auth/auth.go b/auth/auth.go old mode 100644 new mode 100755 diff --git a/auth/callback.go b/auth/callback.go old mode 100644 new mode 100755 diff --git a/auth/config.go b/auth/config.go old mode 100644 new mode 100755 diff --git a/auth/login.go b/auth/login.go old mode 100644 new mode 100755 diff --git a/auth/logout.go b/auth/logout.go old mode 100644 new mode 100755 diff --git a/auth/middleware.go b/auth/middleware.go old mode 100644 new mode 100755 diff --git a/auth/service.go b/auth/service.go old mode 100644 new mode 100755 diff --git a/auth/session.go b/auth/session.go old mode 100644 new mode 100755 diff --git a/auth/user.go b/auth/user.go old mode 100644 new mode 100755 diff --git a/cmd/auth-demo/home.html b/cmd/auth-demo/home.html old mode 100644 new mode 100755 diff --git a/cmd/auth-demo/main.go b/cmd/auth-demo/main.go old mode 100644 new mode 100755 diff --git a/cmd/auth-demo/public/app.css b/cmd/auth-demo/public/app.css old mode 100644 new mode 100755 diff --git a/cmd/auth-demo/user.html b/cmd/auth-demo/user.html old mode 100644 new mode 100755 diff --git a/cmd/now/main.go b/cmd/now/main.go new file mode 100755 index 0000000..e5c23d1 --- /dev/null +++ b/cmd/now/main.go @@ -0,0 +1,13 @@ +package main + +import ( + "fmt" + "time" + + "github.com/jchenry/libs/neralie" +) + +func main() { + a := neralie.FromTime(time.Now()) + fmt.Println(a) +} diff --git a/cmd/now/now b/cmd/now/now new file mode 100755 index 0000000..2362686 Binary files /dev/null and b/cmd/now/now differ diff --git a/cmd/openapi-tinkertoy/out/go/.gitignore b/cmd/openapi-tinkertoy/out/go/.gitignore new file mode 100644 index 0000000..daf913b --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/cmd/openapi-tinkertoy/out/go/.openapi-generator-ignore b/cmd/openapi-tinkertoy/out/go/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/cmd/openapi-tinkertoy/out/go/.openapi-generator/VERSION b/cmd/openapi-tinkertoy/out/go/.openapi-generator/VERSION new file mode 100644 index 0000000..d99e716 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.0.0-SNAPSHOT \ No newline at end of file diff --git a/cmd/openapi-tinkertoy/out/go/.travis.yml b/cmd/openapi-tinkertoy/out/go/.travis.yml new file mode 100644 index 0000000..f5cb2ce --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/cmd/openapi-tinkertoy/out/go/Dockerfile b/cmd/openapi-tinkertoy/out/go/Dockerfile new file mode 100644 index 0000000..e1baa3a --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.10 AS build +WORKDIR /go/src +COPY go ./go +COPY main.go . + +ENV CGO_ENABLED=0 +RUN go get -d -v ./... + +RUN go build -a -installsuffix cgo -o openapi . + +FROM scratch AS runtime +COPY --from=build /go/src/openapi ./ +EXPOSE 8080/tcp +ENTRYPOINT ["./openapi"] diff --git a/cmd/openapi-tinkertoy/out/go/README.md b/cmd/openapi-tinkertoy/out/go/README.md new file mode 100644 index 0000000..b566165 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/README.md @@ -0,0 +1,120 @@ +# Go API client for openapi + +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```shell +go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 +go get golang.org/x/net/context +go get github.com/antihax/optional +``` + +Put the package under your project folder and add the following in import: + +```golang +import "./openapi" +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **Post** /pet | Add a new pet to the store +*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **Delete** /pet/{petId} | Deletes a pet +*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **Get** /pet/findByStatus | Finds Pets by status +*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **Get** /pet/findByTags | Finds Pets by tags +*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **Get** /pet/{petId} | Find pet by ID +*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **Put** /pet | Update an existing pet +*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **Post** /pet/{petId} | Updates a pet in the store with form data +*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **Post** /pet/{petId}/uploadImage | uploads an image +*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **Delete** /store/order/{orderId} | Delete purchase order by ID +*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status +*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **Get** /store/order/{orderId} | Find purchase order by ID +*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **Post** /store/order | Place an order for a pet +*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **Post** /user | Create user +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **Post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **Post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **Get** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **Get** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **Get** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Put** /user/{username} | Updated user + + +## Documentation For Models + + - [ApiResponse](docs/ApiResponse.md) + - [Category](docs/Category.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation For Authorization + + + +## api_key + +- **Type**: API key + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. +}) +r, err := client.Service.Operation(auth, args) +``` + + +## petstore_auth + + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +Example + +```golang +auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") +r, err := client.Service.Operation(auth, args) +``` + +Or via OAuth2 module to automatically refresh tokens and perform user authentication. + +```golang +import "golang.org/x/oauth2" + +/* Perform OAuth2 round trip request and obtain a token */ + +tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) +auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) +r, err := client.Service.Operation(auth, args) +``` + + + +## Author + + + diff --git a/cmd/openapi-tinkertoy/out/go/api.go b/cmd/openapi-tinkertoy/out/go/api.go new file mode 100644 index 0000000..a190106 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api.go @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "net/http" + "os" +) + + +// PetApiRouter defines the required methods for binding the api requests to a responses for the PetApi +// The PetApiRouter implementation should parse necessary information from the http request, +// pass the data to a PetApiServicer to perform the required actions, then write the service results to the http response. +type PetApiRouter interface { + AddPet(http.ResponseWriter, *http.Request) + DeletePet(http.ResponseWriter, *http.Request) + FindPetsByStatus(http.ResponseWriter, *http.Request) + FindPetsByTags(http.ResponseWriter, *http.Request) + GetPetById(http.ResponseWriter, *http.Request) + UpdatePet(http.ResponseWriter, *http.Request) + UpdatePetWithForm(http.ResponseWriter, *http.Request) + UploadFile(http.ResponseWriter, *http.Request) +} +// StoreApiRouter defines the required methods for binding the api requests to a responses for the StoreApi +// The StoreApiRouter implementation should parse necessary information from the http request, +// pass the data to a StoreApiServicer to perform the required actions, then write the service results to the http response. +type StoreApiRouter interface { + DeleteOrder(http.ResponseWriter, *http.Request) + GetInventory(http.ResponseWriter, *http.Request) + GetOrderById(http.ResponseWriter, *http.Request) + PlaceOrder(http.ResponseWriter, *http.Request) +} +// UserApiRouter defines the required methods for binding the api requests to a responses for the UserApi +// The UserApiRouter implementation should parse necessary information from the http request, +// pass the data to a UserApiServicer to perform the required actions, then write the service results to the http response. +type UserApiRouter interface { + CreateUser(http.ResponseWriter, *http.Request) + CreateUsersWithArrayInput(http.ResponseWriter, *http.Request) + CreateUsersWithListInput(http.ResponseWriter, *http.Request) + DeleteUser(http.ResponseWriter, *http.Request) + GetUserByName(http.ResponseWriter, *http.Request) + LoginUser(http.ResponseWriter, *http.Request) + LogoutUser(http.ResponseWriter, *http.Request) + UpdateUser(http.ResponseWriter, *http.Request) +} + + +// PetApiServicer defines the api actions for the PetApi service +// This interface intended to stay up to date with the openapi yaml used to generate it, +// while the service implementation can ignored with the .openapi-generator-ignore file +// and updated with the logic required for the API. +type PetApiServicer interface { + AddPet(Pet) (interface{}, error) + DeletePet(int64, string) (interface{}, error) + FindPetsByStatus([]string) (interface{}, error) + FindPetsByTags([]string) (interface{}, error) + GetPetById(int64) (interface{}, error) + UpdatePet(Pet) (interface{}, error) + UpdatePetWithForm(int64, string, string) (interface{}, error) + UploadFile(int64, string, *os.File) (interface{}, error) +} + + +// StoreApiServicer defines the api actions for the StoreApi service +// This interface intended to stay up to date with the openapi yaml used to generate it, +// while the service implementation can ignored with the .openapi-generator-ignore file +// and updated with the logic required for the API. +type StoreApiServicer interface { + DeleteOrder(string) (interface{}, error) + GetInventory() (interface{}, error) + GetOrderById(int64) (interface{}, error) + PlaceOrder(Order) (interface{}, error) +} + + +// UserApiServicer defines the api actions for the UserApi service +// This interface intended to stay up to date with the openapi yaml used to generate it, +// while the service implementation can ignored with the .openapi-generator-ignore file +// and updated with the logic required for the API. +type UserApiServicer interface { + CreateUser(User) (interface{}, error) + CreateUsersWithArrayInput([]User) (interface{}, error) + CreateUsersWithListInput([]User) (interface{}, error) + DeleteUser(string) (interface{}, error) + GetUserByName(string) (interface{}, error) + LoginUser(string, string) (interface{}, error) + LogoutUser() (interface{}, error) + UpdateUser(string, User) (interface{}, error) +} diff --git a/cmd/openapi-tinkertoy/out/go/api/openapi.yaml b/cmd/openapi-tinkertoy/out/go/api/openapi.yaml new file mode 100644 index 0000000..0c61c20 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api/openapi.yaml @@ -0,0 +1,762 @@ +openapi: 3.0.1 +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + "405": + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + "200": + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + "400": + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "400": + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + "405": + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + "200": + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + "400": + content: {} + description: Invalid ID supplied + "404": + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when toekn expires + schema: + format: date-time + type: string + "400": + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + "200": + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + "400": + content: {} + description: Invalid username supplied + "404": + content: {} + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + "400": + content: {} + description: Invalid user supplied + "404": + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body +components: + schemas: + Order: + description: An order for a pets from the pet store + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey diff --git a/cmd/openapi-tinkertoy/out/go/api_pet.go b/cmd/openapi-tinkertoy/out/go/api_pet.go new file mode 100644 index 0000000..801bd55 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api_pet.go @@ -0,0 +1,236 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "encoding/json" + "net/http" + "strings" + + "github.com/gorilla/mux" +) + +// A PetApiController binds http requests to an api service and writes the service results to the http response +type PetApiController struct { + service PetApiServicer +} + +// NewPetApiController creates a default api controller +func NewPetApiController(s PetApiServicer) Router { + return &PetApiController{ service: s } +} + +// Routes returns all of the api route for the PetApiController +func (c *PetApiController) Routes() Routes { + return Routes{ + { + "AddPet", + strings.ToUpper("Post"), + "/v2/pet", + c.AddPet, + }, + { + "DeletePet", + strings.ToUpper("Delete"), + "/v2/pet/{petId}", + c.DeletePet, + }, + { + "FindPetsByStatus", + strings.ToUpper("Get"), + "/v2/pet/findByStatus", + c.FindPetsByStatus, + }, + { + "FindPetsByTags", + strings.ToUpper("Get"), + "/v2/pet/findByTags", + c.FindPetsByTags, + }, + { + "GetPetById", + strings.ToUpper("Get"), + "/v2/pet/{petId}", + c.GetPetById, + }, + { + "UpdatePet", + strings.ToUpper("Put"), + "/v2/pet", + c.UpdatePet, + }, + { + "UpdatePetWithForm", + strings.ToUpper("Post"), + "/v2/pet/{petId}", + c.UpdatePetWithForm, + }, + { + "UploadFile", + strings.ToUpper("Post"), + "/v2/pet/{petId}/uploadImage", + c.UploadFile, + }, + } +} + +// AddPet - Add a new pet to the store +func (c *PetApiController) AddPet(w http.ResponseWriter, r *http.Request) { + body := &Pet{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.AddPet(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// DeletePet - Deletes a pet +func (c *PetApiController) DeletePet(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + apiKey := r.Header.Get("apiKey") + result, err := c.service.DeletePet(petId, apiKey) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// FindPetsByStatus - Finds Pets by status +func (c *PetApiController) FindPetsByStatus(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + status := strings.Split(query.Get("status"), ",") + result, err := c.service.FindPetsByStatus(status) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// FindPetsByTags - Finds Pets by tags +func (c *PetApiController) FindPetsByTags(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + tags := strings.Split(query.Get("tags"), ",") + result, err := c.service.FindPetsByTags(tags) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// GetPetById - Find pet by ID +func (c *PetApiController) GetPetById(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.GetPetById(petId) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// UpdatePet - Update an existing pet +func (c *PetApiController) UpdatePet(w http.ResponseWriter, r *http.Request) { + body := &Pet{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.UpdatePet(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// UpdatePetWithForm - Updates a pet in the store with form data +func (c *PetApiController) UpdatePetWithForm(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + name := r.FormValue("name") + status := r.FormValue("status") + result, err := c.service.UpdatePetWithForm(petId, name, status) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// UploadFile - uploads an image +func (c *PetApiController) UploadFile(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + w.WriteHeader(500) + return + } + + params := mux.Vars(r) + petId, err := parseIntParameter(params["petId"]) + if err != nil { + w.WriteHeader(500) + return + } + + additionalMetadata := r.FormValue("additionalMetadata") + file, err := ReadFormFileToTempFile(r, "file") + if err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.UploadFile(petId, additionalMetadata, file) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} diff --git a/cmd/openapi-tinkertoy/out/go/api_pet_service.go b/cmd/openapi-tinkertoy/out/go/api_pet_service.go new file mode 100644 index 0000000..77471f6 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api_pet_service.go @@ -0,0 +1,82 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "errors" + "os" +) + +// PetApiService is a service that implents the logic for the PetApiServicer +// This service should implement the business logic for every endpoint for the PetApi API. +// Include any external packages or services that will be required by this service. +type PetApiService struct { +} + +// NewPetApiService creates a default api service +func NewPetApiService() PetApiServicer { + return &PetApiService{} +} + +// AddPet - Add a new pet to the store +func (s *PetApiService) AddPet(body Pet) (interface{}, error) { + // TODO - update AddPet with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'AddPet' not implemented") +} + +// DeletePet - Deletes a pet +func (s *PetApiService) DeletePet(petId int64, apiKey string) (interface{}, error) { + // TODO - update DeletePet with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'DeletePet' not implemented") +} + +// FindPetsByStatus - Finds Pets by status +func (s *PetApiService) FindPetsByStatus(status []string) (interface{}, error) { + // TODO - update FindPetsByStatus with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'FindPetsByStatus' not implemented") +} + +// FindPetsByTags - Finds Pets by tags +func (s *PetApiService) FindPetsByTags(tags []string) (interface{}, error) { + // TODO - update FindPetsByTags with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'FindPetsByTags' not implemented") +} + +// GetPetById - Find pet by ID +func (s *PetApiService) GetPetById(petId int64) (interface{}, error) { + // TODO - update GetPetById with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'GetPetById' not implemented") +} + +// UpdatePet - Update an existing pet +func (s *PetApiService) UpdatePet(body Pet) (interface{}, error) { + // TODO - update UpdatePet with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'UpdatePet' not implemented") +} + +// UpdatePetWithForm - Updates a pet in the store with form data +func (s *PetApiService) UpdatePetWithForm(petId int64, name string, status string) (interface{}, error) { + // TODO - update UpdatePetWithForm with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'UpdatePetWithForm' not implemented") +} + +// UploadFile - uploads an image +func (s *PetApiService) UploadFile(petId int64, additionalMetadata string, file *os.File) (interface{}, error) { + // TODO - update UploadFile with the required logic for this service method. + // Add api_pet_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'UploadFile' not implemented") +} diff --git a/cmd/openapi-tinkertoy/out/go/api_store.go b/cmd/openapi-tinkertoy/out/go/api_store.go new file mode 100644 index 0000000..19eb691 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api_store.go @@ -0,0 +1,117 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "encoding/json" + "net/http" + "strings" + + "github.com/gorilla/mux" +) + +// A StoreApiController binds http requests to an api service and writes the service results to the http response +type StoreApiController struct { + service StoreApiServicer +} + +// NewStoreApiController creates a default api controller +func NewStoreApiController(s StoreApiServicer) Router { + return &StoreApiController{ service: s } +} + +// Routes returns all of the api route for the StoreApiController +func (c *StoreApiController) Routes() Routes { + return Routes{ + { + "DeleteOrder", + strings.ToUpper("Delete"), + "/v2/store/order/{orderId}", + c.DeleteOrder, + }, + { + "GetInventory", + strings.ToUpper("Get"), + "/v2/store/inventory", + c.GetInventory, + }, + { + "GetOrderById", + strings.ToUpper("Get"), + "/v2/store/order/{orderId}", + c.GetOrderById, + }, + { + "PlaceOrder", + strings.ToUpper("Post"), + "/v2/store/order", + c.PlaceOrder, + }, + } +} + +// DeleteOrder - Delete purchase order by ID +func (c *StoreApiController) DeleteOrder(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + orderId := params["orderId"] + result, err := c.service.DeleteOrder(orderId) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// GetInventory - Returns pet inventories by status +func (c *StoreApiController) GetInventory(w http.ResponseWriter, r *http.Request) { + result, err := c.service.GetInventory() + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// GetOrderById - Find purchase order by ID +func (c *StoreApiController) GetOrderById(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + orderId, err := parseIntParameter(params["orderId"]) + if err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.GetOrderById(orderId) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// PlaceOrder - Place an order for a pet +func (c *StoreApiController) PlaceOrder(w http.ResponseWriter, r *http.Request) { + body := &Order{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.PlaceOrder(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} diff --git a/cmd/openapi-tinkertoy/out/go/api_store_service.go b/cmd/openapi-tinkertoy/out/go/api_store_service.go new file mode 100644 index 0000000..f29b5e6 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api_store_service.go @@ -0,0 +1,53 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "errors" +) + +// StoreApiService is a service that implents the logic for the StoreApiServicer +// This service should implement the business logic for every endpoint for the StoreApi API. +// Include any external packages or services that will be required by this service. +type StoreApiService struct { +} + +// NewStoreApiService creates a default api service +func NewStoreApiService() StoreApiServicer { + return &StoreApiService{} +} + +// DeleteOrder - Delete purchase order by ID +func (s *StoreApiService) DeleteOrder(orderId string) (interface{}, error) { + // TODO - update DeleteOrder with the required logic for this service method. + // Add api_store_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'DeleteOrder' not implemented") +} + +// GetInventory - Returns pet inventories by status +func (s *StoreApiService) GetInventory() (interface{}, error) { + // TODO - update GetInventory with the required logic for this service method. + // Add api_store_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'GetInventory' not implemented") +} + +// GetOrderById - Find purchase order by ID +func (s *StoreApiService) GetOrderById(orderId int64) (interface{}, error) { + // TODO - update GetOrderById with the required logic for this service method. + // Add api_store_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'GetOrderById' not implemented") +} + +// PlaceOrder - Place an order for a pet +func (s *StoreApiService) PlaceOrder(body Order) (interface{}, error) { + // TODO - update PlaceOrder with the required logic for this service method. + // Add api_store_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'PlaceOrder' not implemented") +} diff --git a/cmd/openapi-tinkertoy/out/go/api_user.go b/cmd/openapi-tinkertoy/out/go/api_user.go new file mode 100644 index 0000000..5756c68 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api_user.go @@ -0,0 +1,203 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "encoding/json" + "net/http" + "strings" + + "github.com/gorilla/mux" +) + +// A UserApiController binds http requests to an api service and writes the service results to the http response +type UserApiController struct { + service UserApiServicer +} + +// NewUserApiController creates a default api controller +func NewUserApiController(s UserApiServicer) Router { + return &UserApiController{ service: s } +} + +// Routes returns all of the api route for the UserApiController +func (c *UserApiController) Routes() Routes { + return Routes{ + { + "CreateUser", + strings.ToUpper("Post"), + "/v2/user", + c.CreateUser, + }, + { + "CreateUsersWithArrayInput", + strings.ToUpper("Post"), + "/v2/user/createWithArray", + c.CreateUsersWithArrayInput, + }, + { + "CreateUsersWithListInput", + strings.ToUpper("Post"), + "/v2/user/createWithList", + c.CreateUsersWithListInput, + }, + { + "DeleteUser", + strings.ToUpper("Delete"), + "/v2/user/{username}", + c.DeleteUser, + }, + { + "GetUserByName", + strings.ToUpper("Get"), + "/v2/user/{username}", + c.GetUserByName, + }, + { + "LoginUser", + strings.ToUpper("Get"), + "/v2/user/login", + c.LoginUser, + }, + { + "LogoutUser", + strings.ToUpper("Get"), + "/v2/user/logout", + c.LogoutUser, + }, + { + "UpdateUser", + strings.ToUpper("Put"), + "/v2/user/{username}", + c.UpdateUser, + }, + } +} + +// CreateUser - Create user +func (c *UserApiController) CreateUser(w http.ResponseWriter, r *http.Request) { + body := &User{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.CreateUser(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// CreateUsersWithArrayInput - Creates list of users with given input array +func (c *UserApiController) CreateUsersWithArrayInput(w http.ResponseWriter, r *http.Request) { + body := &[]User{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.CreateUsersWithArrayInput(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// CreateUsersWithListInput - Creates list of users with given input array +func (c *UserApiController) CreateUsersWithListInput(w http.ResponseWriter, r *http.Request) { + body := &[]User{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.CreateUsersWithListInput(*body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// DeleteUser - Delete user +func (c *UserApiController) DeleteUser(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + username := params["username"] + result, err := c.service.DeleteUser(username) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// GetUserByName - Get user by user name +func (c *UserApiController) GetUserByName(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + username := params["username"] + result, err := c.service.GetUserByName(username) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// LoginUser - Logs user into the system +func (c *UserApiController) LoginUser(w http.ResponseWriter, r *http.Request) { + query := r.URL.Query() + username := query.Get("username") + password := query.Get("password") + result, err := c.service.LoginUser(username, password) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// LogoutUser - Logs out current logged in user session +func (c *UserApiController) LogoutUser(w http.ResponseWriter, r *http.Request) { + result, err := c.service.LogoutUser() + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} + +// UpdateUser - Updated user +func (c *UserApiController) UpdateUser(w http.ResponseWriter, r *http.Request) { + params := mux.Vars(r) + username := params["username"] + body := &User{} + if err := json.NewDecoder(r.Body).Decode(&body); err != nil { + w.WriteHeader(500) + return + } + + result, err := c.service.UpdateUser(username, *body) + if err != nil { + w.WriteHeader(500) + return + } + + EncodeJSONResponse(result, nil, w) +} diff --git a/cmd/openapi-tinkertoy/out/go/api_user_service.go b/cmd/openapi-tinkertoy/out/go/api_user_service.go new file mode 100644 index 0000000..01867b5 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/api_user_service.go @@ -0,0 +1,81 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "errors" +) + +// UserApiService is a service that implents the logic for the UserApiServicer +// This service should implement the business logic for every endpoint for the UserApi API. +// Include any external packages or services that will be required by this service. +type UserApiService struct { +} + +// NewUserApiService creates a default api service +func NewUserApiService() UserApiServicer { + return &UserApiService{} +} + +// CreateUser - Create user +func (s *UserApiService) CreateUser(body User) (interface{}, error) { + // TODO - update CreateUser with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'CreateUser' not implemented") +} + +// CreateUsersWithArrayInput - Creates list of users with given input array +func (s *UserApiService) CreateUsersWithArrayInput(body []User) (interface{}, error) { + // TODO - update CreateUsersWithArrayInput with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'CreateUsersWithArrayInput' not implemented") +} + +// CreateUsersWithListInput - Creates list of users with given input array +func (s *UserApiService) CreateUsersWithListInput(body []User) (interface{}, error) { + // TODO - update CreateUsersWithListInput with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'CreateUsersWithListInput' not implemented") +} + +// DeleteUser - Delete user +func (s *UserApiService) DeleteUser(username string) (interface{}, error) { + // TODO - update DeleteUser with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'DeleteUser' not implemented") +} + +// GetUserByName - Get user by user name +func (s *UserApiService) GetUserByName(username string) (interface{}, error) { + // TODO - update GetUserByName with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'GetUserByName' not implemented") +} + +// LoginUser - Logs user into the system +func (s *UserApiService) LoginUser(username string, password string) (interface{}, error) { + // TODO - update LoginUser with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'LoginUser' not implemented") +} + +// LogoutUser - Logs out current logged in user session +func (s *UserApiService) LogoutUser() (interface{}, error) { + // TODO - update LogoutUser with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'LogoutUser' not implemented") +} + +// UpdateUser - Updated user +func (s *UserApiService) UpdateUser(username string, body User) (interface{}, error) { + // TODO - update UpdateUser with the required logic for this service method. + // Add api_user_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. + return nil, errors.New("service method 'UpdateUser' not implemented") +} diff --git a/cmd/openapi-tinkertoy/out/go/client.go b/cmd/openapi-tinkertoy/out/go/client.go new file mode 100644 index 0000000..f638404 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/client.go @@ -0,0 +1,548 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "io/ioutil" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "golang.org/x/oauth2" +) + +var ( + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) +) + +// APIClient manages communication with the OpenAPI Petstore API v1.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + PetApi *PetApiService + + StoreApi *StoreApiService + + UserApi *UserApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.PetApi = (*PetApiService)(&c.common) + c.StoreApi = (*StoreApiService)(&c.common) + c.UserApi = (*UserApiService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insenstive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.ToLower(a) == strings.ToLower(needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string + + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," + } + + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) + } + + return fmt.Sprintf("%v", obj) +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + + return resp, err +} + +// ChangeBasePath changes base path to allow switching to mocks +func (c *APIClient) ChangeBasePath(path string) { + c.cfg.BasePath = path +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFileName string, + fileName string, + fileBytes []byte) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + if len(fileBytes) > 0 && fileName != "" { + w.Boundary() + //_, fileNm := filepath.Split(fileName) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(fileBytes) + if err != nil { + return nil, err + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = query.Encode() + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers.Set(h, v) + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(**os.File); ok { + *f, err = ioutil.TempFile("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + _, err = (*f).Seek(0, io.SeekStart) + return + } + if xmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if jsonCheck.MatchString(contentType) { + if err = json.Unmarshal(b, v); err != nil { + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(path) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if jsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if xmlCheck.MatchString(contentType) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("Invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} diff --git a/cmd/openapi-tinkertoy/out/go/configuration.go b/cmd/openapi-tinkertoy/out/go/configuration.go new file mode 100644 index 0000000..158fafe --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/configuration.go @@ -0,0 +1,130 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKey takes an APIKey as authentication for the request + ContextAPIKey = contextKey("apikey") + +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + Url string + Description string + Variables map[string]ServerVariable +} + +// Configuration stores the configuration of the API client +type Configuration struct { + BasePath string `json:"basePath,omitempty"` + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers []ServerConfiguration + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + BasePath: "http://petstore.swagger.io/v2", + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: []ServerConfiguration{ + { + Url: "http://petstore.swagger.io/v2", + Description: "No description provided", + }, + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// ServerUrl returns URL based on server settings +func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error) { + if index < 0 || len(c.Servers) <= index { + return "", fmt.Errorf("Index %v out of range %v", index, len(c.Servers) - 1) + } + server := c.Servers[index] + url := server.Url + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("The variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} diff --git a/cmd/openapi-tinkertoy/out/go/docs/ApiResponse.md b/cmd/openapi-tinkertoy/out/go/docs/ApiResponse.md new file mode 100644 index 0000000..41d28fb --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/ApiResponse.md @@ -0,0 +1,13 @@ +# ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int32** | | [optional] +**Type** | **string** | | [optional] +**Message** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/cmd/openapi-tinkertoy/out/go/docs/Category.md b/cmd/openapi-tinkertoy/out/go/docs/Category.md new file mode 100644 index 0000000..f4ae25d --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/Category.md @@ -0,0 +1,12 @@ +# Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/cmd/openapi-tinkertoy/out/go/docs/Order.md b/cmd/openapi-tinkertoy/out/go/docs/Order.md new file mode 100644 index 0000000..eeef097 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/Order.md @@ -0,0 +1,16 @@ +# Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**PetId** | **int64** | | [optional] +**Quantity** | **int32** | | [optional] +**ShipDate** | [**time.Time**](time.Time.md) | | [optional] +**Status** | **string** | Order Status | [optional] +**Complete** | **bool** | | [optional] [default to false] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/cmd/openapi-tinkertoy/out/go/docs/Pet.md b/cmd/openapi-tinkertoy/out/go/docs/Pet.md new file mode 100644 index 0000000..c48104c --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/Pet.md @@ -0,0 +1,16 @@ +# Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**PhotoUrls** | **[]string** | | +**Tags** | [**[]Tag**](Tag.md) | | [optional] +**Status** | **string** | pet status in the store | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/cmd/openapi-tinkertoy/out/go/docs/PetApi.md b/cmd/openapi-tinkertoy/out/go/docs/PetApi.md new file mode 100644 index 0000000..2b89172 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/PetApi.md @@ -0,0 +1,313 @@ +# \PetApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**AddPet**](PetApi.md#AddPet) | **Post** /pet | Add a new pet to the store +[**DeletePet**](PetApi.md#DeletePet) | **Delete** /pet/{petId} | Deletes a pet +[**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **Get** /pet/findByStatus | Finds Pets by status +[**FindPetsByTags**](PetApi.md#FindPetsByTags) | **Get** /pet/findByTags | Finds Pets by tags +[**GetPetById**](PetApi.md#GetPetById) | **Get** /pet/{petId} | Find pet by ID +[**UpdatePet**](PetApi.md#UpdatePet) | **Put** /pet | Update an existing pet +[**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **Post** /pet/{petId} | Updates a pet in the store with form data +[**UploadFile**](PetApi.md#UploadFile) | **Post** /pet/{petId}/uploadImage | uploads an image + + + +## AddPet + +> AddPet(ctx, body) + +Add a new pet to the store + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeletePet + +> DeletePet(ctx, petId, optional) + +Deletes a pet + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| Pet id to delete | + **optional** | ***DeletePetOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a DeletePetOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **apiKey** | **optional.String**| | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FindPetsByStatus + +> []Pet FindPetsByStatus(ctx, status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**status** | [**[]string**](string.md)| Status values that need to be considered for filter | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FindPetsByTags + +> []Pet FindPetsByTags(ctx, tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**tags** | [**[]string**](string.md)| Tags to filter by | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPetById + +> Pet GetPetById(ctx, petId) + +Find pet by ID + +Returns a single pet + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdatePet + +> UpdatePet(ctx, body) + +Update an existing pet + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdatePetWithForm + +> UpdatePetWithForm(ctx, petId, optional) + +Updates a pet in the store with form data + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet that needs to be updated | + **optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **name** | **optional.String**| Updated name of the pet | + **status** | **optional.String**| Updated status of the pet | + +### Return type + + (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UploadFile + +> ApiResponse UploadFile(ctx, petId, optional) + +uploads an image + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to update | + **optional** | ***UploadFileOpts** | optional parameters | nil if no parameters + +### Optional Parameters + +Optional parameters are passed through a pointer to a UploadFileOpts struct + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **additionalMetadata** | **optional.String**| Additional data to pass to server | + **file** | **optional.Interface of *os.File****optional.*os.File**| file to upload | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + +- **Content-Type**: multipart/form-data +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/cmd/openapi-tinkertoy/out/go/docs/StoreApi.md b/cmd/openapi-tinkertoy/out/go/docs/StoreApi.md new file mode 100644 index 0000000..dea9f9a --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/StoreApi.md @@ -0,0 +1,142 @@ +# \StoreApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**DeleteOrder**](StoreApi.md#DeleteOrder) | **Delete** /store/order/{orderId} | Delete purchase order by ID +[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status +[**GetOrderById**](StoreApi.md#GetOrderById) | **Get** /store/order/{orderId} | Find purchase order by ID +[**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet + + + +## DeleteOrder + +> DeleteOrder(ctx, orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **string**| ID of the order that needs to be deleted | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetInventory + +> map[string]int32 GetInventory(ctx, ) + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + +**map[string]int32** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetOrderById + +> Order GetOrderById(ctx, orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **int64**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## PlaceOrder + +> Order PlaceOrder(ctx, body) + +Place an order for a pet + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/cmd/openapi-tinkertoy/out/go/docs/Tag.md b/cmd/openapi-tinkertoy/out/go/docs/Tag.md new file mode 100644 index 0000000..d6b3cc1 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/Tag.md @@ -0,0 +1,12 @@ +# Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/cmd/openapi-tinkertoy/out/go/docs/User.md b/cmd/openapi-tinkertoy/out/go/docs/User.md new file mode 100644 index 0000000..7675d7f --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/User.md @@ -0,0 +1,18 @@ +# User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] +**Username** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Email** | **string** | | [optional] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int32** | User Status | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/cmd/openapi-tinkertoy/out/go/docs/UserApi.md b/cmd/openapi-tinkertoy/out/go/docs/UserApi.md new file mode 100644 index 0000000..1c96b2e --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/docs/UserApi.md @@ -0,0 +1,276 @@ +# \UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#CreateUser) | **Post** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#DeleteUser) | **Delete** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#GetUserByName) | **Get** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#LoginUser) | **Get** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#LogoutUser) | **Get** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user + + + +## CreateUser + +> CreateUser(ctx, body) + +Create user + +This can only be done by the logged in user. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**User**](User.md)| Created user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUsersWithArrayInput + +> CreateUsersWithArrayInput(ctx, body) + +Creates list of users with given input array + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**[]User**](User.md)| List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUsersWithListInput + +> CreateUsersWithListInput(ctx, body) + +Creates list of users with given input array + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**[]User**](User.md)| List of user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUser + +> DeleteUser(ctx, username) + +Delete user + +This can only be done by the logged in user. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The name that needs to be deleted | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserByName + +> User GetUserByName(ctx, username) + +Get user by user name + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LoginUser + +> string LoginUser(ctx, username, password) + +Logs user into the system + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The user name for login | +**password** | **string**| The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LogoutUser + +> LogoutUser(ctx, ) + +Logs out current logged in user session + +### Required Parameters + +This endpoint does not need any parameter. + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateUser + +> UpdateUser(ctx, username, body) + +Updated user + +This can only be done by the logged in user. + +### Required Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| name that need to be deleted | +**body** | [**User**](User.md)| Updated user object | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/cmd/openapi-tinkertoy/out/go/git_push.sh b/cmd/openapi-tinkertoy/out/go/git_push.sh new file mode 100644 index 0000000..ced3be2 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/cmd/openapi-tinkertoy/out/go/go.mod b/cmd/openapi-tinkertoy/out/go/go.mod new file mode 100644 index 0000000..f55c146 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/go.mod @@ -0,0 +1,7 @@ +module github.com/GIT_USER_ID/GIT_REPO_ID + +require ( + github.com/antihax/optional v1.0.0 + golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + +) diff --git a/cmd/openapi-tinkertoy/out/go/go.sum b/cmd/openapi-tinkertoy/out/go/go.sum new file mode 100644 index 0000000..ee69520 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/go.sum @@ -0,0 +1,17 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/aws/aws-sdk-go v1.26.3 h1:szQdfJcUBAhQT0zZEx4sxoDuWb7iScoucxCiVxDmaBk= +github.com/aws/aws-sdk-go v1.26.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/cmd/openapi-tinkertoy/out/go/logger.go b/cmd/openapi-tinkertoy/out/go/logger.go new file mode 100644 index 0000000..fa465c0 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/logger.go @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "log" + "net/http" + "time" +) + +func Logger(inner http.Handler, name string) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + start := time.Now() + + inner.ServeHTTP(w, r) + + log.Printf( + "%s %s %s %s", + r.Method, + r.RequestURI, + name, + time.Since(start), + ) + }) +} diff --git a/cmd/openapi-tinkertoy/out/go/main.go b/cmd/openapi-tinkertoy/out/go/main.go new file mode 100644 index 0000000..8194c1e --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/main.go @@ -0,0 +1,34 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package main + +import ( + "log" + "net/http" + + openapi "github.com/GIT_USER_ID/GIT_REPO_ID/go" +) + +func main() { + log.Printf("Server started") + + PetApiService := openapi.NewPetApiService() + PetApiController := openapi.NewPetApiController(PetApiService) + + StoreApiService := openapi.NewStoreApiService() + StoreApiController := openapi.NewStoreApiController(StoreApiService) + + UserApiService := openapi.NewUserApiService() + UserApiController := openapi.NewUserApiController(UserApiService) + + router := openapi.NewRouter(PetApiController, StoreApiController, UserApiController) + + log.Fatal(http.ListenAndServe(":8080", router)) +} diff --git a/cmd/openapi-tinkertoy/out/go/model_api_response.go b/cmd/openapi-tinkertoy/out/go/model_api_response.go new file mode 100644 index 0000000..9712bec --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/model_api_response.go @@ -0,0 +1,20 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +// ApiResponse - Describes the result of uploading an image resource +type ApiResponse struct { + + Code int32 `json:"code,omitempty"` + + Type string `json:"type,omitempty"` + + Message string `json:"message,omitempty"` +} diff --git a/cmd/openapi-tinkertoy/out/go/model_category.go b/cmd/openapi-tinkertoy/out/go/model_category.go new file mode 100644 index 0000000..e18c8fb --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/model_category.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +// Category - A category for a pet +type Category struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/cmd/openapi-tinkertoy/out/go/model_order.go b/cmd/openapi-tinkertoy/out/go/model_order.go new file mode 100644 index 0000000..e641b5a --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/model_order.go @@ -0,0 +1,31 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "time" +) + +// Order - An order for a pets from the pet store +type Order struct { + + Id int64 `json:"id,omitempty"` + + PetId int64 `json:"petId,omitempty"` + + Quantity int32 `json:"quantity,omitempty"` + + ShipDate time.Time `json:"shipDate,omitempty"` + + // Order Status + Status string `json:"status,omitempty"` + + Complete bool `json:"complete,omitempty"` +} diff --git a/cmd/openapi-tinkertoy/out/go/model_pet.go b/cmd/openapi-tinkertoy/out/go/model_pet.go new file mode 100644 index 0000000..20160c7 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/model_pet.go @@ -0,0 +1,27 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +// Pet - A pet for sale in the pet store +type Pet struct { + + Id int64 `json:"id,omitempty"` + + Category Category `json:"category,omitempty"` + + Name string `json:"name"` + + PhotoUrls []string `json:"photoUrls"` + + Tags []Tag `json:"tags,omitempty"` + + // pet status in the store + Status string `json:"status,omitempty"` +} diff --git a/cmd/openapi-tinkertoy/out/go/model_tag.go b/cmd/openapi-tinkertoy/out/go/model_tag.go new file mode 100644 index 0000000..04727ca --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/model_tag.go @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +// Tag - A tag for a pet +type Tag struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/cmd/openapi-tinkertoy/out/go/model_user.go b/cmd/openapi-tinkertoy/out/go/model_user.go new file mode 100644 index 0000000..9b18f73 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/model_user.go @@ -0,0 +1,31 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +// User - A User who is purchasing from the pet store +type User struct { + + Id int64 `json:"id,omitempty"` + + Username string `json:"username,omitempty"` + + FirstName string `json:"firstName,omitempty"` + + LastName string `json:"lastName,omitempty"` + + Email string `json:"email,omitempty"` + + Password string `json:"password,omitempty"` + + Phone string `json:"phone,omitempty"` + + // User Status + UserStatus int32 `json:"userStatus,omitempty"` +} diff --git a/cmd/openapi-tinkertoy/out/go/response.go b/cmd/openapi-tinkertoy/out/go/response.go new file mode 100644 index 0000000..70f0930 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/response.go @@ -0,0 +1,46 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResonse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/cmd/openapi-tinkertoy/out/go/routers.go b/cmd/openapi-tinkertoy/out/go/routers.go new file mode 100644 index 0000000..e350a80 --- /dev/null +++ b/cmd/openapi-tinkertoy/out/go/routers.go @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package openapi + +import ( + "encoding/json" + "io/ioutil" + "net/http" + "os" + "strconv" + "github.com/gorilla/mux" +) + +// A Route defines the parameters for an api endpoint +type Route struct { + Name string + Method string + Pattern string + HandlerFunc http.HandlerFunc +} + +// Routes are a collection of defined api endpoints +type Routes []Route + +// Router defines the required methods for retrieving api routes +type Router interface { + Routes() Routes +} + +// NewRouter creates a new router for any number of api routers +func NewRouter(routers ...Router) *mux.Router { + router := mux.NewRouter().StrictSlash(true) + for _, api := range routers { + for _, route := range api.Routes() { + var handler http.Handler + handler = route.HandlerFunc + handler = Logger(handler, route.Name) + + router. + Methods(route.Method). + Path(route.Pattern). + Name(route.Name). + Handler(handler) + } + } + + return router +} + +// EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code +func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error { + w.Header().Set("Content-Type", "application/json; charset=UTF-8") + if status != nil { + w.WriteHeader(*status) + } else { + w.WriteHeader(http.StatusOK) + } + + return json.NewEncoder(w).Encode(i) +} + +// ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file +func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error) { + r.ParseForm() + formFile, _, err := r.FormFile(key) + if err != nil { + return nil, err + } + + defer formFile.Close() + file, err := ioutil.TempFile("tmp", key) + if err != nil { + return nil, err + } + + defer file.Close() + fileBytes, err := ioutil.ReadAll(formFile) + if err != nil { + return nil, err + } + + file.Write(fileBytes) + return file, nil +} + +// parseIntParameter parses a sting parameter to an int64 +func parseIntParameter(param string) (int64, error) { + return strconv.ParseInt(param, 10, 64) +} diff --git a/cmd/sub-demo/home.html b/cmd/sub-demo/home.html old mode 100644 new mode 100755 diff --git a/cmd/sub-demo/main.go b/cmd/sub-demo/main.go old mode 100644 new mode 100755 index 174963e..3091e68 --- a/cmd/sub-demo/main.go +++ b/cmd/sub-demo/main.go @@ -35,5 +35,5 @@ func StartServer() { } func HomeHandler(w http.ResponseWriter, r *http.Request) { - jch_http.RenderTemplate(w, "home", nil) + _http.RenderTemplate(w, "home", nil) } diff --git a/cmd/sub-demo/public/app.css b/cmd/sub-demo/public/app.css old mode 100644 new mode 100755 diff --git a/cmd/sub-demo/subscription.html b/cmd/sub-demo/subscription.html old mode 100644 new mode 100755 diff --git a/cmd/sub-demo/user.html b/cmd/sub-demo/user.html old mode 100644 new mode 100755 diff --git a/cmd/today/main.go b/cmd/today/main.go new file mode 100755 index 0000000..6cbd5f8 --- /dev/null +++ b/cmd/today/main.go @@ -0,0 +1,13 @@ +package main + +import ( + "fmt" + "time" + + "github.com/jchenry/libs/arvelie" +) + +func main() { + a := arvelie.FromDate(time.Now()) + fmt.Println(a) +} diff --git a/cmd/today/today b/cmd/today/today new file mode 100755 index 0000000..796e254 Binary files /dev/null and b/cmd/today/today differ diff --git a/cmd/web-tinkertoy/db.go b/cmd/web-tinkertoy/db.go new file mode 100644 index 0000000..70f3d1c --- /dev/null +++ b/cmd/web-tinkertoy/db.go @@ -0,0 +1,53 @@ +package main + +import ( + "context" + "database/sql" + "fmt" + + "rsc.io/dbstore" +) + +type DBFunc func(db *sql.DB) +type DBActor struct { + DB *sql.DB + ActionChan chan DBFunc +} + +func (a *DBActor) Run(ctx context.Context) error { + for { + select { + case f := <-a.ActionChan: + f(a.DB) + case <-ctx.Done(): + return ctx.Err() + } + } +} + +func DBStoreInsert(store *dbstore.Storage, e interface{}) DBFunc { + return func(db *sql.DB) { + err := store.Insert(db, e) + fmt.Println(err) + + } +} + +func DBStoreDelete(store *dbstore.Storage, e interface{}) DBFunc { + return func(db *sql.DB) { + store.Delete(db, e) + } +} + +func DBStoreSelect(store *dbstore.Storage, e interface{}, query string, args ...interface{}) DBFunc { + return func(db *sql.DB) { + err := store.Select(db, e, query, args...) + fmt.Println(err) + } +} + +// func DBStoreRead(store *dbstore.Storage, e interface{}, IDCol string) DBFunc { +// return func(db *sql.DB) { +// store.Read(db, e, IDCol) +// } +// } diff --git a/cmd/web-tinkertoy/echoform.tmpl b/cmd/web-tinkertoy/echoform.tmpl new file mode 100644 index 0000000..bac403f --- /dev/null +++ b/cmd/web-tinkertoy/echoform.tmpl @@ -0,0 +1,15 @@ + + + +{{if (eq .Message "")}} +
+ + +
+{{else}} + + {{.Message}} + +{{end}} + + diff --git a/cmd/web-tinkertoy/foo.db b/cmd/web-tinkertoy/foo.db new file mode 100644 index 0000000..9e6daf3 Binary files /dev/null and b/cmd/web-tinkertoy/foo.db differ diff --git a/cmd/web-tinkertoy/fortunesupload.tmpl b/cmd/web-tinkertoy/fortunesupload.tmpl new file mode 100644 index 0000000..c374a6e --- /dev/null +++ b/cmd/web-tinkertoy/fortunesupload.tmpl @@ -0,0 +1,15 @@ + + + +{{if (eq .Message "")}} +
+ + +
+{{else}} + {{.Message}} +{{end}} + + diff --git a/cmd/web-tinkertoy/go.mod b/cmd/web-tinkertoy/go.mod new file mode 100644 index 0000000..5b76baa --- /dev/null +++ b/cmd/web-tinkertoy/go.mod @@ -0,0 +1,8 @@ +module github.com/jchenry/jch + +go 1.14 + +require ( + github.com/mattn/go-sqlite3 v2.0.3+incompatible + rsc.io/dbstore v0.1.1 +) diff --git a/cmd/web-tinkertoy/go.sum b/cmd/web-tinkertoy/go.sum new file mode 100644 index 0000000..c62c743 --- /dev/null +++ b/cmd/web-tinkertoy/go.sum @@ -0,0 +1,6 @@ +github.com/mattn/go-sqlite3 v1.13.0 h1:LnJI81JidiW9r7pS/hXe6cFeO5EXNq7KbfvoJLRI69c= +github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= +github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +rsc.io/dbstore v0.1.1 h1:LI4gBJUwbejn0wHJWe0KTwgCM33zUVP3BsNz5y2fkEE= +rsc.io/dbstore v0.1.1/go.mod h1:zI7k1PCSLg9r/T2rBM4E/SctbGmqdtt3kjQSemVh1Rs= +rsc.io/sqlite v0.5.0/go.mod h1:fqHuveM9iIqMzjD0WiZIvKYMty/WqTo2bxE9+zC54WE= diff --git a/cmd/web-tinkertoy/jch b/cmd/web-tinkertoy/jch new file mode 100755 index 0000000..418ef4f Binary files /dev/null and b/cmd/web-tinkertoy/jch differ diff --git a/cmd/web-tinkertoy/main.go b/cmd/web-tinkertoy/main.go new file mode 100644 index 0000000..5968666 --- /dev/null +++ b/cmd/web-tinkertoy/main.go @@ -0,0 +1,44 @@ +package main + +import ( + "database/sql" + "fmt" + "io" + "net/http" + "os" + + _ "github.com/mattn/go-sqlite3" +) + +func main() { + if err := run(os.Args, os.Stdout); err != nil { + fmt.Fprintf(os.Stderr, "%s\n", err) + os.Exit(1) + } +} + +func run(args []string, stdout io.Writer) error { + // ctx, cancel := context.WithCancel(context.Background()) + // defer cancel() + // if db, err := sql.Open("sqlite3", "foo.db"); err == nil { + // dba := DBActor{ + // DB: db, + // ActionChan: make(chan DBFunc, 1), + // } + // go dba.Run(ctx) + // } + + s := server{ + router: http.NewServeMux(), + } + + s.routes() + + if db, err := sql.Open("sqlite3", "foo.db"); err == nil { + s.db = db + } else { + return err + } + return http.ListenAndServe(":8080", s.router) + +} diff --git a/cmd/web-tinkertoy/server.go b/cmd/web-tinkertoy/server.go new file mode 100644 index 0000000..3964864 --- /dev/null +++ b/cmd/web-tinkertoy/server.go @@ -0,0 +1,137 @@ +package main + +import ( + "bufio" + "context" + "database/sql" + "fmt" + "io" + "log" + "net/http" + "sync" + "text/template" + "time" + + "rsc.io/dbstore" +) + +type server struct { + db *sql.DB + router *http.ServeMux + echoMessage string +} + +func (s *server) routes() { + s.router.HandleFunc("/time", s.handleTime()) + s.router.HandleFunc("/echo", s.handleEcho()) + s.router.HandleFunc("/fortune", s.handleFortune()) + +} + +func (s *server) handleTime() http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(200) + io.WriteString(w, time.Now().String()) + } +} + +func (s *server) handleEcho() http.HandlerFunc { + var ( + init sync.Once + tmpl *template.Template + tplerr error + ) + return func(w http.ResponseWriter, r *http.Request) { + init.Do(func() { + tmpl, tplerr = template.ParseFiles("echoform.tmpl") + }) + if tplerr != nil { + http.Error(w, tplerr.Error(), http.StatusInternalServerError) + return + } + + switch r.Method { + case http.MethodPost: + r.ParseForm() + s.echoMessage = r.Form.Get("msg") + http.Redirect(w, r, "/echo", 301) + return + case http.MethodGet: + if err := tmpl.Execute(w, map[string]string{"Message": s.echoMessage}); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } + } + } +} + +func (s *server) handleFortune() http.HandlerFunc { + var ( + init sync.Once + dba *DBActor + storage *dbstore.Storage + tmpl *template.Template + tplerr error + ) + + type fortuneWrapper struct { + Fortune string + } + + return func(w http.ResponseWriter, r *http.Request) { + init.Do(func() { + ctx, _ := context.WithCancel(context.Background()) + dba = &DBActor{ + DB: s.db, + ActionChan: make(chan DBFunc), + } + go dba.Run(ctx) + storage = new(dbstore.Storage) + storage.Register(&fortuneWrapper{}) + err := storage.CreateTables(dba.DB) + if err != nil { + fmt.Println(err) + } + tmpl, tplerr = template.ParseFiles("fortunesupload.tmpl") + }) + + if tplerr != nil { + http.Error(w, tplerr.Error(), http.StatusInternalServerError) + return + } + + switch r.Method { + case http.MethodPost: + r.ParseMultipartForm(10 << 20) + file, _, err := r.FormFile("fortunes") + if err != nil { + fmt.Println("Error Retrieving the File") + fmt.Println(err) + return + } + defer file.Close() + + scanner := bufio.NewScanner(file) + var fortune string + for scanner.Scan() { + switch scanner.Text() { + case "%": + dba.ActionChan <- DBStoreInsert(storage, &fortuneWrapper{Fortune: fortune}) + default: + fortune = scanner.Text() + } + + } + + if err := scanner.Err(); err != nil { + log.Fatal(err) + } + case http.MethodGet: + f := fortuneWrapper{} + DBStoreSelect(storage, &f, "ORDER BY RANDOM() LIMIT 1", "*")(s.db) + if err := tmpl.Execute(w, map[string]string{"Message": f.Fortune}); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } + } + + } +} diff --git a/data/db_collection_store.go b/data/db_collection_store.go old mode 100644 new mode 100755 diff --git a/go.mod b/go.mod old mode 100644 new mode 100755 diff --git a/go.sum b/go.sum old mode 100644 new mode 100755 diff --git a/http/julienschmidt_router.go b/http/julienschmidt_router.go old mode 100644 new mode 100755 diff --git a/http/server.go b/http/server.go old mode 100644 new mode 100755 diff --git a/http/server_test.go b/http/server_test.go old mode 100644 new mode 100755 diff --git a/http/templates.go b/http/templates.go old mode 100644 new mode 100755 diff --git a/http/util.go b/http/util.go old mode 100644 new mode 100755 diff --git a/model/database_model.go b/model/database_model.go old mode 100644 new mode 100755 diff --git a/neralie/doc.go b/neralie/doc.go new file mode 100755 index 0000000..b831c03 --- /dev/null +++ b/neralie/doc.go @@ -0,0 +1,11 @@ +package neralie + +// This decimal clock has two groups of 3 digits, called the beat & the pulse. +// A beat contains 1000 pulses, and equivalent to 86.4 seconds. +// +// Examples: +// 6:00 250:000 +// 12:00 500:000 +// 18:00 750:000 +// +// Boosted lovingly from https://github.com/XXIIVV/Oscean/blob/master/scripts/lib/neralie.js diff --git a/neralie/neralie.go b/neralie/neralie.go new file mode 100755 index 0000000..e4c0ab2 --- /dev/null +++ b/neralie/neralie.go @@ -0,0 +1,27 @@ +package neralie + +import ( + "fmt" + "time" +) + +type Neralie int64 + +func (n Neralie) String() string { + ms := time.Duration(n).Milliseconds() + v := fmt.Sprintf("%.6f", float64(ms)/8640.0/10000.0) + return fmt.Sprintf("%s:%s", v[2:5], v[5:8]) +} + +func ToTime(n Neralie) time.Time { + return bod(time.Now()).Add(time.Duration(n)) +} + +func FromTime(t time.Time) Neralie { + return Neralie(t.Sub(bod(t))) +} + +func bod(t time.Time) time.Time { + y, m, d := t.Date() + return time.Date(y, m, d, 0, 0, 0, 0, time.UTC) +} diff --git a/neralie/neralie_test.go b/neralie/neralie_test.go new file mode 100755 index 0000000..200fa28 --- /dev/null +++ b/neralie/neralie_test.go @@ -0,0 +1,53 @@ +package neralie_test + +import ( + "fmt" + "strings" + "testing" + "time" + + "github.com/jchenry/libs/neralie" +) + +func TestFromTime(t *testing.T) { + + tests := [][]string{ + {"250:000", "6:00"}, + {"500:000", "12:00"}, + {"750:000", "18:00"}, + } + for i := range tests { + y, m, d := time.Now().Date() + dt, _ := time.Parse("15:04", tests[i][1]) + h, m2, s := dt.Clock() + n := neralie.FromTime(time.Date(y, m, d, h, m2, s, 0, time.UTC)) + expected := tests[i][0] + if !strings.EqualFold(n.String(), expected) { + fmt.Printf("%s != %s\n", expected, n.String()) + t.Fail() + } + } +} + +func TestToTime(t *testing.T) { + tests := [][]string{ + {"250:000", "6:00"}, + {"500:000", "12:00"}, + {"750:000", "18:00"}, + } + + for i := range tests { + y, m, d := time.Now().Date() + dt, _ := time.Parse("15:04", tests[i][1]) + h, m2, s := dt.Clock() + d1 := time.Date(y, m, d, h, m2, s, 0, time.UTC) + n := neralie.FromTime(d1) + d2 := neralie.ToTime(n) + + if !d1.Equal(d2) { + fmt.Printf("%s != %s\n", d1, d2) + t.Fail() + } + + } +} diff --git a/payments/config.go b/payments/config.go old mode 100644 new mode 100755 diff --git a/payments/doc.go b/payments/doc.go old mode 100644 new mode 100755 diff --git a/payments/middleware.go b/payments/middleware.go old mode 100644 new mode 100755 diff --git a/payments/service.go b/payments/service.go old mode 100644 new mode 100755 diff --git a/pic/parser.go b/pic/parser.go new file mode 100755 index 0000000..da159a3 --- /dev/null +++ b/pic/parser.go @@ -0,0 +1,1483 @@ +package pic + +// type yySymType struct{ +// yys int +// str string +// result Result +// } + +// /* +// * Changes by Gunnar Ritter, Freiburg i. Br., Germany, October 2005. +// * +// * Derived from Plan 9 v4 /sys/src/cmd/pic/ +// * +// * Copyright (C) 2003, Lucent Technologies Inc. and others. +// * All Rights Reserved. +// * +// * Distributed under the terms of the Lucent Public License Version 1.02. +// */ + +// /* Sccsid @(#)picy.y 1.4 (gritter) 11/28/05 */ + +// // #include +// // #include "pic.h" +// // #include +// // #include +// // #include + +// // #ifndef RAND_MAX +// // #define RAND_MAX 32767 +// // #endif + +// // YYSTYPE y; + +// // extern void yyerror(char *); +// // extern int yylex(void); +// const BOX = 1 +// const LINE = 2 +// const ARROW = 3 +// const CIRCLE = 4 +// const ELLIPSE = 5 +// const ARC = 6 +// const SPLINE = 7 +// const BLOCK = 8 +// const TEXT = 9 +// const TROFF = 10 +// const MOVE = 11 +// const BLOCKEND = 12 +// const PLACE = 13 +// const PRINT = 57359 +// const RESET = 57360 +// const THRU = 57361 +// const UNTIL = 57362 +// const FOR = 57363 +// const IF = 57364 +// const COPY = 57365 +// const THENSTR = 57366 +// const ELSESTR = 57367 +// const DOSTR = 57368 +// const PLACENAME = 57369 +// const VARNAME = 57370 +// const SPRINTF = 57371 +// const DEFNAME = 57372 +// const ATTR = 57373 +// const TEXTATTR = 57374 +// const LEFT = 57375 +// const RIGHT = 57376 +// const UP = 57377 +// const DOWN = 57378 +// const FROM = 57379 +// const TO = 57380 +// const AT = 57381 +// const BY = 57382 +// const WITH = 57383 +// const HEAD = 57384 +// const CW = 57385 +// const CCW = 57386 +// const THEN = 57387 +// const HEIGHT = 57388 +// const WIDTH = 57389 +// const RADIUS = 57390 +// const DIAMETER = 57391 +// const LENGTH = 57392 +// const SIZE = 57393 +// const CORNER = 57394 +// const HERE = 57395 +// const LAST = 57396 +// const NTH = 57397 +// const SAME = 57398 +// const BETWEEN = 57399 +// const AND = 57400 +// const EAST = 57401 +// const WEST = 57402 +// const NORTH = 57403 +// const SOUTH = 57404 +// const NE = 57405 +// const NW = 57406 +// const SE = 57407 +// const SW = 57408 +// const START = 57409 +// const END = 57410 +// const DOTX = 57411 +// const DOTY = 57412 +// const DOTHT = 57413 +// const DOTWID = 57414 +// const DOTRAD = 57415 +// const NUMBER = 57416 +// const LOG = 57417 +// const EXP = 57418 +// const SIN = 57419 +// const COS = 57420 +// const ATAN2 = 57421 +// const SQRT = 57422 +// const RAND = 57423 +// const MIN = 57424 +// const MAX = 57425 +// const INT = 57426 +// const DIR = 57427 +// const DOT = 57428 +// const DASH = 57429 +// const CHOP = 57430 +// const FILL = 57431 +// const NOEDGE = 57432 +// const ST = 57433 +// const OROR = 57434 +// const ANDAND = 57435 +// const GT = 57436 +// const LT = 57437 +// const LE = 57438 +// const GE = 57439 +// const EQ = 57440 +// const NEQ = 57441 +// const UMINUS = 57442 +// const NOT = 57443 + +// var yyToknames = [...]string{ +// "$end", +// "error", +// "$unk", +// "BOX", +// "LINE", +// "ARROW", +// "CIRCLE", +// "ELLIPSE", +// "ARC", +// "SPLINE", +// "BLOCK", +// "TEXT", +// "TROFF", +// "MOVE", +// "BLOCKEND", +// "PLACE", +// "PRINT", +// "RESET", +// "THRU", +// "UNTIL", +// "FOR", +// "IF", +// "COPY", +// "THENSTR", +// "ELSESTR", +// "DOSTR", +// "PLACENAME", +// "VARNAME", +// "SPRINTF", +// "DEFNAME", +// "ATTR", +// "TEXTATTR", +// "LEFT", +// "RIGHT", +// "UP", +// "DOWN", +// "FROM", +// "TO", +// "AT", +// "BY", +// "WITH", +// "HEAD", +// "CW", +// "CCW", +// "THEN", +// "HEIGHT", +// "WIDTH", +// "RADIUS", +// "DIAMETER", +// "LENGTH", +// "SIZE", +// "CORNER", +// "HERE", +// "LAST", +// "NTH", +// "SAME", +// "BETWEEN", +// "AND", +// "EAST", +// "WEST", +// "NORTH", +// "SOUTH", +// "NE", +// "NW", +// "SE", +// "SW", +// "START", +// "END", +// "DOTX", +// "DOTY", +// "DOTHT", +// "DOTWID", +// "DOTRAD", +// "NUMBER", +// "LOG", +// "EXP", +// "SIN", +// "COS", +// "ATAN2", +// "SQRT", +// "RAND", +// "MIN", +// "MAX", +// "INT", +// "DIR", +// "DOT", +// "DASH", +// "CHOP", +// "FILL", +// "NOEDGE", +// "ST", +// "'='", +// "OROR", +// "ANDAND", +// "GT", +// "LT", +// "LE", +// "GE", +// "EQ", +// "NEQ", +// "'+'", +// "'-'", +// "'*'", +// "'/'", +// "'%'", +// "UMINUS", +// "NOT", +// "'^'", +// "'}'", +// "':'", +// "','", +// "'{'", +// "']'", +// "'['", +// "'.'", +// "'('", +// "')'", +// } +// var yyStatenames = [...]string{} + +// const yyEofCode = 1 +// const yyErrCode = 2 +// const yyInitialStackSize = 16 + +// var yyExca = [...]int{ +// -1, 0, +// 1, 2, +// -2, 0, +// -1, 1, +// 1, -1, +// -2, 0, +// -1, 206, +// 95, 0, +// 96, 0, +// 97, 0, +// 98, 0, +// 99, 0, +// 100, 0, +// -2, 159, +// -1, 213, +// 95, 0, +// 96, 0, +// 97, 0, +// 98, 0, +// 99, 0, +// 100, 0, +// -2, 158, +// -1, 214, +// 95, 0, +// 96, 0, +// 97, 0, +// 98, 0, +// 99, 0, +// 100, 0, +// -2, 160, +// -1, 215, +// 95, 0, +// 96, 0, +// 97, 0, +// 98, 0, +// 99, 0, +// 100, 0, +// -2, 161, +// -1, 216, +// 95, 0, +// 96, 0, +// 97, 0, +// 98, 0, +// 99, 0, +// 100, 0, +// -2, 162, +// -1, 217, +// 95, 0, +// 96, 0, +// 97, 0, +// 98, 0, +// 99, 0, +// 100, 0, +// -2, 163, +// -1, 264, +// 69, 112, +// 70, 112, +// 71, 112, +// 72, 112, +// 73, 112, +// -2, 85, +// -1, 270, +// 95, 0, +// 96, 0, +// 97, 0, +// 98, 0, +// 99, 0, +// 100, 0, +// -2, 159, +// } + +// const yyPrivate = 57344 + +// const yyLast = 1654 + +// var yyAct = [...]int{ + +// 173, 334, 139, 32, 53, 68, 312, 242, 124, 125, +// 137, 42, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 95, 227, 122, 162, 320, 81, 43, +// 274, 137, 92, 319, 51, 299, 273, 161, 137, 160, +// 159, 105, 158, 157, 156, 155, 154, 153, 98, 127, +// 128, 131, 109, 298, 246, 235, 152, 149, 233, 40, +// 112, 113, 114, 122, 51, 122, 41, 72, 40, 194, +// 102, 164, 166, 138, 130, 110, 111, 112, 113, 114, +// 129, 83, 122, 169, 190, 73, 74, 75, 76, 77, +// 78, 79, 80, 276, 246, 200, 110, 111, 112, 113, +// 114, 138, 126, 122, 124, 125, 107, 38, 204, 206, +// 105, 208, 209, 210, 211, 212, 213, 214, 215, 216, +// 217, 218, 219, 220, 195, 221, 224, 132, 133, 134, +// 135, 136, 51, 51, 124, 125, 124, 125, 205, 207, +// 198, 199, 34, 316, 275, 321, 168, 85, 223, 226, +// 234, 124, 125, 44, 236, 237, 238, 239, 240, 241, +// 203, 243, 244, 245, 232, 167, 170, 247, 249, 228, +// 124, 125, 86, 252, 93, 253, 105, 105, 105, 105, +// 105, 96, 97, 123, 261, 262, 263, 265, 335, 336, +// 337, 338, 81, 124, 125, 267, 268, 192, 270, 51, +// 51, 51, 51, 51, 251, 254, 255, 256, 257, 260, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 278, 90, 122, 280, 86, 311, 282, +// 287, 193, 191, 283, 229, 132, 133, 134, 135, 136, +// 71, 201, 142, 146, 147, 143, 144, 145, 148, 250, +// 285, 35, 281, 300, 66, 67, 69, 284, 87, 88, +// 287, 288, 35, 164, 166, 269, 2, 4, 36, 230, +// 37, 285, 286, 39, 163, 305, 105, 105, 308, 36, +// 310, 196, 188, 24, 171, 24, 266, 149, 84, 24, +// 230, 231, 151, 82, 313, 70, 314, 315, 1, 51, +// 51, 69, 165, 317, 318, 306, 307, 37, 100, 24, +// 322, 5, 323, 142, 146, 147, 143, 144, 145, 148, +// 248, 331, 24, 24, 26, 6, 12, 13, 14, 304, +// 89, 339, 91, 0, 301, 340, 0, 0, 0, 0, +// 341, 271, 272, 16, 20, 21, 17, 18, 19, 22, +// 37, 35, 25, 23, 52, 46, 10, 11, 0, 0, +// 30, 31, 29, 141, 0, 24, 103, 46, 36, 202, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 66, +// 67, 69, 54, 0, 24, 0, 0, 0, 0, 0, +// 0, 66, 67, 69, 54, 0, 0, 0, 0, 0, +// 0, 45, 56, 57, 58, 59, 60, 61, 62, 64, +// 63, 65, 0, 45, 56, 57, 58, 59, 60, 61, +// 62, 64, 63, 65, 9, 0, 0, 0, 49, 48, +// 101, 0, 303, 0, 55, 0, 0, 0, 0, 0, +// 49, 48, 35, 94, 0, 0, 55, 0, 0, 0, +// 0, 27, 0, 33, 0, 50, 0, 52, 46, 36, +// 0, 172, 181, 0, 0, 0, 0, 175, 176, 177, +// 178, 179, 182, 0, 142, 146, 147, 143, 144, 145, +// 148, 150, 66, 67, 69, 54, 180, 121, 120, 115, +// 197, 116, 117, 118, 119, 110, 111, 112, 113, 114, +// 0, 0, 122, 0, 45, 56, 57, 58, 59, 60, +// 61, 62, 64, 63, 65, 174, 183, 184, 185, 186, +// 187, 0, 0, 35, 151, 0, 0, 0, 0, 0, +// 0, 49, 48, 0, 35, 0, 0, 55, 52, 46, +// 36, 0, 0, 0, 0, 0, 94, 0, 0, 52, +// 46, 36, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 66, 67, 69, 54, 0, 0, 0, +// 0, 0, 0, 0, 66, 67, 69, 54, 0, 0, +// 0, 0, 0, 0, 0, 45, 56, 57, 58, 59, +// 60, 61, 62, 64, 63, 65, 45, 56, 57, 58, +// 59, 60, 61, 62, 64, 63, 65, 52, 46, 0, +// 0, 0, 49, 48, 0, 0, 0, 0, 55, 52, +// 46, 0, 0, 49, 48, 0, 0, 94, 0, 55, +// 0, 0, 258, 67, 69, 54, 0, 0, 50, 0, +// 0, 0, 0, 0, 66, 67, 69, 54, 0, 0, +// 0, 0, 0, 0, 45, 56, 57, 58, 59, 60, +// 61, 62, 64, 63, 65, 0, 45, 56, 57, 58, +// 59, 60, 61, 62, 64, 63, 65, 264, 46, 0, +// 0, 49, 48, 0, 0, 0, 0, 55, 52, 46, +// 0, 0, 0, 49, 48, 259, 50, 0, 0, 55, +// 0, 0, 66, 67, 69, 54, 0, 0, 50, 0, +// 0, 0, 0, 66, 67, 69, 54, 0, 0, 0, +// 0, 0, 0, 0, 45, 56, 57, 58, 59, 60, +// 61, 62, 64, 63, 65, 45, 56, 57, 58, 59, +// 60, 61, 62, 64, 63, 65, 52, 46, 0, 0, +// 0, 49, 48, 0, 0, 0, 0, 55, 0, 0, +// 0, 0, 49, 48, 0, 0, 94, 0, 55, 0, +// 0, 66, 67, 69, 54, 0, 0, 225, 120, 115, +// 197, 116, 117, 118, 119, 110, 111, 112, 113, 114, +// 0, 0, 122, 45, 56, 57, 58, 59, 60, 61, +// 62, 64, 63, 65, 0, 16, 20, 21, 17, 18, +// 19, 22, 0, 35, 25, 23, 0, 0, 10, 11, +// 49, 48, 30, 31, 29, 0, 55, 0, 7, 28, +// 36, 0, 0, 0, 0, 222, 16, 20, 21, 17, +// 18, 19, 22, 0, 35, 25, 23, 0, 0, 10, +// 11, 0, 0, 30, 31, 29, 0, 0, 0, 7, +// 28, 36, 3, 0, 16, 20, 21, 17, 18, 19, +// 22, 0, 35, 25, 23, 0, 0, 10, 11, 0, +// 0, 30, 31, 29, 0, 0, 9, 7, 28, 36, +// 0, 0, 15, 0, 0, 121, 120, 115, 197, 116, +// 117, 118, 119, 110, 111, 112, 113, 114, 0, 0, +// 122, 0, 0, 27, 189, 33, 0, 9, 0, 333, +// 0, 0, 0, 15, 121, 120, 115, 197, 116, 117, +// 118, 119, 110, 111, 112, 113, 114, 0, 0, 122, +// 0, 99, 109, 0, 27, 9, 33, 0, 332, 0, +// 0, 15, 16, 20, 21, 17, 18, 19, 22, 0, +// 35, 25, 23, 0, 0, 10, 11, 0, 0, 30, +// 31, 29, 27, 0, 33, 7, 28, 36, 121, 120, +// 115, 108, 116, 117, 118, 119, 110, 111, 112, 113, +// 114, 0, 0, 122, 0, 0, 107, 0, 0, 0, +// 0, 0, 229, 121, 120, 115, 197, 116, 117, 118, +// 119, 110, 111, 112, 113, 114, 0, 0, 122, 0, +// 0, 309, 0, 0, 0, 0, 0, 229, 0, 0, +// 0, 0, 0, 9, 0, 0, 0, 0, 0, 15, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 0, 0, 122, 0, 0, 0, 0, +// 27, 0, 33, 0, 326, 121, 120, 115, 197, 116, +// 117, 118, 119, 110, 111, 112, 113, 114, 0, 0, +// 122, 142, 146, 147, 143, 144, 145, 148, 140, 325, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 0, 0, 122, 0, 0, 0, 0, +// 0, 0, 0, 0, 324, 121, 120, 115, 197, 116, +// 117, 118, 119, 110, 111, 112, 113, 114, 0, 0, +// 122, 141, 0, 0, 0, 0, 0, 0, 0, 297, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 0, 0, 122, 0, 0, 0, 0, +// 0, 0, 0, 0, 294, 121, 120, 115, 197, 116, +// 117, 118, 119, 110, 111, 112, 113, 114, 0, 0, +// 122, 0, 0, 0, 0, 0, 0, 0, 0, 292, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 0, 0, 122, 0, 0, 0, 0, +// 0, 0, 0, 0, 291, 121, 120, 115, 197, 116, +// 117, 118, 119, 110, 111, 112, 113, 114, 0, 0, +// 122, 0, 0, 0, 0, 0, 0, 0, 0, 290, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 0, 109, 122, 0, 0, 0, 0, +// 0, 0, 0, 0, 289, 121, 120, 115, 197, 116, +// 117, 118, 119, 110, 111, 112, 113, 114, 109, 0, +// 122, 0, 0, 0, 0, 0, 0, 0, 106, 229, +// 121, 120, 115, 108, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 0, 0, 122, 0, 0, 107, 0, +// 0, 0, 0, 0, 121, 120, 115, 108, 116, 117, +// 118, 119, 110, 111, 112, 113, 114, 0, 0, 122, +// 0, 0, 107, 121, 120, 115, 197, 116, 117, 118, +// 119, 110, 111, 112, 113, 114, 0, 0, 122, 0, +// 0, 296, 121, 120, 115, 197, 116, 117, 118, 119, +// 110, 111, 112, 113, 114, 0, 0, 122, 0, 0, +// 295, 121, 120, 115, 197, 116, 117, 118, 119, 110, +// 111, 112, 113, 114, 0, 0, 122, 343, 0, 293, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 342, 0, 122, 0, 0, 279, 121, +// 120, 115, 197, 116, 117, 118, 119, 110, 111, 112, +// 113, 114, 330, 0, 122, 0, 0, 277, 0, 0, +// 0, 0, 0, 0, 0, 0, 329, 0, 328, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 327, 0, 121, 120, 115, 197, 116, 117, +// 118, 119, 110, 111, 112, 113, 114, 302, 0, 122, +// 121, 120, 115, 197, 116, 117, 118, 119, 110, 111, +// 112, 113, 114, 0, 0, 122, 0, 0, 0, 121, +// 120, 115, 197, 116, 117, 118, 119, 110, 111, 112, +// 113, 114, 0, 0, 122, 121, 120, 115, 197, 116, +// 117, 118, 119, 110, 111, 112, 113, 114, 0, 0, +// 122, 0, 121, 120, 115, 197, 116, 117, 118, 119, +// 110, 111, 112, 113, 114, 0, 0, 122, 121, 120, +// 115, 197, 116, 117, 118, 119, 110, 111, 112, 113, +// 114, 47, 8, 122, 8, 0, 0, 0, 8, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 8, 104, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 8, +// } +// var yyPact = [...]int{ + +// 860, -1000, 948, -1000, -1000, 16, 948, -51, -25, -1000, +// 522, 212, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, +// -1000, -1000, -1000, -1000, 250, -1000, 948, -1000, -11, 239, +// 196, 511, 149, -1000, 150, -1000, -68, -1000, -1000, 832, +// 339, -1000, 1197, 92, 11, -1000, -11, -1000, 327, 327, +// 592, 166, -14, 1077, 470, 327, -69, -70, -71, -72, +// -73, -74, -76, -77, -79, -90, 247, -1000, 113, -1000, +// 55, -1000, 430, 430, 430, 430, 430, 430, 430, 430, +// 430, 149, 801, 327, 239, -1000, -1000, 167, 250, 32, +// -1000, 257, 1445, 41, 327, 166, -1000, -1000, 250, -1000, +// -1000, 948, 69, -42, -25, 1221, -1000, 327, 592, 592, +// 327, 327, 327, 327, 327, 327, 327, 327, 327, 327, +// 327, 327, 327, -1000, 719, 661, -1000, -45, -45, -93, +// 58, 885, -1000, -1000, -1000, -1000, -1000, -1000, 263, 112, +// -57, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 98, +// -60, -1000, -45, 327, 327, 327, 327, 327, 327, -110, +// 327, 327, 327, -61, 309, 238, -1000, -1000, -1000, -1000, +// 176, -1000, 327, 1445, 327, 592, 592, 592, 592, 580, +// -1000, -1000, -1000, 327, 327, 650, 327, -1000, 250, -1000, +// 1445, -1000, -1000, -1000, 327, 327, 240, 327, 250, 250, +// 1172, -81, -1000, -1000, 1445, 33, -5, 35, -43, -43, +// -45, -45, -45, -26, -26, -26, -26, -26, -83, 684, +// -45, 1316, 327, 166, 1297, 327, 166, -1000, 202, -1000, +// -1000, -1000, -1000, 244, -1000, 233, 1147, 1122, 1097, 1072, +// 1278, 1047, -1000, 1259, 1240, 1022, 242, -1000, -62, -1000, +// -80, -1000, 1445, 1445, 3, 3, 3, 3, 247, 226, +// 3, 1445, 1445, 1445, -14, 1445, -1000, 1429, 394, -1000, +// -26, -1000, -1000, -1000, 327, 592, 592, 327, 910, 327, +// 117, -111, -21, 309, 238, -1000, -1000, -1000, -1000, -1000, +// -1000, -1000, -1000, 327, -1000, 327, 327, -1000, 223, 203, +// 91, 430, 327, 327, -84, 1445, 50, 3, 1445, 327, +// 1445, 327, -1000, 997, 972, 947, -1000, 1412, 1396, -1000, +// 327, -1000, 831, 802, -1000, -1000, -1000, 87, -1000, 87, +// -1000, 1445, -1000, -1000, 327, -1000, -1000, -1000, -1000, 327, +// 1377, 1361, -1000, -1000, +// } +// var yyPgo = [...]int{ + +// 0, 0, 332, 1551, 330, 142, 1, 329, 328, 327, +// 326, 325, 267, 266, 29, 324, 311, 23, 5, 282, +// 3, 4, 2, 298, 295, 288, 147, 67, 286, 284, +// } +// var yyR1 = [...]int{ + +// 0, 23, 23, 23, 13, 13, 12, 12, 12, 12, +// 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +// 12, 24, 24, 24, 24, 3, 10, 25, 25, 26, +// 26, 26, 9, 9, 9, 9, 8, 8, 2, 2, +// 2, 4, 6, 6, 6, 6, 6, 11, 16, 16, +// 16, 16, 16, 16, 16, 16, 16, 16, 28, 16, +// 15, 27, 27, 29, 29, 29, 29, 29, 29, 29, +// 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +// 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +// 19, 19, 20, 20, 20, 5, 5, 5, 7, 7, +// 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +// 14, 14, 17, 17, 17, 17, 17, 17, 17, 17, +// 17, 17, 17, 17, 17, 18, 18, 18, 21, 21, +// 21, 22, 22, 22, 22, 22, 22, 22, 22, 1, +// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +// 1, 1, 1, 1, 1, 1, 1, 1, +// } +// var yyR2 = [...]int{ + +// 0, 1, 0, 1, 1, 2, 2, 3, 3, 4, +// 4, 2, 1, 3, 3, 3, 3, 1, 1, 1, +// 1, 0, 1, 2, 3, 3, 2, 1, 2, 1, +// 2, 2, 10, 7, 10, 7, 4, 3, 1, 3, +// 3, 1, 1, 1, 1, 1, 0, 1, 2, 2, +// 2, 2, 2, 2, 2, 2, 2, 1, 0, 5, +// 1, 2, 0, 2, 1, 1, 2, 1, 2, 2, +// 2, 2, 2, 3, 4, 2, 1, 1, 1, 2, +// 1, 2, 1, 2, 1, 2, 2, 1, 1, 1, +// 1, 2, 1, 2, 2, 1, 4, 6, 1, 3, +// 1, 3, 3, 5, 5, 7, 7, 3, 3, 5, +// 6, 5, 1, 2, 2, 1, 2, 3, 3, 2, +// 3, 3, 1, 2, 2, 4, 4, 3, 2, 2, +// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +// 1, 1, 3, 3, 3, 3, 3, 2, 2, 3, +// 2, 2, 2, 2, 2, 3, 4, 4, 3, 3, +// 3, 3, 3, 3, 3, 3, 2, 4, 4, 3, +// 4, 4, 6, 4, 3, 6, 6, 4, +// } +// var yyChk = [...]int{ + +// -1000, -23, -13, 2, -12, -16, -11, 27, -3, 85, +// 17, 18, -10, -9, -8, 91, 4, 7, 8, 9, +// 5, 6, 10, 14, -19, 13, -15, 112, 28, 23, +// 21, 22, -20, 114, -5, 12, 29, -12, 91, -13, +// 110, 91, -1, -14, -5, 74, 28, -3, 102, 101, +// 116, -17, 27, -21, 55, 107, 75, 76, 77, 78, +// 79, 80, 81, 83, 82, 84, 52, 53, -18, 54, +// -24, 28, -27, -27, -27, -27, -27, -27, -27, -27, +// -27, -20, -13, 92, -25, -26, -5, 19, 20, -4, +// 28, -2, -1, -5, 116, -17, 32, 32, 116, 109, +// -12, 91, -14, 27, -3, -1, 91, 111, 96, 57, +// 101, 102, 103, 104, 105, 95, 97, 98, 99, 100, +// 94, 93, 108, 91, 101, 102, 91, -1, -1, -14, +// -17, -1, 69, 70, 71, 72, 73, 52, 115, -22, +// 11, 54, 4, 7, 8, 9, 5, 6, 10, -22, +// 11, 54, -1, 116, 116, 116, 116, 116, 116, 116, +// 116, 116, 116, 27, -21, 55, -18, 52, 91, 28, +// 111, -29, 31, -1, 85, 37, 38, 39, 40, 41, +// 56, 32, 42, 86, 87, 88, 89, 90, -19, 113, +// -1, -26, 30, -5, 37, 92, 24, 96, 99, 100, +// -1, -5, -12, 91, -1, -14, -1, -14, -1, -1, +// -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, +// -1, -1, 116, -17, -1, 116, -17, 117, 111, 117, +// 27, 28, 52, 115, 52, 115, -1, -1, -1, -1, +// -1, -1, 117, -1, -1, -1, 115, -22, 11, -22, +// 11, 28, -1, -1, -14, -14, -14, -14, 52, 115, +// -14, -1, -1, -1, 27, -1, -28, -1, -1, 25, +// -1, -5, -5, 117, 111, 111, 58, 111, -1, 111, +// -1, -17, 27, -21, 55, 27, 28, 27, 28, 117, +// 117, 117, 117, 111, 117, 111, 111, 117, 115, 115, +// 27, -27, 38, 38, -7, -1, -14, -14, -1, 111, +// -1, 111, 117, -1, -1, -1, 52, -1, -1, 117, +// 111, 95, -1, -1, 117, 117, 117, 40, 26, 40, +// 26, -1, 117, 117, -6, 101, 102, 103, 104, -6, +// -1, -1, 26, 26, +// } +// var yyDef = [...]int{ + +// -2, -2, 1, 3, 4, 0, 0, 0, 0, 12, +// 0, 21, 17, 18, 19, 20, 62, 62, 62, 62, +// 62, 62, 62, 62, 62, 57, 0, 47, 0, 0, +// 0, 0, 90, 60, 92, 95, 0, 5, 6, 0, +// 0, 11, 0, 0, 0, 139, 140, 141, 0, 0, +// 0, 100, 112, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 0, 0, 0, 115, 122, 130, +// 0, 22, 48, 49, 50, 51, 52, 53, 54, 55, +// 56, 91, 0, 0, 26, 27, 29, 0, 0, 0, +// 41, 0, 38, 0, 0, 0, 94, 93, 0, 7, +// 8, 20, 0, 112, 141, 0, 13, 0, 0, 0, +// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 14, 0, 0, 15, 147, 148, 0, +// 100, 0, 150, 151, 152, 153, 154, 113, 0, 116, +// 138, 128, 131, 132, 133, 134, 135, 136, 137, 119, +// 138, 129, 166, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 114, 0, 0, 124, 123, 16, 23, +// 0, 61, 64, 65, 67, 0, 0, 0, 0, 0, +// 76, 77, 78, 80, 82, 84, 87, 88, 89, 58, +// 25, 28, 30, 31, 0, 0, 37, 0, 0, 0, +// 0, 0, 9, 10, 102, 0, -2, 0, 142, 143, +// 144, 145, 146, -2, -2, -2, -2, -2, 164, 165, +// 169, 0, 0, 107, 0, 0, 108, 101, 0, 149, +// 127, 155, 117, 0, 120, 0, 0, 0, 0, 0, +// 0, 0, 174, 0, 0, 0, 0, 118, 138, 121, +// 138, 24, 63, 66, 68, 69, 70, 71, 72, 0, +// 75, 79, 81, 83, -2, 86, 62, 0, 0, 36, +// -2, 39, 40, 96, 0, 0, 0, 0, 0, 0, +// 0, 0, 112, 0, 0, 125, 156, 126, 157, 167, +// 168, 170, 171, 0, 173, 0, 0, 177, 0, 0, +// 73, 59, 0, 0, 0, 98, 0, 111, 103, 0, +// 104, 0, 109, 0, 0, 0, 74, 0, 0, 97, +// 0, 110, 0, 0, 172, 175, 176, 46, 33, 46, +// 35, 99, 105, 106, 0, 42, 43, 44, 45, 0, +// 0, 0, 32, 34, +// } +// var yyTok1 = [...]int{ + +// 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, +// 13, 14, 15, 16, 3, 3, 3, 3, 3, 3, +// 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +// 3, 3, 3, 3, 3, 3, 3, 105, 3, 3, +// 116, 117, 103, 101, 111, 102, 115, 104, 3, 3, +// 3, 3, 3, 3, 3, 3, 3, 3, 110, 3, +// 3, 92, 3, 3, 3, 3, 3, 3, 3, 3, +// 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +// 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +// 3, 114, 3, 113, 108, 3, 3, 3, 3, 3, +// 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +// 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, +// 3, 3, 3, 112, 3, 109, +// } +// var yyTok2 = [...]int{ + +// 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, +// 0, 0, 0, 0, 0, 17, 18, 19, 20, 21, +// 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, +// 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, +// 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, +// 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, +// 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, +// 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, +// 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, +// 93, 94, 95, 96, 97, 98, 99, 100, 106, 107, +// } +// var yyTok3 = [...]int{ +// 0, +// } + +// var yyErrorMessages = [...]struct { +// state int +// token int +// msg string +// }{ +// } + +// /* parser for yacc output */ + +// var ( +// yyDebug = 0 +// yyErrorVerbose = false +// ) + +// type yyLexer interface { +// Lex(lval *yySymType) int +// Error(s string) +// } + +// type yyParser interface { +// Parse(yyLexer) int +// Lookahead() int +// } + +// type yyParserImpl struct { +// lval yySymType +// stack [yyInitialStackSize]yySymType +// char int +// } + +// func (p *yyParserImpl) Lookahead() int { +// return p.char +// } + +// func yyNewParser() yyParser { +// return &yyParserImpl{} +// } + +// const yyFlag = -1000 + +// func yyTokname(c int) string { +// if c >= 1 && c-1 < len(yyToknames) { +// if yyToknames[c-1] != "" { +// return yyToknames[c-1] +// } +// } +// return __yyfmt__.Sprintf("tok-%v", c) +// } + +// func yyStatname(s int) string { +// if s >= 0 && s < len(yyStatenames) { +// if yyStatenames[s] != "" { +// return yyStatenames[s] +// } +// } +// return __yyfmt__.Sprintf("state-%v", s) +// } + +// func yyErrorMessage(state, lookAhead int) string { +// const TOKSTART = 4 + +// if !yyErrorVerbose { +// return "syntax error" +// } + +// for _, e := range yyErrorMessages { +// if e.state == state && e.token == lookAhead { +// return "syntax error: " + e.msg +// } +// } + +// res := "syntax error: unexpected " + yyTokname(lookAhead) + +// // To match Bison, suggest at most four expected tokens. +// expected := make([]int, 0, 4) + +// // Look for shiftable tokens. +// base := yyPact[state] +// for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { +// if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok { +// if len(expected) == cap(expected) { +// return res +// } +// expected = append(expected, tok) +// } +// } + +// if yyDef[state] == -2 { +// i := 0 +// for yyExca[i] != -1 || yyExca[i+1] != state { +// i += 2 +// } + +// // Look for tokens that we accept or reduce. +// for i += 2; yyExca[i] >= 0; i += 2 { +// tok := yyExca[i] +// if tok < TOKSTART || yyExca[i+1] == 0 { +// continue +// } +// if len(expected) == cap(expected) { +// return res +// } +// expected = append(expected, tok) +// } + +// // If the default action is to accept or reduce, give up. +// if yyExca[i+1] != 0 { +// return res +// } +// } + +// for i, tok := range expected { +// if i == 0 { +// res += ", expecting " +// } else { +// res += " or " +// } +// res += yyTokname(tok) +// } +// return res +// } + +// func yylex1(lex yyLexer, lval *yySymType) (char, token int) { +// token = 0 +// char = lex.Lex(lval) +// if char <= 0 { +// token = yyTok1[0] +// goto out +// } +// if char < len(yyTok1) { +// token = yyTok1[char] +// goto out +// } +// if char >= yyPrivate { +// if char < yyPrivate+len(yyTok2) { +// token = yyTok2[char-yyPrivate] +// goto out +// } +// } +// for i := 0; i < len(yyTok3); i += 2 { +// token = yyTok3[i+0] +// if token == char { +// token = yyTok3[i+1] +// goto out +// } +// } + +// out: +// if token == 0 { +// token = yyTok2[1] /* unknown char */ +// } +// if yyDebug >= 3 { +// __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) +// } +// return char, token +// } + +// func yyParse(yylex yyLexer) int { +// return yyNewParser().Parse(yylex) +// } + +// func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { +// var yyn int +// var yyVAL yySymType +// var yyDollar []yySymType +// _ = yyDollar // silence set and not used +// yyS := yyrcvr.stack[:] + +// Nerrs := 0 /* number of errors */ +// Errflag := 0 /* error recovery flag */ +// yystate := 0 +// yyrcvr.char = -1 +// yytoken := -1 // yyrcvr.char translated into internal numbering +// defer func() { +// // Make sure we report no lookahead when not parsing. +// yystate = -1 +// yyrcvr.char = -1 +// yytoken = -1 +// }() +// yyp := -1 +// goto yystack + +// ret0: +// return 0 + +// ret1: +// return 1 + +// yystack: +// /* put a state and value onto the stack */ +// if yyDebug >= 4 { +// __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) +// } + +// yyp++ +// if yyp >= len(yyS) { +// nyys := make([]yySymType, len(yyS)*2) +// copy(nyys, yyS) +// yyS = nyys +// } +// yyS[yyp] = yyVAL +// yyS[yyp].yys = yystate + +// yynewstate: +// yyn = yyPact[yystate] +// if yyn <= yyFlag { +// goto yydefault /* simple state */ +// } +// if yyrcvr.char < 0 { +// yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) +// } +// yyn += yytoken +// if yyn < 0 || yyn >= yyLast { +// goto yydefault +// } +// yyn = yyAct[yyn] +// if yyChk[yyn] == yytoken { /* valid shift */ +// yyrcvr.char = -1 +// yytoken = -1 +// yyVAL = yyrcvr.lval +// yystate = yyn +// if Errflag > 0 { +// Errflag-- +// } +// goto yystack +// } + +// yydefault: +// /* default state action */ +// yyn = yyDef[yystate] +// if yyn == -2 { +// if yyrcvr.char < 0 { +// yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) +// } + +// /* look through exception table */ +// xi := 0 +// for { +// if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate { +// break +// } +// xi += 2 +// } +// for xi += 2; ; xi += 2 { +// yyn = yyExca[xi+0] +// if yyn < 0 || yyn == yytoken { +// break +// } +// } +// yyn = yyExca[xi+1] +// if yyn < 0 { +// goto ret0 +// } +// } +// if yyn == 0 { +// /* error ... attempt to resume parsing */ +// switch Errflag { +// case 0: /* brand new error */ +// yylex.Error(yyErrorMessage(yystate, yytoken)) +// Nerrs++ +// if yyDebug >= 1 { +// __yyfmt__.Printf("%s", yyStatname(yystate)) +// __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) +// } +// fallthrough + +// case 1, 2: /* incompletely recovered error ... try again */ +// Errflag = 3 + +// /* find a state where "error" is a legal shift action */ +// for yyp >= 0 { +// yyn = yyPact[yyS[yyp].yys] + yyErrCode +// if yyn >= 0 && yyn < yyLast { +// yystate = yyAct[yyn] /* simulate a shift of "error" */ +// if yyChk[yystate] == yyErrCode { +// goto yystack +// } +// } + +// /* the current p has no shift on "error", pop stack */ +// if yyDebug >= 2 { +// __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) +// } +// yyp-- +// } +// /* there is no state on the stack with an error shift ... abort */ +// goto ret1 + +// case 3: /* no shift yet; clobber input char */ +// if yyDebug >= 2 { +// __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) +// } +// if yytoken == yyEofCode { +// goto ret1 +// } +// yyrcvr.char = -1 +// yytoken = -1 +// goto yynewstate /* try again in the same state */ +// } +// } + +// /* reduction by production yyn */ +// if yyDebug >= 2 { +// __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) +// } + +// yynt := yyn +// yypt := yyp +// _ = yypt // guard against "declared and not used" + +// yyp -= yyR2[yyn] +// // yyp is now the index of $0. Perform the default action. Iff the +// // reduced production is ε, $1 is possibly out of range. +// if yyp+1 >= len(yyS) { +// nyys := make([]yySymType, len(yyS)*2) +// copy(nyys, yyS) +// yyS = nyys +// } +// yyVAL = yyS[yyp+1] + +// /* consult goto table to find next state */ +// yyn = yyR1[yyn] +// yyg := yyPgo[yyn] +// yyj := yyg + yyS[yyp].yys + 1 + +// if yyj >= yyLast { +// yystate = yyAct[yyg] +// } else { +// yystate = yyAct[yyj] +// if yyChk[yystate] != -yyn { +// yystate = yyAct[yyg] +// } +// } +// // dummy call; replaced with literal code +// switch yynt { + +// case 3: +// yyDollar = yyS[yypt-1:yypt+1] +// { WARNING("syntax error"); } +// case 6: +// yyDollar = yyS[yypt-2:yypt+1] +// { codegen = 1; makeiattr(0, 0); } +// case 7: +// yyDollar = yyS[yypt-3:yypt+1] +// { rightthing(yyDollar[1].o, '}'); yyVAL.o = yyDollar[2].o; } +// case 8: +// yyDollar = yyS[yypt-3:yypt+1] +// { y.o=yyDollar[3].o; makevar(yyDollar[1].p,PLACENAME,y); yyVAL.o = yyDollar[3].o; } +// case 9: +// yyDollar = yyS[yypt-4:yypt+1] +// { y.o=yyDollar[4].o; makevar(yyDollar[1].p,PLACENAME,y); yyVAL.o = yyDollar[4].o; } +// case 10: +// yyDollar = yyS[yypt-4:yypt+1] +// { y.o=yyDollar[3].o; makevar(yyDollar[1].p,PLACENAME,y); yyVAL.o = yyDollar[3].o; } +// case 11: +// yyDollar = yyS[yypt-2:yypt+1] +// { y.f = yyDollar[1].f; yyVAL.o = y.o; yyVAL.o = makenode(PLACE, 0); } +// case 12: +// yyDollar = yyS[yypt-1:yypt+1] +// { setdir(yyDollar[1].i); yyVAL.o = makenode(PLACE, 0); } +// case 13: +// yyDollar = yyS[yypt-3:yypt+1] +// { printexpr(yyDollar[2].f); yyVAL.o = makenode(PLACE, 0); } +// case 14: +// yyDollar = yyS[yypt-3:yypt+1] +// { printpos(yyDollar[2].o); yyVAL.o = makenode(PLACE, 0); } +// case 15: +// yyDollar = yyS[yypt-3:yypt+1] +// { printf("%s\n", yyDollar[2].p); free(yyDollar[2].p); yyVAL.o = makenode(PLACE, 0); } +// case 16: +// yyDollar = yyS[yypt-3:yypt+1] +// { resetvar(); makeiattr(0, 0); yyVAL.o = makenode(PLACE, 0); } +// case 22: +// yyDollar = yyS[yypt-1:yypt+1] +// { makevattr(yyDollar[1].p); } +// case 23: +// yyDollar = yyS[yypt-2:yypt+1] +// { makevattr(yyDollar[2].p); } +// case 24: +// yyDollar = yyS[yypt-3:yypt+1] +// { makevattr(yyDollar[3].p); } +// case 25: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f=y.f=yyDollar[3].f; makevar(yyDollar[1].p,VARNAME,y); checkscale(yyDollar[1].p); } +// case 26: +// yyDollar = yyS[yypt-2:yypt+1] +// { copy(); } +// case 29: +// yyDollar = yyS[yypt-1:yypt+1] +// { copyfile(yyDollar[1].p); } +// case 30: +// yyDollar = yyS[yypt-2:yypt+1] +// { copydef(yyDollar[2].st); } +// case 31: +// yyDollar = yyS[yypt-2:yypt+1] +// { copyuntil(yyDollar[2].p); } +// case 32: +// yyDollar = yyS[yypt-10:yypt+1] +// { forloop(yyDollar[2].p, yyDollar[4].f, yyDollar[6].f, yyDollar[8].i, yyDollar[9].f, yyDollar[10].p); } +// case 33: +// yyDollar = yyS[yypt-7:yypt+1] +// { forloop(yyDollar[2].p, yyDollar[4].f, yyDollar[6].f, '+', 1.0, yyDollar[7].p); } +// case 34: +// yyDollar = yyS[yypt-10:yypt+1] +// { forloop(yyDollar[2].p, yyDollar[4].f, yyDollar[6].f, yyDollar[8].i, yyDollar[9].f, yyDollar[10].p); } +// case 35: +// yyDollar = yyS[yypt-7:yypt+1] +// { forloop(yyDollar[2].p, yyDollar[4].f, yyDollar[6].f, '+', 1.0, yyDollar[7].p); } +// case 36: +// yyDollar = yyS[yypt-4:yypt+1] +// { ifstat(yyDollar[2].f, yyDollar[3].p, yyDollar[4].p); } +// case 37: +// yyDollar = yyS[yypt-3:yypt+1] +// { ifstat(yyDollar[2].f, yyDollar[3].p, (char *) 0); } +// case 39: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = strcmp(yyDollar[1].p,yyDollar[3].p) == 0; free(yyDollar[1].p); free(yyDollar[3].p); } +// case 40: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = strcmp(yyDollar[1].p,yyDollar[3].p) != 0; free(yyDollar[1].p); free(yyDollar[3].p); } +// case 41: +// yyDollar = yyS[yypt-1:yypt+1] +// { y.f = 0; makevar(yyDollar[1].p, VARNAME, y); } +// case 42: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.i = '+'; } +// case 43: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.i = '-'; } +// case 44: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.i = '*'; } +// case 45: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.i = '/'; } +// case 46: +// yyDollar = yyS[yypt-0:yypt+1] +// { yyVAL.i = ' '; } +// case 47: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.o = leftthing('{'); } +// case 48: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = boxgen(); } +// case 49: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = circgen(yyDollar[1].i); } +// case 50: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = circgen(yyDollar[1].i); } +// case 51: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = arcgen(yyDollar[1].i); } +// case 52: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = linegen(yyDollar[1].i); } +// case 53: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = linegen(yyDollar[1].i); } +// case 54: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = linegen(yyDollar[1].i); } +// case 55: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = movegen(); } +// case 56: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = textgen(); } +// case 57: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.o = troffgen(yyDollar[1].p); } +// case 58: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o=rightthing(yyDollar[1].o,']'); } +// case 59: +// yyDollar = yyS[yypt-5:yypt+1] +// { yyVAL.o = blockgen(yyDollar[1].o, yyDollar[4].o); } +// case 60: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.o = leftthing('['); } +// case 63: +// yyDollar = yyS[yypt-2:yypt+1] +// { makefattr(yyDollar[1].i, !DEFAULT, yyDollar[2].f); } +// case 64: +// yyDollar = yyS[yypt-1:yypt+1] +// { makefattr(yyDollar[1].i, DEFAULT, 0.0); } +// case 65: +// yyDollar = yyS[yypt-1:yypt+1] +// { makefattr(curdir(), !DEFAULT, yyDollar[1].f); } +// case 66: +// yyDollar = yyS[yypt-2:yypt+1] +// { makefattr(yyDollar[1].i, !DEFAULT, yyDollar[2].f); } +// case 67: +// yyDollar = yyS[yypt-1:yypt+1] +// { makefattr(yyDollar[1].i, DEFAULT, 0.0); } +// case 68: +// yyDollar = yyS[yypt-2:yypt+1] +// { makeoattr(yyDollar[1].i, yyDollar[2].o); } +// case 69: +// yyDollar = yyS[yypt-2:yypt+1] +// { makeoattr(yyDollar[1].i, yyDollar[2].o); } +// case 70: +// yyDollar = yyS[yypt-2:yypt+1] +// { makeoattr(yyDollar[1].i, yyDollar[2].o); } +// case 71: +// yyDollar = yyS[yypt-2:yypt+1] +// { makeoattr(yyDollar[1].i, yyDollar[2].o); } +// case 72: +// yyDollar = yyS[yypt-2:yypt+1] +// { makeiattr(WITH, yyDollar[2].i); } +// case 73: +// yyDollar = yyS[yypt-3:yypt+1] +// { makeoattr(PLACE, getblock(getlast(1,BLOCK), yyDollar[3].p)); } +// case 74: +// yyDollar = yyS[yypt-4:yypt+1] +// { makeoattr(PLACE, getpos(getblock(getlast(1,BLOCK), yyDollar[3].p), yyDollar[4].i)); } +// case 75: +// yyDollar = yyS[yypt-2:yypt+1] +// { makeoattr(PLACE, yyDollar[2].o); } +// case 76: +// yyDollar = yyS[yypt-1:yypt+1] +// { makeiattr(SAME, yyDollar[1].i); } +// case 77: +// yyDollar = yyS[yypt-1:yypt+1] +// { maketattr(yyDollar[1].i, (char *) 0); } +// case 78: +// yyDollar = yyS[yypt-1:yypt+1] +// { makeiattr(HEAD, yyDollar[1].i); } +// case 79: +// yyDollar = yyS[yypt-2:yypt+1] +// { makefattr(DOT, !DEFAULT, yyDollar[2].f); } +// case 80: +// yyDollar = yyS[yypt-1:yypt+1] +// { makefattr(DOT, DEFAULT, 0.0); } +// case 81: +// yyDollar = yyS[yypt-2:yypt+1] +// { makefattr(DASH, !DEFAULT, yyDollar[2].f); } +// case 82: +// yyDollar = yyS[yypt-1:yypt+1] +// { makefattr(DASH, DEFAULT, 0.0); } +// case 83: +// yyDollar = yyS[yypt-2:yypt+1] +// { makefattr(CHOP, !DEFAULT, yyDollar[2].f); } +// case 84: +// yyDollar = yyS[yypt-1:yypt+1] +// { makefattr(CHOP, DEFAULT, 0.0); } +// case 85: +// yyDollar = yyS[yypt-2:yypt+1] +// { makeattr(CHOP, PLACENAME, getvar(yyDollar[2].p)); } +// case 86: +// yyDollar = yyS[yypt-2:yypt+1] +// { makefattr(FILL, !DEFAULT, yyDollar[2].f); } +// case 87: +// yyDollar = yyS[yypt-1:yypt+1] +// { makefattr(FILL, DEFAULT, 0.0); } +// case 88: +// yyDollar = yyS[yypt-1:yypt+1] +// { makeiattr(NOEDGE, 0); } +// case 92: +// yyDollar = yyS[yypt-1:yypt+1] +// { maketattr(CENTER, yyDollar[1].p); } +// case 93: +// yyDollar = yyS[yypt-2:yypt+1] +// { maketattr(yyDollar[2].i, yyDollar[1].p); } +// case 94: +// yyDollar = yyS[yypt-2:yypt+1] +// { addtattr(yyDollar[2].i); } +// case 96: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.p = sprintgen(yyDollar[3].p); } +// case 97: +// yyDollar = yyS[yypt-6:yypt+1] +// { yyVAL.p = sprintgen(yyDollar[3].p); } +// case 98: +// yyDollar = yyS[yypt-1:yypt+1] +// { exprsave(yyDollar[1].f); yyVAL.i = 0; } +// case 99: +// yyDollar = yyS[yypt-3:yypt+1] +// { exprsave(yyDollar[3].f); } +// case 101: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = yyDollar[2].o; } +// case 102: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = makepos(yyDollar[1].f, yyDollar[3].f); } +// case 103: +// yyDollar = yyS[yypt-5:yypt+1] +// { yyVAL.o = fixpos(yyDollar[1].o, yyDollar[3].f, yyDollar[5].f); } +// case 104: +// yyDollar = yyS[yypt-5:yypt+1] +// { yyVAL.o = fixpos(yyDollar[1].o, -yyDollar[3].f, -yyDollar[5].f); } +// case 105: +// yyDollar = yyS[yypt-7:yypt+1] +// { yyVAL.o = fixpos(yyDollar[1].o, yyDollar[4].f, yyDollar[6].f); } +// case 106: +// yyDollar = yyS[yypt-7:yypt+1] +// { yyVAL.o = fixpos(yyDollar[1].o, -yyDollar[4].f, -yyDollar[6].f); } +// case 107: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = addpos(yyDollar[1].o, yyDollar[3].o); } +// case 108: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = subpos(yyDollar[1].o, yyDollar[3].o); } +// case 109: +// yyDollar = yyS[yypt-5:yypt+1] +// { yyVAL.o = makepos(getcomp(yyDollar[2].o,DOTX), getcomp(yyDollar[4].o,DOTY)); } +// case 110: +// yyDollar = yyS[yypt-6:yypt+1] +// { yyVAL.o = makebetween(yyDollar[1].f, yyDollar[3].o, yyDollar[5].o); } +// case 111: +// yyDollar = yyS[yypt-5:yypt+1] +// { yyVAL.o = makebetween(yyDollar[1].f, yyDollar[3].o, yyDollar[5].o); } +// case 112: +// yyDollar = yyS[yypt-1:yypt+1] +// { y = getvar(yyDollar[1].p); yyVAL.o = y.o; } +// case 113: +// yyDollar = yyS[yypt-2:yypt+1] +// { y = getvar(yyDollar[1].p); yyVAL.o = getpos(y.o, yyDollar[2].i); } +// case 114: +// yyDollar = yyS[yypt-2:yypt+1] +// { y = getvar(yyDollar[2].p); yyVAL.o = getpos(y.o, yyDollar[1].i); } +// case 115: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.o = gethere(); } +// case 116: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = getlast(yyDollar[1].i, yyDollar[2].i); } +// case 117: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = getpos(getlast(yyDollar[1].i, yyDollar[2].i), yyDollar[3].i); } +// case 118: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = getpos(getlast(yyDollar[2].i, yyDollar[3].i), yyDollar[1].i); } +// case 119: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = getfirst(yyDollar[1].i, yyDollar[2].i); } +// case 120: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = getpos(getfirst(yyDollar[1].i, yyDollar[2].i), yyDollar[3].i); } +// case 121: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.o = getpos(getfirst(yyDollar[2].i, yyDollar[3].i), yyDollar[1].i); } +// case 123: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = getpos(yyDollar[1].o, yyDollar[2].i); } +// case 124: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.o = getpos(yyDollar[2].o, yyDollar[1].i); } +// case 125: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.o = getblock(getlast(yyDollar[1].i,yyDollar[2].i), yyDollar[4].p); } +// case 126: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.o = getblock(getfirst(yyDollar[1].i,yyDollar[2].i), yyDollar[4].p); } +// case 127: +// yyDollar = yyS[yypt-3:yypt+1] +// { y = getvar(yyDollar[1].p); yyVAL.o = getblock(y.o, yyDollar[3].p); } +// case 128: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.i = yyDollar[1].i + 1; } +// case 129: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.i = yyDollar[1].i; } +// case 130: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.i = 1; } +// case 140: +// yyDollar = yyS[yypt-1:yypt+1] +// { yyVAL.f = getfval(yyDollar[1].p); } +// case 142: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f + yyDollar[3].f; } +// case 143: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f - yyDollar[3].f; } +// case 144: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f * yyDollar[3].f; } +// case 145: +// yyDollar = yyS[yypt-3:yypt+1] +// { if (yyDollar[3].f == 0.0) { +// WARNING("division by 0"); yyDollar[3].f = 1; } +// yyVAL.f = yyDollar[1].f / yyDollar[3].f; } +// case 146: +// yyDollar = yyS[yypt-3:yypt+1] +// { if ((long)yyDollar[3].f == 0) { +// WARNING("mod division by 0"); yyDollar[3].f = 1; } +// yyVAL.f = (long)yyDollar[1].f % (long)yyDollar[3].f; } +// case 147: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = -yyDollar[2].f; } +// case 148: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = yyDollar[2].f; } +// case 149: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[2].f; } +// case 150: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = getcomp(yyDollar[1].o, yyDollar[2].i); } +// case 151: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = getcomp(yyDollar[1].o, yyDollar[2].i); } +// case 152: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = getcomp(yyDollar[1].o, yyDollar[2].i); } +// case 153: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = getcomp(yyDollar[1].o, yyDollar[2].i); } +// case 154: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = getcomp(yyDollar[1].o, yyDollar[2].i); } +// case 155: +// yyDollar = yyS[yypt-3:yypt+1] +// { y = getvar(yyDollar[1].p); yyVAL.f = getblkvar(y.o, yyDollar[3].p); } +// case 156: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = getblkvar(getlast(yyDollar[1].i,yyDollar[2].i), yyDollar[4].p); } +// case 157: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = getblkvar(getfirst(yyDollar[1].i,yyDollar[2].i), yyDollar[4].p); } +// case 158: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f > yyDollar[3].f; } +// case 159: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f < yyDollar[3].f; } +// case 160: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f <= yyDollar[3].f; } +// case 161: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f >= yyDollar[3].f; } +// case 162: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f == yyDollar[3].f; } +// case 163: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f != yyDollar[3].f; } +// case 164: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f && yyDollar[3].f; } +// case 165: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = yyDollar[1].f || yyDollar[3].f; } +// case 166: +// yyDollar = yyS[yypt-2:yypt+1] +// { yyVAL.f = !(yyDollar[2].f); } +// case 167: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = Log10(yyDollar[3].f); } +// case 168: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = Exp(yyDollar[3].f * log(10.0)); } +// case 169: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = pow(yyDollar[1].f, yyDollar[3].f); } +// case 170: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = sin(yyDollar[3].f); } +// case 171: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = cos(yyDollar[3].f); } +// case 172: +// yyDollar = yyS[yypt-6:yypt+1] +// { yyVAL.f = atan2(yyDollar[3].f, yyDollar[5].f); } +// case 173: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = Sqrt(yyDollar[3].f); } +// case 174: +// yyDollar = yyS[yypt-3:yypt+1] +// { yyVAL.f = (float)rand() / RAND_MAX; } +// case 175: +// yyDollar = yyS[yypt-6:yypt+1] +// { yyVAL.f = yyDollar[3].f >= yyDollar[5].f ? yyDollar[3].f : yyDollar[5].f; } +// case 176: +// yyDollar = yyS[yypt-6:yypt+1] +// { yyVAL.f = yyDollar[3].f <= yyDollar[5].f ? yyDollar[3].f : yyDollar[5].f; } +// case 177: +// yyDollar = yyS[yypt-4:yypt+1] +// { yyVAL.f = (long) yyDollar[3].f; } +// } +// goto yystack /* stack new state and value */ +// } diff --git a/pic/pic.y b/pic/pic.y new file mode 100755 index 0000000..b5f218a --- /dev/null +++ b/pic/pic.y @@ -0,0 +1,351 @@ +%union{ + str string + result Result +} + + +%{ +/* + * Changes by Gunnar Ritter, Freiburg i. Br., Germany, October 2005. + * + * Derived from Plan 9 v4 /sys/src/cmd/pic/ + * + * Copyright (C) 2003, Lucent Technologies Inc. and others. + * All Rights Reserved. + * + * Distributed under the terms of the Lucent Public License Version 1.02. + */ + +/* Sccsid @(#)picy.y 1.4 (gritter) 11/28/05 */ + +#include +#include "pic.h" +#include +#include +#include + +#ifndef RAND_MAX +#define RAND_MAX 32767 +#endif + +YYSTYPE y; + +extern void yyerror(char *); +extern int yylex(void); +%} + +%token BOX 1 /* DON'T CHANGE THESE! */ +%token LINE 2 +%token ARROW 3 +%token CIRCLE 4 +%token ELLIPSE 5 +%token ARC 6 +%token SPLINE 7 +%token BLOCK 8 +%token

TEXT 9 +%token

TROFF 10 +%token MOVE 11 +%token BLOCKEND 12 +%token PLACE 13 +%token PRINT RESET THRU UNTIL +%token FOR IF COPY +%token

THENSTR ELSESTR DOSTR PLACENAME VARNAME SPRINTF +%token DEFNAME +%token ATTR TEXTATTR +%token LEFT RIGHT UP DOWN FROM TO AT BY WITH HEAD CW CCW THEN +%token HEIGHT WIDTH RADIUS DIAMETER LENGTH SIZE +%token CORNER HERE LAST NTH SAME BETWEEN AND +%token EAST WEST NORTH SOUTH NE NW SE SW START END +%token DOTX DOTY DOTHT DOTWID DOTRAD +%token NUMBER +%token LOG EXP SIN COS ATAN2 SQRT RAND MIN MAX INT +%token DIR +%token DOT DASH CHOP FILL NOEDGE +%token ST /* statement terminator */ + +%right '=' +%left OROR +%left ANDAND +%nonassoc GT LT LE GE EQ NEQ +%left '+' '-' +%left '*' '/' '%' +%right UMINUS NOT +%right '^' + +%type expr if_expr asgn +%type

name text +%type optop exprlist +%type if for copy + +/* this is a lie: picture and position are really the whole union */ +%type leftbrace picture piclist position lbracket +%type prim place blockname +%type textlist textattr /* not a sensible value */ +%type last type + +%% + +top: + piclist + | /* empty */ + | error { WARNING("syntax error"); } + ; + +piclist: + picture + | piclist picture + ; + +picture: + prim ST { codegen = 1; makeiattr(0, 0); } + | leftbrace piclist '}' { rightthing($1, '}'); $$ = $2; } + | PLACENAME ':' picture { y.o=$3; makevar($1,PLACENAME,y); $$ = $3; } + | PLACENAME ':' ST picture { y.o=$4; makevar($1,PLACENAME,y); $$ = $4; } + | PLACENAME ':' position ST { y.o=$3; makevar($1,PLACENAME,y); $$ = $3; } + | asgn ST { y.f = $1; $$ = y.o; $$ = makenode(PLACE, 0); } + | DIR { setdir($1); $$ = makenode(PLACE, 0); } + | PRINT expr ST { printexpr($2); $$ = makenode(PLACE, 0); } + | PRINT position ST { printpos($2); $$ = makenode(PLACE, 0); } + | PRINT text ST { printf("%s\n", $2); free($2); $$ = makenode(PLACE, 0); } + | RESET varlist ST { resetvar(); makeiattr(0, 0); $$ = makenode(PLACE, 0); } + | copy + | for + | if + | ST + ; + +varlist: + /* empty */ + | VARNAME { makevattr($1); } + | varlist VARNAME { makevattr($2); } + | varlist ',' VARNAME { makevattr($3); } + ; + +asgn: + VARNAME '=' expr { $$=y.f=$3; makevar($1,VARNAME,y); checkscale($1); } + ; + +copy: + COPY copylist { copy(); } + ; +copylist: + copyattr + | copylist copyattr + ; +copyattr: + text { copyfile($1); } + | THRU DEFNAME { copydef($2); } + | UNTIL text { copyuntil($2); } + ; + +for: + FOR name FROM expr TO expr BY optop expr DOSTR + { forloop($2, $4, $6, $8, $9, $10); } + | FOR name FROM expr TO expr DOSTR + { forloop($2, $4, $6, '+', 1.0, $7); } + | FOR name '=' expr TO expr BY optop expr DOSTR + { forloop($2, $4, $6, $8, $9, $10); } + | FOR name '=' expr TO expr DOSTR + { forloop($2, $4, $6, '+', 1.0, $7); } + ; + +if: + IF if_expr THENSTR ELSESTR { ifstat($2, $3, $4); } + | IF if_expr THENSTR { ifstat($2, $3, (char *) 0); } + ; +if_expr: + expr + | text EQ text { $$ = strcmp($1,$3) == 0; free($1); free($3); } + | text NEQ text { $$ = strcmp($1,$3) != 0; free($1); free($3); } + ; + +name: + VARNAME { y.f = 0; makevar($1, VARNAME, y); } + ; +optop: + '+' { $$ = '+'; } + | '-' { $$ = '-'; } + | '*' { $$ = '*'; } + | '/' { $$ = '/'; } + | /* empty */ { $$ = ' '; } + ; + + +leftbrace: + '{' { $$ = leftthing('{'); } + ; + +prim: + BOX attrlist { $$ = boxgen(); } + | CIRCLE attrlist { $$ = circgen($1); } + | ELLIPSE attrlist { $$ = circgen($1); } + | ARC attrlist { $$ = arcgen($1); } + | LINE attrlist { $$ = linegen($1); } + | ARROW attrlist { $$ = linegen($1); } + | SPLINE attrlist { $$ = linegen($1); } + | MOVE attrlist { $$ = movegen(); } + | textlist attrlist { $$ = textgen(); } + | TROFF { $$ = troffgen($1); } + | lbracket piclist ']' { $$=rightthing($1,']'); } attrlist + { $$ = blockgen($1, $4); } + ; + +lbracket: + '[' { $$ = leftthing('['); } + ; + +attrlist: + attrlist attr + | /* empty */ + ; + +attr: + ATTR expr { makefattr($1, !DEFAULT, $2); } + | ATTR { makefattr($1, DEFAULT, 0.0); } + | expr { makefattr(curdir(), !DEFAULT, $1); } + | DIR expr { makefattr($1, !DEFAULT, $2); } + | DIR { makefattr($1, DEFAULT, 0.0); } + | FROM position { makeoattr($1, $2); } + | TO position { makeoattr($1, $2); } + | AT position { makeoattr($1, $2); } + | BY position { makeoattr($1, $2); } + | WITH CORNER { makeiattr(WITH, $2); } + | WITH '.' PLACENAME { makeoattr(PLACE, getblock(getlast(1,BLOCK), $3)); } + | WITH '.' PLACENAME CORNER + { makeoattr(PLACE, getpos(getblock(getlast(1,BLOCK), $3), $4)); } + | WITH position { makeoattr(PLACE, $2); } + | SAME { makeiattr(SAME, $1); } + | TEXTATTR { maketattr($1, (char *) 0); } + | HEAD { makeiattr(HEAD, $1); } + | DOT expr { makefattr(DOT, !DEFAULT, $2); } + | DOT { makefattr(DOT, DEFAULT, 0.0); } + | DASH expr { makefattr(DASH, !DEFAULT, $2); } + | DASH { makefattr(DASH, DEFAULT, 0.0); } + | CHOP expr { makefattr(CHOP, !DEFAULT, $2); } + | CHOP { makefattr(CHOP, DEFAULT, 0.0); } + | CHOP PLACENAME { makeattr(CHOP, PLACENAME, getvar($2)); } + | FILL expr { makefattr(FILL, !DEFAULT, $2); } + | FILL { makefattr(FILL, DEFAULT, 0.0); } + | NOEDGE { makeiattr(NOEDGE, 0); } + | textlist + ; + +textlist: + textattr + | textlist textattr + ; +textattr: + text { maketattr(CENTER, $1); } + | text TEXTATTR { maketattr($2, $1); } + | textattr TEXTATTR { addtattr($2); } + ; +text: + TEXT + | SPRINTF '(' text ')' { $$ = sprintgen($3); } + | SPRINTF '(' text ',' exprlist ')' { $$ = sprintgen($3); } + ; + +exprlist: + expr { exprsave($1); $$ = 0; } + | exprlist ',' expr { exprsave($3); } + ; + +position: /* absolute, not relative */ + place + | '(' position ')' { $$ = $2; } + | expr ',' expr { $$ = makepos($1, $3); } + | position '+' expr ',' expr { $$ = fixpos($1, $3, $5); } + | position '-' expr ',' expr { $$ = fixpos($1, -$3, -$5); } + | position '+' '(' expr ',' expr ')' { $$ = fixpos($1, $4, $6); } + | position '-' '(' expr ',' expr ')' { $$ = fixpos($1, -$4, -$6); } + | position '+' place { $$ = addpos($1, $3); } + | position '-' place { $$ = subpos($1, $3); } + | '(' place ',' place ')' { $$ = makepos(getcomp($2,DOTX), getcomp($4,DOTY)); } + | expr LT position ',' position GT { $$ = makebetween($1, $3, $5); } + | expr BETWEEN position AND position { $$ = makebetween($1, $3, $5); } + ; + +place: + PLACENAME { y = getvar($1); $$ = y.o; } + | PLACENAME CORNER { y = getvar($1); $$ = getpos(y.o, $2); } + | CORNER PLACENAME { y = getvar($2); $$ = getpos(y.o, $1); } + | HERE { $$ = gethere(); } + | last type { $$ = getlast($1, $2); } + | last type CORNER { $$ = getpos(getlast($1, $2), $3); } + | CORNER last type { $$ = getpos(getlast($2, $3), $1); } + | NTH type { $$ = getfirst($1, $2); } + | NTH type CORNER { $$ = getpos(getfirst($1, $2), $3); } + | CORNER NTH type { $$ = getpos(getfirst($2, $3), $1); } + | blockname + | blockname CORNER { $$ = getpos($1, $2); } + | CORNER blockname { $$ = getpos($2, $1); } + ; + +blockname: + last BLOCK '.' PLACENAME { $$ = getblock(getlast($1,$2), $4); } + | NTH BLOCK '.' PLACENAME { $$ = getblock(getfirst($1,$2), $4); } + | PLACENAME '.' PLACENAME { y = getvar($1); $$ = getblock(y.o, $3); } + ; + +last: + last LAST { $$ = $1 + 1; } + | NTH LAST { $$ = $1; } + | LAST { $$ = 1; } + ; + +type: + BOX + | CIRCLE + | ELLIPSE + | ARC + | LINE + | ARROW + | SPLINE + | BLOCK + ; + +expr: + NUMBER + | VARNAME { $$ = getfval($1); } + | asgn + | expr '+' expr { $$ = $1 + $3; } + | expr '-' expr { $$ = $1 - $3; } + | expr '*' expr { $$ = $1 * $3; } + | expr '/' expr { if ($3 == 0.0) { + WARNING("division by 0"); $3 = 1; } + $$ = $1 / $3; } + | expr '%' expr { if ((long)$3 == 0) { + WARNING("mod division by 0"); $3 = 1; } + $$ = (long)$1 % (long)$3; } + | '-' expr %prec UMINUS { $$ = -$2; } + | '+' expr %prec UMINUS { $$ = $2; } + | '(' expr ')' { $$ = $2; } + | place DOTX { $$ = getcomp($1, $2); } + | place DOTY { $$ = getcomp($1, $2); } + | place DOTHT { $$ = getcomp($1, $2); } + | place DOTWID { $$ = getcomp($1, $2); } + | place DOTRAD { $$ = getcomp($1, $2); } + | PLACENAME '.' VARNAME { y = getvar($1); $$ = getblkvar(y.o, $3); } + | last BLOCK '.' VARNAME { $$ = getblkvar(getlast($1,$2), $4); } + | NTH BLOCK '.' VARNAME { $$ = getblkvar(getfirst($1,$2), $4); } + | expr GT expr { $$ = $1 > $3; } + | expr LT expr { $$ = $1 < $3; } + | expr LE expr { $$ = $1 <= $3; } + | expr GE expr { $$ = $1 >= $3; } + | expr EQ expr { $$ = $1 == $3; } + | expr NEQ expr { $$ = $1 != $3; } + | expr ANDAND expr { $$ = $1 && $3; } + | expr OROR expr { $$ = $1 || $3; } + | NOT expr { $$ = !($2); } + | LOG '(' expr ')' { $$ = Log10($3); } + | EXP '(' expr ')' { $$ = Exp($3 * log(10.0)); } + | expr '^' expr { $$ = pow($1, $3); } + | SIN '(' expr ')' { $$ = sin($3); } + | COS '(' expr ')' { $$ = cos($3); } + | ATAN2 '(' expr ',' expr ')' { $$ = atan2($3, $5); } + | SQRT '(' expr ')' { $$ = Sqrt($3); } + | RAND '(' ')' { $$ = (float)rand() / RAND_MAX; } + | MAX '(' expr ',' expr ')' { $$ = $3 >= $5 ? $3 : $5; } + | MIN '(' expr ',' expr ')' { $$ = $3 <= $5 ? $3 : $5; } + | INT '(' expr ')' { $$ = (long) $3; } + ; diff --git a/pic/y.output b/pic/y.output new file mode 100755 index 0000000..4e7521f --- /dev/null +++ b/pic/y.output @@ -0,0 +1,6893 @@ + +state 0 + $accept: .top $end + top: . (2) + + $end reduce 2 (src line 90) + error shift 3 + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 7 + VARNAME shift 28 + SPRINTF shift 36 + DIR shift 9 + ST shift 15 + '{' shift 27 + '[' shift 33 + . error + + asgn goto 8 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 4 + piclist goto 2 + lbracket goto 26 + prim goto 5 + textlist goto 24 + textattr goto 32 + top goto 1 + +state 1 + $accept: top.$end + + $end accept + . error + + +state 2 + top: piclist. (1) + piclist: piclist.picture + + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 7 + VARNAME shift 28 + SPRINTF shift 36 + DIR shift 9 + ST shift 15 + '{' shift 27 + '[' shift 33 + . reduce 1 (src line 88) + + asgn goto 8 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 37 + lbracket goto 26 + prim goto 5 + textlist goto 24 + textattr goto 32 + +state 3 + top: error. (3) + + . reduce 3 (src line 91) + + +state 4 + piclist: picture. (4) + + . reduce 4 (src line 94) + + +state 5 + picture: prim.ST + + ST shift 38 + . error + + +state 6 + picture: leftbrace.piclist '}' + + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 7 + VARNAME shift 28 + SPRINTF shift 36 + DIR shift 9 + ST shift 15 + '{' shift 27 + '[' shift 33 + . error + + asgn goto 8 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 4 + piclist goto 39 + lbracket goto 26 + prim goto 5 + textlist goto 24 + textattr goto 32 + +state 7 + picture: PLACENAME.':' picture + picture: PLACENAME.':' ST picture + picture: PLACENAME.':' position ST + + ':' shift 40 + . error + + +state 8 + picture: asgn.ST + + ST shift 41 + . error + + +state 9 + picture: DIR. (12) + + . reduce 12 (src line 106) + + +state 10 + picture: PRINT.expr ST + picture: PRINT.position ST + picture: PRINT.text ST + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 42 + asgn goto 47 + text goto 44 + position goto 43 + place goto 51 + blockname goto 68 + last goto 53 + +11: shift/reduce conflict (shift 71(0), red'n 21(0)) on VARNAME +state 11 + picture: RESET.varlist ST + varlist: . (21) + + VARNAME shift 71 + . reduce 21 (src line 117) + + varlist goto 70 + +state 12 + picture: copy. (17) + + . reduce 17 (src line 111) + + +state 13 + picture: for. (18) + + . reduce 18 (src line 112) + + +state 14 + picture: if. (19) + + . reduce 19 (src line 113) + + +state 15 + picture: ST. (20) + + . reduce 20 (src line 114) + + +state 16 + prim: BOX.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 72 + +state 17 + prim: CIRCLE.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 73 + +state 18 + prim: ELLIPSE.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 74 + +state 19 + prim: ARC.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 75 + +state 20 + prim: LINE.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 76 + +state 21 + prim: ARROW.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 77 + +state 22 + prim: SPLINE.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 78 + +state 23 + prim: MOVE.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 79 + +24: shift/reduce conflict (shift 35(0), red'n 62(0)) on TEXT +24: shift/reduce conflict (shift 36(0), red'n 62(0)) on SPRINTF +state 24 + prim: textlist.attrlist + textlist: textlist.textattr + attrlist: . (62) + + TEXT shift 35 + SPRINTF shift 36 + . reduce 62 (src line 199) + + text goto 34 + textattr goto 81 + attrlist goto 80 + +state 25 + prim: TROFF. (57) + + . reduce 57 (src line 188) + + +state 26 + prim: lbracket.piclist ']' $$58 attrlist + + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 7 + VARNAME shift 28 + SPRINTF shift 36 + DIR shift 9 + ST shift 15 + '{' shift 27 + '[' shift 33 + . error + + asgn goto 8 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 4 + piclist goto 82 + lbracket goto 26 + prim goto 5 + textlist goto 24 + textattr goto 32 + +state 27 + leftbrace: '{'. (47) + + . reduce 47 (src line 174) + + +state 28 + asgn: VARNAME.'=' expr + + '=' shift 83 + . error + + +state 29 + copy: COPY.copylist + + TEXT shift 35 + THRU shift 87 + UNTIL shift 88 + SPRINTF shift 36 + . error + + text goto 86 + copylist goto 84 + copyattr goto 85 + +state 30 + for: FOR.name FROM expr TO expr BY optop expr DOSTR + for: FOR.name FROM expr TO expr DOSTR + for: FOR.name '=' expr TO expr BY optop expr DOSTR + for: FOR.name '=' expr TO expr DOSTR + + VARNAME shift 90 + . error + + name goto 89 + +state 31 + if: IF.if_expr THENSTR ELSESTR + if: IF.if_expr THENSTR + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 92 + if_expr goto 91 + asgn goto 47 + text goto 93 + place goto 95 + blockname goto 68 + last goto 53 + +32: shift/reduce conflict (shift 96(0), red'n 90(0)) on TEXTATTR +state 32 + textlist: textattr. (90) + textattr: textattr.TEXTATTR + + TEXTATTR shift 96 + . reduce 90 (src line 233) + + +state 33 + lbracket: '['. (60) + + . reduce 60 (src line 193) + + +34: shift/reduce conflict (shift 97(0), red'n 92(0)) on TEXTATTR +state 34 + textattr: text. (92) + textattr: text.TEXTATTR + + TEXTATTR shift 97 + . reduce 92 (src line 237) + + +state 35 + text: TEXT. (95) + + . reduce 95 (src line 242) + + +state 36 + text: SPRINTF.'(' text ')' + text: SPRINTF.'(' text ',' exprlist ')' + + '(' shift 98 + . error + + +state 37 + piclist: piclist picture. (5) + + . reduce 5 (src line 96) + + +state 38 + picture: prim ST. (6) + + . reduce 6 (src line 99) + + +state 39 + piclist: piclist.picture + picture: leftbrace piclist.'}' + + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 7 + VARNAME shift 28 + SPRINTF shift 36 + DIR shift 9 + ST shift 15 + '}' shift 99 + '{' shift 27 + '[' shift 33 + . error + + asgn goto 8 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 37 + lbracket goto 26 + prim goto 5 + textlist goto 24 + textattr goto 32 + +state 40 + picture: PLACENAME ':'.picture + picture: PLACENAME ':'.ST picture + picture: PLACENAME ':'.position ST + + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 103 + VARNAME shift 46 + SPRINTF shift 36 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 9 + ST shift 101 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '{' shift 27 + '[' shift 33 + '(' shift 50 + . error + + expr goto 105 + asgn goto 104 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 100 + position goto 102 + lbracket goto 26 + prim goto 5 + place goto 51 + blockname goto 68 + textlist goto 24 + textattr goto 32 + last goto 53 + +state 41 + picture: asgn ST. (11) + + . reduce 11 (src line 105) + + +state 42 + picture: PRINT expr.ST + position: expr.',' expr + position: expr.LT position ',' position GT + position: expr.BETWEEN position AND position + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + BETWEEN shift 109 + ST shift 106 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 108 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 107 + . error + + +state 43 + picture: PRINT position.ST + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + ST shift 123 + '+' shift 124 + '-' shift 125 + . error + + +state 44 + picture: PRINT text.ST + + ST shift 126 + . error + + +state 45 + expr: NUMBER. (139) + + . reduce 139 (src line 307) + + +state 46 + asgn: VARNAME.'=' expr + expr: VARNAME. (140) + + '=' shift 83 + . reduce 140 (src line 309) + + +state 47 + expr: asgn. (141) + + . reduce 141 (src line 310) + + +state 48 + expr: '-'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 127 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 49 + expr: '+'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 128 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 50 + position: '('.position ')' + position: '('.place ',' place ')' + expr: '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 131 + asgn goto 47 + position goto 129 + place goto 130 + blockname goto 68 + last goto 53 + +state 51 + position: place. (100) + expr: place.DOTX + expr: place.DOTY + expr: place.DOTHT + expr: place.DOTWID + expr: place.DOTRAD + + DOTX shift 132 + DOTY shift 133 + DOTHT shift 134 + DOTWID shift 135 + DOTRAD shift 136 + . reduce 100 (src line 253) + + +52: shift/reduce conflict (shift 137(0), red'n 112(0)) on CORNER +state 52 + place: PLACENAME. (112) + place: PLACENAME.CORNER + blockname: PLACENAME.'.' PLACENAME + expr: PLACENAME.'.' VARNAME + + CORNER shift 137 + '.' shift 138 + . reduce 112 (src line 268) + + +state 53 + place: last.type + place: last.type CORNER + blockname: last.BLOCK '.' PLACENAME + last: last.LAST + expr: last.BLOCK '.' VARNAME + + BOX shift 142 + LINE shift 146 + ARROW shift 147 + CIRCLE shift 143 + ELLIPSE shift 144 + ARC shift 145 + SPLINE shift 148 + BLOCK shift 140 + LAST shift 141 + . error + + type goto 139 + +state 54 + place: NTH.type + place: NTH.type CORNER + blockname: NTH.BLOCK '.' PLACENAME + last: NTH.LAST + expr: NTH.BLOCK '.' VARNAME + + BOX shift 142 + LINE shift 146 + ARROW shift 147 + CIRCLE shift 143 + ELLIPSE shift 144 + ARC shift 145 + SPLINE shift 148 + BLOCK shift 150 + LAST shift 151 + . error + + type goto 149 + +state 55 + expr: NOT.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 152 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 56 + expr: LOG.'(' expr ')' + + '(' shift 153 + . error + + +state 57 + expr: EXP.'(' expr ')' + + '(' shift 154 + . error + + +state 58 + expr: SIN.'(' expr ')' + + '(' shift 155 + . error + + +state 59 + expr: COS.'(' expr ')' + + '(' shift 156 + . error + + +state 60 + expr: ATAN2.'(' expr ',' expr ')' + + '(' shift 157 + . error + + +state 61 + expr: SQRT.'(' expr ')' + + '(' shift 158 + . error + + +state 62 + expr: RAND.'(' ')' + + '(' shift 159 + . error + + +state 63 + expr: MAX.'(' expr ',' expr ')' + + '(' shift 160 + . error + + +state 64 + expr: MIN.'(' expr ',' expr ')' + + '(' shift 161 + . error + + +state 65 + expr: INT.'(' expr ')' + + '(' shift 162 + . error + + +state 66 + place: CORNER.PLACENAME + place: CORNER.last type + place: CORNER.NTH type + place: CORNER.blockname + + PLACENAME shift 163 + LAST shift 69 + NTH shift 165 + . error + + blockname goto 166 + last goto 164 + +state 67 + place: HERE. (115) + + . reduce 115 (src line 272) + + +68: shift/reduce conflict (shift 167(0), red'n 122(0)) on CORNER +state 68 + place: blockname. (122) + place: blockname.CORNER + + CORNER shift 167 + . reduce 122 (src line 279) + + +state 69 + last: LAST. (130) + + . reduce 130 (src line 293) + + +state 70 + picture: RESET varlist.ST + varlist: varlist.VARNAME + varlist: varlist.',' VARNAME + + VARNAME shift 169 + ST shift 168 + ',' shift 170 + . error + + +state 71 + varlist: VARNAME. (22) + + . reduce 22 (src line 119) + + +state 72 + prim: BOX attrlist. (48) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 48 (src line 178) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 73 + prim: CIRCLE attrlist. (49) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 49 (src line 180) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 74 + prim: ELLIPSE attrlist. (50) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 50 (src line 181) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 75 + prim: ARC attrlist. (51) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 51 (src line 182) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 76 + prim: LINE attrlist. (52) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 52 (src line 183) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 77 + prim: ARROW attrlist. (53) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 53 (src line 184) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 78 + prim: SPLINE attrlist. (54) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 54 (src line 185) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 79 + prim: MOVE attrlist. (55) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 55 (src line 186) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 80 + prim: textlist attrlist. (56) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 56 (src line 187) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +81: shift/reduce conflict (shift 96(0), red'n 91(0)) on TEXTATTR +state 81 + textlist: textlist textattr. (91) + textattr: textattr.TEXTATTR + + TEXTATTR shift 96 + . reduce 91 (src line 235) + + +state 82 + piclist: piclist.picture + prim: lbracket piclist.']' $$58 attrlist + + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 7 + VARNAME shift 28 + SPRINTF shift 36 + DIR shift 9 + ST shift 15 + '{' shift 27 + ']' shift 189 + '[' shift 33 + . error + + asgn goto 8 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 37 + lbracket goto 26 + prim goto 5 + textlist goto 24 + textattr goto 32 + +state 83 + asgn: VARNAME '='.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 190 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +84: shift/reduce conflict (shift 35(0), red'n 26(0)) on TEXT +84: shift/reduce conflict (shift 36(0), red'n 26(0)) on SPRINTF +state 84 + copy: COPY copylist. (26) + copylist: copylist.copyattr + + TEXT shift 35 + THRU shift 87 + UNTIL shift 88 + SPRINTF shift 36 + . reduce 26 (src line 128) + + text goto 86 + copyattr goto 191 + +state 85 + copylist: copyattr. (27) + + . reduce 27 (src line 131) + + +state 86 + copyattr: text. (29) + + . reduce 29 (src line 135) + + +state 87 + copyattr: THRU.DEFNAME + + DEFNAME shift 192 + . error + + +state 88 + copyattr: UNTIL.text + + TEXT shift 35 + SPRINTF shift 36 + . error + + text goto 193 + +state 89 + for: FOR name.FROM expr TO expr BY optop expr DOSTR + for: FOR name.FROM expr TO expr DOSTR + for: FOR name.'=' expr TO expr BY optop expr DOSTR + for: FOR name.'=' expr TO expr DOSTR + + FROM shift 194 + '=' shift 195 + . error + + +state 90 + name: VARNAME. (41) + + . reduce 41 (src line 162) + + +state 91 + if: IF if_expr.THENSTR ELSESTR + if: IF if_expr.THENSTR + + THENSTR shift 196 + . error + + +state 92 + if_expr: expr. (38) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 38 (src line 156) + + +state 93 + if_expr: text.EQ text + if_expr: text.NEQ text + + EQ shift 198 + NEQ shift 199 + . error + + +state 94 + expr: '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 200 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 95 + expr: place.DOTX + expr: place.DOTY + expr: place.DOTHT + expr: place.DOTWID + expr: place.DOTRAD + + DOTX shift 132 + DOTY shift 133 + DOTHT shift 134 + DOTWID shift 135 + DOTRAD shift 136 + . error + + +state 96 + textattr: textattr TEXTATTR. (94) + + . reduce 94 (src line 240) + + +state 97 + textattr: text TEXTATTR. (93) + + . reduce 93 (src line 239) + + +state 98 + text: SPRINTF '('.text ')' + text: SPRINTF '('.text ',' exprlist ')' + + TEXT shift 35 + SPRINTF shift 36 + . error + + text goto 201 + +state 99 + picture: leftbrace piclist '}'. (7) + + . reduce 7 (src line 101) + + +state 100 + picture: PLACENAME ':' picture. (8) + + . reduce 8 (src line 102) + + +101: shift/reduce conflict (shift 16(0), red'n 20(0)) on BOX +101: shift/reduce conflict (shift 20(0), red'n 20(0)) on LINE +101: shift/reduce conflict (shift 21(0), red'n 20(0)) on ARROW +101: shift/reduce conflict (shift 17(0), red'n 20(0)) on CIRCLE +101: shift/reduce conflict (shift 18(0), red'n 20(0)) on ELLIPSE +101: shift/reduce conflict (shift 19(0), red'n 20(0)) on ARC +101: shift/reduce conflict (shift 22(0), red'n 20(0)) on SPLINE +101: shift/reduce conflict (shift 35(0), red'n 20(0)) on TEXT +101: shift/reduce conflict (shift 25(0), red'n 20(0)) on TROFF +101: shift/reduce conflict (shift 23(0), red'n 20(0)) on MOVE +101: shift/reduce conflict (shift 10(0), red'n 20(0)) on PRINT +101: shift/reduce conflict (shift 11(0), red'n 20(0)) on RESET +101: shift/reduce conflict (shift 30(0), red'n 20(0)) on FOR +101: shift/reduce conflict (shift 31(0), red'n 20(0)) on IF +101: shift/reduce conflict (shift 29(0), red'n 20(0)) on COPY +101: shift/reduce conflict (shift 7(0), red'n 20(0)) on PLACENAME +101: shift/reduce conflict (shift 28(0), red'n 20(0)) on VARNAME +101: shift/reduce conflict (shift 36(0), red'n 20(0)) on SPRINTF +101: shift/reduce conflict (shift 9(0), red'n 20(0)) on DIR +101: shift/reduce conflict (shift 15(0), red'n 20(0)) on ST +101: shift/reduce conflict (shift 27(0), red'n 20(0)) on '{' +101: shift/reduce conflict (shift 33(0), red'n 20(0)) on '[' +state 101 + picture: PLACENAME ':' ST.picture + picture: ST. (20) + + BOX shift 16 + LINE shift 20 + ARROW shift 21 + CIRCLE shift 17 + ELLIPSE shift 18 + ARC shift 19 + SPLINE shift 22 + TEXT shift 35 + TROFF shift 25 + MOVE shift 23 + PRINT shift 10 + RESET shift 11 + FOR shift 30 + IF shift 31 + COPY shift 29 + PLACENAME shift 7 + VARNAME shift 28 + SPRINTF shift 36 + DIR shift 9 + ST shift 15 + '{' shift 27 + '[' shift 33 + . reduce 20 (src line 114) + + asgn goto 8 + text goto 34 + if goto 14 + for goto 13 + copy goto 12 + leftbrace goto 6 + picture goto 202 + lbracket goto 26 + prim goto 5 + textlist goto 24 + textattr goto 32 + +state 102 + picture: PLACENAME ':' position.ST + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + ST shift 203 + '+' shift 124 + '-' shift 125 + . error + + +state 103 + picture: PLACENAME.':' picture + picture: PLACENAME.':' ST picture + picture: PLACENAME.':' position ST + place: PLACENAME. (112) + place: PLACENAME.CORNER + blockname: PLACENAME.'.' PLACENAME + expr: PLACENAME.'.' VARNAME + + CORNER shift 137 + ':' shift 40 + '.' shift 138 + . reduce 112 (src line 268) + + +state 104 + picture: asgn.ST + expr: asgn. (141) + + ST shift 41 + . reduce 141 (src line 310) + + +state 105 + position: expr.',' expr + position: expr.LT position ',' position GT + position: expr.BETWEEN position AND position + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + BETWEEN shift 109 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 108 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 107 + . error + + +state 106 + picture: PRINT expr ST. (13) + + . reduce 13 (src line 107) + + +state 107 + position: expr ','.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 204 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 108 + position: expr LT.position ',' position GT + expr: expr LT.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 206 + asgn goto 47 + position goto 205 + place goto 51 + blockname goto 68 + last goto 53 + +state 109 + position: expr BETWEEN.position AND position + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 207 + place goto 51 + blockname goto 68 + last goto 53 + +state 110 + expr: expr '+'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 208 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 111 + expr: expr '-'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 209 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 112 + expr: expr '*'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 210 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 113 + expr: expr '/'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 211 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 114 + expr: expr '%'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 212 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 115 + expr: expr GT.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 213 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 116 + expr: expr LE.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 214 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 117 + expr: expr GE.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 215 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 118 + expr: expr EQ.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 216 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 119 + expr: expr NEQ.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 217 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 120 + expr: expr ANDAND.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 218 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 121 + expr: expr OROR.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 219 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 122 + expr: expr '^'.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 220 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 123 + picture: PRINT position ST. (14) + + . reduce 14 (src line 108) + + +state 124 + position: position '+'.expr ',' expr + position: position '+'.'(' expr ',' expr ')' + position: position '+'.place + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 222 + . error + + expr goto 221 + asgn goto 47 + place goto 223 + blockname goto 68 + last goto 53 + +state 125 + position: position '-'.expr ',' expr + position: position '-'.'(' expr ',' expr ')' + position: position '-'.place + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 225 + . error + + expr goto 224 + asgn goto 47 + place goto 226 + blockname goto 68 + last goto 53 + +state 126 + picture: PRINT text ST. (15) + + . reduce 15 (src line 109) + + +state 127 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: '-' expr. (147) + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + '^' shift 122 + . reduce 147 (src line 320) + + +state 128 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: '+' expr. (148) + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + '^' shift 122 + . reduce 148 (src line 321) + + +state 129 + position: '(' position.')' + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + '+' shift 124 + '-' shift 125 + ')' shift 227 + . error + + +state 130 + position: place. (100) + position: '(' place.',' place ')' + expr: place.DOTX + expr: place.DOTY + expr: place.DOTHT + expr: place.DOTWID + expr: place.DOTRAD + + DOTX shift 132 + DOTY shift 133 + DOTHT shift 134 + DOTWID shift 135 + DOTRAD shift 136 + ',' shift 228 + . reduce 100 (src line 253) + + +state 131 + position: expr.',' expr + position: expr.LT position ',' position GT + position: expr.BETWEEN position AND position + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: '(' expr.')' + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + BETWEEN shift 109 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 108 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 107 + ')' shift 229 + . error + + +state 132 + expr: place DOTX. (150) + + . reduce 150 (src line 323) + + +state 133 + expr: place DOTY. (151) + + . reduce 151 (src line 324) + + +state 134 + expr: place DOTHT. (152) + + . reduce 152 (src line 325) + + +state 135 + expr: place DOTWID. (153) + + . reduce 153 (src line 326) + + +state 136 + expr: place DOTRAD. (154) + + . reduce 154 (src line 327) + + +state 137 + place: PLACENAME CORNER. (113) + + . reduce 113 (src line 270) + + +state 138 + blockname: PLACENAME '.'.PLACENAME + expr: PLACENAME '.'.VARNAME + + PLACENAME shift 230 + VARNAME shift 231 + . error + + +139: shift/reduce conflict (shift 232(0), red'n 116(0)) on CORNER +state 139 + place: last type. (116) + place: last type.CORNER + + CORNER shift 232 + . reduce 116 (src line 273) + + +state 140 + blockname: last BLOCK.'.' PLACENAME + type: BLOCK. (138) + expr: last BLOCK.'.' VARNAME + + '.' shift 233 + . reduce 138 (src line 304) + + +state 141 + last: last LAST. (128) + + . reduce 128 (src line 290) + + +state 142 + type: BOX. (131) + + . reduce 131 (src line 296) + + +state 143 + type: CIRCLE. (132) + + . reduce 132 (src line 298) + + +state 144 + type: ELLIPSE. (133) + + . reduce 133 (src line 299) + + +state 145 + type: ARC. (134) + + . reduce 134 (src line 300) + + +state 146 + type: LINE. (135) + + . reduce 135 (src line 301) + + +state 147 + type: ARROW. (136) + + . reduce 136 (src line 302) + + +state 148 + type: SPLINE. (137) + + . reduce 137 (src line 303) + + +149: shift/reduce conflict (shift 234(0), red'n 119(0)) on CORNER +state 149 + place: NTH type. (119) + place: NTH type.CORNER + + CORNER shift 234 + . reduce 119 (src line 276) + + +state 150 + blockname: NTH BLOCK.'.' PLACENAME + type: BLOCK. (138) + expr: NTH BLOCK.'.' VARNAME + + '.' shift 235 + . reduce 138 (src line 304) + + +state 151 + last: NTH LAST. (129) + + . reduce 129 (src line 292) + + +state 152 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: NOT expr. (166) + expr: expr.'^' expr + + '^' shift 122 + . reduce 166 (src line 339) + + +state 153 + expr: LOG '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 236 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 154 + expr: EXP '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 237 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 155 + expr: SIN '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 238 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 156 + expr: COS '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 239 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 157 + expr: ATAN2 '('.expr ',' expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 240 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 158 + expr: SQRT '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 241 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 159 + expr: RAND '('.')' + + ')' shift 242 + . error + + +state 160 + expr: MAX '('.expr ',' expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 243 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 161 + expr: MIN '('.expr ',' expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 244 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 162 + expr: INT '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 245 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 163 + place: CORNER PLACENAME. (114) + blockname: PLACENAME.'.' PLACENAME + + '.' shift 246 + . reduce 114 (src line 271) + + +state 164 + place: CORNER last.type + blockname: last.BLOCK '.' PLACENAME + last: last.LAST + + BOX shift 142 + LINE shift 146 + ARROW shift 147 + CIRCLE shift 143 + ELLIPSE shift 144 + ARC shift 145 + SPLINE shift 148 + BLOCK shift 248 + LAST shift 141 + . error + + type goto 247 + +state 165 + place: CORNER NTH.type + blockname: NTH.BLOCK '.' PLACENAME + last: NTH.LAST + + BOX shift 142 + LINE shift 146 + ARROW shift 147 + CIRCLE shift 143 + ELLIPSE shift 144 + ARC shift 145 + SPLINE shift 148 + BLOCK shift 250 + LAST shift 151 + . error + + type goto 249 + +state 166 + place: CORNER blockname. (124) + + . reduce 124 (src line 281) + + +state 167 + place: blockname CORNER. (123) + + . reduce 123 (src line 280) + + +state 168 + picture: RESET varlist ST. (16) + + . reduce 16 (src line 110) + + +state 169 + varlist: varlist VARNAME. (23) + + . reduce 23 (src line 120) + + +state 170 + varlist: varlist ','.VARNAME + + VARNAME shift 251 + . error + + +state 171 + attrlist: attrlist attr. (61) + + . reduce 61 (src line 197) + + +172: shift/reduce conflict (shift 52(0), red'n 64(0)) on PLACENAME +172: shift/reduce conflict (shift 46(0), red'n 64(0)) on VARNAME +172: shift/reduce conflict (shift 66(0), red'n 64(0)) on CORNER +172: shift/reduce conflict (shift 67(0), red'n 64(0)) on HERE +172: shift/reduce conflict (shift 69(0), red'n 64(0)) on LAST +172: shift/reduce conflict (shift 54(0), red'n 64(0)) on NTH +172: shift/reduce conflict (shift 45(0), red'n 64(0)) on NUMBER +172: shift/reduce conflict (shift 56(0), red'n 64(0)) on LOG +172: shift/reduce conflict (shift 57(0), red'n 64(0)) on EXP +172: shift/reduce conflict (shift 58(0), red'n 64(0)) on SIN +172: shift/reduce conflict (shift 59(0), red'n 64(0)) on COS +172: shift/reduce conflict (shift 60(0), red'n 64(0)) on ATAN2 +172: shift/reduce conflict (shift 61(0), red'n 64(0)) on SQRT +172: shift/reduce conflict (shift 62(0), red'n 64(0)) on RAND +172: shift/reduce conflict (shift 64(0), red'n 64(0)) on MIN +172: shift/reduce conflict (shift 63(0), red'n 64(0)) on MAX +172: shift/reduce conflict (shift 65(0), red'n 64(0)) on INT +172: shift/reduce conflict (shift 49(5), red'n 64(0)) on '+' +172: shift/reduce conflict (shift 48(5), red'n 64(0)) on '-' +172: shift/reduce conflict (shift 55(7), red'n 64(0)) on NOT +172: shift/reduce conflict (shift 94(0), red'n 64(0)) on '(' +state 172 + attr: ATTR.expr + attr: ATTR. (64) + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 64 (src line 204) + + expr goto 252 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +173: shift/reduce conflict (shift 110(5), red'n 65(0)) on '+' +173: shift/reduce conflict (shift 111(5), red'n 65(0)) on '-' +state 173 + attr: expr. (65) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 65 (src line 205) + + +174: shift/reduce conflict (shift 52(0), red'n 67(0)) on PLACENAME +174: shift/reduce conflict (shift 46(0), red'n 67(0)) on VARNAME +174: shift/reduce conflict (shift 66(0), red'n 67(0)) on CORNER +174: shift/reduce conflict (shift 67(0), red'n 67(0)) on HERE +174: shift/reduce conflict (shift 69(0), red'n 67(0)) on LAST +174: shift/reduce conflict (shift 54(0), red'n 67(0)) on NTH +174: shift/reduce conflict (shift 45(0), red'n 67(0)) on NUMBER +174: shift/reduce conflict (shift 56(0), red'n 67(0)) on LOG +174: shift/reduce conflict (shift 57(0), red'n 67(0)) on EXP +174: shift/reduce conflict (shift 58(0), red'n 67(0)) on SIN +174: shift/reduce conflict (shift 59(0), red'n 67(0)) on COS +174: shift/reduce conflict (shift 60(0), red'n 67(0)) on ATAN2 +174: shift/reduce conflict (shift 61(0), red'n 67(0)) on SQRT +174: shift/reduce conflict (shift 62(0), red'n 67(0)) on RAND +174: shift/reduce conflict (shift 64(0), red'n 67(0)) on MIN +174: shift/reduce conflict (shift 63(0), red'n 67(0)) on MAX +174: shift/reduce conflict (shift 65(0), red'n 67(0)) on INT +174: shift/reduce conflict (shift 49(5), red'n 67(0)) on '+' +174: shift/reduce conflict (shift 48(5), red'n 67(0)) on '-' +174: shift/reduce conflict (shift 55(7), red'n 67(0)) on NOT +174: shift/reduce conflict (shift 94(0), red'n 67(0)) on '(' +state 174 + attr: DIR.expr + attr: DIR. (67) + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 67 (src line 207) + + expr goto 253 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 175 + attr: FROM.position + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 254 + place goto 51 + blockname goto 68 + last goto 53 + +state 176 + attr: TO.position + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 255 + place goto 51 + blockname goto 68 + last goto 53 + +state 177 + attr: AT.position + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 256 + place goto 51 + blockname goto 68 + last goto 53 + +state 178 + attr: BY.position + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 257 + place goto 51 + blockname goto 68 + last goto 53 + +state 179 + attr: WITH.CORNER + attr: WITH.'.' PLACENAME + attr: WITH.'.' PLACENAME CORNER + attr: WITH.position + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 258 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '.' shift 259 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 260 + place goto 51 + blockname goto 68 + last goto 53 + +state 180 + attr: SAME. (76) + + . reduce 76 (src line 217) + + +state 181 + attr: TEXTATTR. (77) + + . reduce 77 (src line 218) + + +state 182 + attr: HEAD. (78) + + . reduce 78 (src line 219) + + +183: shift/reduce conflict (shift 52(0), red'n 80(0)) on PLACENAME +183: shift/reduce conflict (shift 46(0), red'n 80(0)) on VARNAME +183: shift/reduce conflict (shift 66(0), red'n 80(0)) on CORNER +183: shift/reduce conflict (shift 67(0), red'n 80(0)) on HERE +183: shift/reduce conflict (shift 69(0), red'n 80(0)) on LAST +183: shift/reduce conflict (shift 54(0), red'n 80(0)) on NTH +183: shift/reduce conflict (shift 45(0), red'n 80(0)) on NUMBER +183: shift/reduce conflict (shift 56(0), red'n 80(0)) on LOG +183: shift/reduce conflict (shift 57(0), red'n 80(0)) on EXP +183: shift/reduce conflict (shift 58(0), red'n 80(0)) on SIN +183: shift/reduce conflict (shift 59(0), red'n 80(0)) on COS +183: shift/reduce conflict (shift 60(0), red'n 80(0)) on ATAN2 +183: shift/reduce conflict (shift 61(0), red'n 80(0)) on SQRT +183: shift/reduce conflict (shift 62(0), red'n 80(0)) on RAND +183: shift/reduce conflict (shift 64(0), red'n 80(0)) on MIN +183: shift/reduce conflict (shift 63(0), red'n 80(0)) on MAX +183: shift/reduce conflict (shift 65(0), red'n 80(0)) on INT +183: shift/reduce conflict (shift 49(5), red'n 80(0)) on '+' +183: shift/reduce conflict (shift 48(5), red'n 80(0)) on '-' +183: shift/reduce conflict (shift 55(7), red'n 80(0)) on NOT +183: shift/reduce conflict (shift 94(0), red'n 80(0)) on '(' +state 183 + attr: DOT.expr + attr: DOT. (80) + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 80 (src line 221) + + expr goto 261 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +184: shift/reduce conflict (shift 52(0), red'n 82(0)) on PLACENAME +184: shift/reduce conflict (shift 46(0), red'n 82(0)) on VARNAME +184: shift/reduce conflict (shift 66(0), red'n 82(0)) on CORNER +184: shift/reduce conflict (shift 67(0), red'n 82(0)) on HERE +184: shift/reduce conflict (shift 69(0), red'n 82(0)) on LAST +184: shift/reduce conflict (shift 54(0), red'n 82(0)) on NTH +184: shift/reduce conflict (shift 45(0), red'n 82(0)) on NUMBER +184: shift/reduce conflict (shift 56(0), red'n 82(0)) on LOG +184: shift/reduce conflict (shift 57(0), red'n 82(0)) on EXP +184: shift/reduce conflict (shift 58(0), red'n 82(0)) on SIN +184: shift/reduce conflict (shift 59(0), red'n 82(0)) on COS +184: shift/reduce conflict (shift 60(0), red'n 82(0)) on ATAN2 +184: shift/reduce conflict (shift 61(0), red'n 82(0)) on SQRT +184: shift/reduce conflict (shift 62(0), red'n 82(0)) on RAND +184: shift/reduce conflict (shift 64(0), red'n 82(0)) on MIN +184: shift/reduce conflict (shift 63(0), red'n 82(0)) on MAX +184: shift/reduce conflict (shift 65(0), red'n 82(0)) on INT +184: shift/reduce conflict (shift 49(5), red'n 82(0)) on '+' +184: shift/reduce conflict (shift 48(5), red'n 82(0)) on '-' +184: shift/reduce conflict (shift 55(7), red'n 82(0)) on NOT +184: shift/reduce conflict (shift 94(0), red'n 82(0)) on '(' +state 184 + attr: DASH.expr + attr: DASH. (82) + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 82 (src line 223) + + expr goto 262 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +185: shift/reduce conflict (shift 264(0), red'n 84(0)) on PLACENAME +185: shift/reduce conflict (shift 46(0), red'n 84(0)) on VARNAME +185: shift/reduce conflict (shift 66(0), red'n 84(0)) on CORNER +185: shift/reduce conflict (shift 67(0), red'n 84(0)) on HERE +185: shift/reduce conflict (shift 69(0), red'n 84(0)) on LAST +185: shift/reduce conflict (shift 54(0), red'n 84(0)) on NTH +185: shift/reduce conflict (shift 45(0), red'n 84(0)) on NUMBER +185: shift/reduce conflict (shift 56(0), red'n 84(0)) on LOG +185: shift/reduce conflict (shift 57(0), red'n 84(0)) on EXP +185: shift/reduce conflict (shift 58(0), red'n 84(0)) on SIN +185: shift/reduce conflict (shift 59(0), red'n 84(0)) on COS +185: shift/reduce conflict (shift 60(0), red'n 84(0)) on ATAN2 +185: shift/reduce conflict (shift 61(0), red'n 84(0)) on SQRT +185: shift/reduce conflict (shift 62(0), red'n 84(0)) on RAND +185: shift/reduce conflict (shift 64(0), red'n 84(0)) on MIN +185: shift/reduce conflict (shift 63(0), red'n 84(0)) on MAX +185: shift/reduce conflict (shift 65(0), red'n 84(0)) on INT +185: shift/reduce conflict (shift 49(5), red'n 84(0)) on '+' +185: shift/reduce conflict (shift 48(5), red'n 84(0)) on '-' +185: shift/reduce conflict (shift 55(7), red'n 84(0)) on NOT +185: shift/reduce conflict (shift 94(0), red'n 84(0)) on '(' +state 185 + attr: CHOP.expr + attr: CHOP. (84) + attr: CHOP.PLACENAME + + PLACENAME shift 264 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 84 (src line 225) + + expr goto 263 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +186: shift/reduce conflict (shift 52(0), red'n 87(0)) on PLACENAME +186: shift/reduce conflict (shift 46(0), red'n 87(0)) on VARNAME +186: shift/reduce conflict (shift 66(0), red'n 87(0)) on CORNER +186: shift/reduce conflict (shift 67(0), red'n 87(0)) on HERE +186: shift/reduce conflict (shift 69(0), red'n 87(0)) on LAST +186: shift/reduce conflict (shift 54(0), red'n 87(0)) on NTH +186: shift/reduce conflict (shift 45(0), red'n 87(0)) on NUMBER +186: shift/reduce conflict (shift 56(0), red'n 87(0)) on LOG +186: shift/reduce conflict (shift 57(0), red'n 87(0)) on EXP +186: shift/reduce conflict (shift 58(0), red'n 87(0)) on SIN +186: shift/reduce conflict (shift 59(0), red'n 87(0)) on COS +186: shift/reduce conflict (shift 60(0), red'n 87(0)) on ATAN2 +186: shift/reduce conflict (shift 61(0), red'n 87(0)) on SQRT +186: shift/reduce conflict (shift 62(0), red'n 87(0)) on RAND +186: shift/reduce conflict (shift 64(0), red'n 87(0)) on MIN +186: shift/reduce conflict (shift 63(0), red'n 87(0)) on MAX +186: shift/reduce conflict (shift 65(0), red'n 87(0)) on INT +186: shift/reduce conflict (shift 49(5), red'n 87(0)) on '+' +186: shift/reduce conflict (shift 48(5), red'n 87(0)) on '-' +186: shift/reduce conflict (shift 55(7), red'n 87(0)) on NOT +186: shift/reduce conflict (shift 94(0), red'n 87(0)) on '(' +state 186 + attr: FILL.expr + attr: FILL. (87) + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 87 (src line 228) + + expr goto 265 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 187 + attr: NOEDGE. (88) + + . reduce 88 (src line 229) + + +188: shift/reduce conflict (shift 35(0), red'n 89(0)) on TEXT +188: shift/reduce conflict (shift 36(0), red'n 89(0)) on SPRINTF +state 188 + attr: textlist. (89) + textlist: textlist.textattr + + TEXT shift 35 + SPRINTF shift 36 + . reduce 89 (src line 230) + + text goto 34 + textattr goto 81 + +state 189 + prim: lbracket piclist ']'.$$58 attrlist + $$58: . (58) + + . reduce 58 (src line 189) + + $$58 goto 266 + +state 190 + asgn: VARNAME '=' expr. (25) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 25 (src line 124) + + +state 191 + copylist: copylist copyattr. (28) + + . reduce 28 (src line 133) + + +state 192 + copyattr: THRU DEFNAME. (30) + + . reduce 30 (src line 137) + + +state 193 + copyattr: UNTIL text. (31) + + . reduce 31 (src line 138) + + +state 194 + for: FOR name FROM.expr TO expr BY optop expr DOSTR + for: FOR name FROM.expr TO expr DOSTR + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 267 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 195 + for: FOR name '='.expr TO expr BY optop expr DOSTR + for: FOR name '='.expr TO expr DOSTR + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 268 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 196 + if: IF if_expr THENSTR.ELSESTR + if: IF if_expr THENSTR. (37) + + ELSESTR shift 269 + . reduce 37 (src line 154) + + +state 197 + expr: expr LT.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 270 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 198 + if_expr: text EQ.text + + TEXT shift 35 + SPRINTF shift 36 + . error + + text goto 271 + +state 199 + if_expr: text NEQ.text + + TEXT shift 35 + SPRINTF shift 36 + . error + + text goto 272 + +state 200 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: '(' expr.')' + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 229 + . error + + +state 201 + text: SPRINTF '(' text.')' + text: SPRINTF '(' text.',' exprlist ')' + + ',' shift 274 + ')' shift 273 + . error + + +state 202 + picture: PLACENAME ':' ST picture. (9) + + . reduce 9 (src line 103) + + +state 203 + picture: PLACENAME ':' position ST. (10) + + . reduce 10 (src line 104) + + +204: shift/reduce conflict (shift 115(4), red'n 102(0)) on GT +204: shift/reduce conflict (shift 110(5), red'n 102(0)) on '+' +204: shift/reduce conflict (shift 111(5), red'n 102(0)) on '-' +state 204 + position: expr ',' expr. (102) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 102 (src line 256) + + +state 205 + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + position: expr LT position.',' position GT + + '+' shift 124 + '-' shift 125 + ',' shift 275 + . error + + +206: shift/reduce conflict (shift 109(0), red'n 159(4)) on BETWEEN +206: shift/reduce conflict (shift 107(0), red'n 159(4)) on ',' +state 206 + position: expr.',' expr + position: expr.LT position ',' position GT + position: expr.BETWEEN position AND position + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr LT expr. (159) + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + BETWEEN shift 109 + GT error + LT error + LE error + GE error + EQ error + NEQ error + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 107 + . reduce 159 (src line 332) + + +state 207 + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + position: expr BETWEEN position.AND position + + AND shift 276 + '+' shift 124 + '-' shift 125 + . error + + +state 208 + expr: expr.'+' expr + expr: expr '+' expr. (142) + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 142 (src line 311) + + +state 209 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr '-' expr. (143) + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 143 (src line 312) + + +state 210 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr '*' expr. (144) + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + '^' shift 122 + . reduce 144 (src line 313) + + +state 211 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr '/' expr. (145) + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + '^' shift 122 + . reduce 145 (src line 314) + + +state 212 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr '%' expr. (146) + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + '^' shift 122 + . reduce 146 (src line 317) + + +state 213 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr GT expr. (158) + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + GT error + LT error + LE error + GE error + EQ error + NEQ error + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 158 (src line 331) + + +state 214 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr LE expr. (160) + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + GT error + LT error + LE error + GE error + EQ error + NEQ error + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 160 (src line 333) + + +state 215 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr GE expr. (161) + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + GT error + LT error + LE error + GE error + EQ error + NEQ error + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 161 (src line 334) + + +state 216 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr EQ expr. (162) + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + GT error + LT error + LE error + GE error + EQ error + NEQ error + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 162 (src line 335) + + +state 217 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr NEQ expr. (163) + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + GT error + LT error + LE error + GE error + EQ error + NEQ error + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 163 (src line 336) + + +state 218 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr ANDAND expr. (164) + expr: expr.OROR expr + expr: expr.'^' expr + + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 164 (src line 337) + + +state 219 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr OROR expr. (165) + expr: expr.'^' expr + + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 165 (src line 338) + + +state 220 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: expr '^' expr. (169) + + '^' shift 122 + . reduce 169 (src line 342) + + +state 221 + position: position '+' expr.',' expr + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 277 + . error + + +state 222 + position: position '+' '('.expr ',' expr ')' + expr: '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 278 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 223 + position: position '+' place. (107) + expr: place.DOTX + expr: place.DOTY + expr: place.DOTHT + expr: place.DOTWID + expr: place.DOTRAD + + DOTX shift 132 + DOTY shift 133 + DOTHT shift 134 + DOTWID shift 135 + DOTRAD shift 136 + . reduce 107 (src line 261) + + +state 224 + position: position '-' expr.',' expr + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 279 + . error + + +state 225 + position: position '-' '('.expr ',' expr ')' + expr: '('.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 280 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 226 + position: position '-' place. (108) + expr: place.DOTX + expr: place.DOTY + expr: place.DOTHT + expr: place.DOTWID + expr: place.DOTRAD + + DOTX shift 132 + DOTY shift 133 + DOTHT shift 134 + DOTWID shift 135 + DOTRAD shift 136 + . reduce 108 (src line 262) + + +state 227 + position: '(' position ')'. (101) + + . reduce 101 (src line 255) + + +state 228 + position: '(' place ','.place ')' + + PLACENAME shift 282 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 284 + . error + + place goto 281 + blockname goto 68 + last goto 283 + +state 229 + expr: '(' expr ')'. (149) + + . reduce 149 (src line 322) + + +state 230 + blockname: PLACENAME '.' PLACENAME. (127) + + . reduce 127 (src line 287) + + +state 231 + expr: PLACENAME '.' VARNAME. (155) + + . reduce 155 (src line 328) + + +state 232 + place: last type CORNER. (117) + + . reduce 117 (src line 274) + + +state 233 + blockname: last BLOCK '.'.PLACENAME + expr: last BLOCK '.'.VARNAME + + PLACENAME shift 285 + VARNAME shift 286 + . error + + +state 234 + place: NTH type CORNER. (120) + + . reduce 120 (src line 277) + + +state 235 + blockname: NTH BLOCK '.'.PLACENAME + expr: NTH BLOCK '.'.VARNAME + + PLACENAME shift 287 + VARNAME shift 288 + . error + + +state 236 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: LOG '(' expr.')' + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 289 + . error + + +state 237 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: EXP '(' expr.')' + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 290 + . error + + +state 238 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: SIN '(' expr.')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 291 + . error + + +state 239 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: COS '(' expr.')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 292 + . error + + +state 240 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: ATAN2 '(' expr.',' expr ')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 293 + . error + + +state 241 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: SQRT '(' expr.')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 294 + . error + + +state 242 + expr: RAND '(' ')'. (174) + + . reduce 174 (src line 347) + + +state 243 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: MAX '(' expr.',' expr ')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 295 + . error + + +state 244 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: MIN '(' expr.',' expr ')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 296 + . error + + +state 245 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: INT '(' expr.')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 297 + . error + + +state 246 + blockname: PLACENAME '.'.PLACENAME + + PLACENAME shift 230 + . error + + +state 247 + place: CORNER last type. (118) + + . reduce 118 (src line 275) + + +state 248 + blockname: last BLOCK.'.' PLACENAME + type: BLOCK. (138) + + '.' shift 298 + . reduce 138 (src line 304) + + +state 249 + place: CORNER NTH type. (121) + + . reduce 121 (src line 278) + + +state 250 + blockname: NTH BLOCK.'.' PLACENAME + type: BLOCK. (138) + + '.' shift 299 + . reduce 138 (src line 304) + + +state 251 + varlist: varlist ',' VARNAME. (24) + + . reduce 24 (src line 121) + + +252: shift/reduce conflict (shift 110(5), red'n 63(0)) on '+' +252: shift/reduce conflict (shift 111(5), red'n 63(0)) on '-' +state 252 + attr: ATTR expr. (63) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 63 (src line 202) + + +253: shift/reduce conflict (shift 110(5), red'n 66(0)) on '+' +253: shift/reduce conflict (shift 111(5), red'n 66(0)) on '-' +state 253 + attr: DIR expr. (66) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 66 (src line 206) + + +254: shift/reduce conflict (shift 124(5), red'n 68(0)) on '+' +254: shift/reduce conflict (shift 125(5), red'n 68(0)) on '-' +state 254 + attr: FROM position. (68) + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + '+' shift 124 + '-' shift 125 + . reduce 68 (src line 208) + + +255: shift/reduce conflict (shift 124(5), red'n 69(0)) on '+' +255: shift/reduce conflict (shift 125(5), red'n 69(0)) on '-' +state 255 + attr: TO position. (69) + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + '+' shift 124 + '-' shift 125 + . reduce 69 (src line 209) + + +256: shift/reduce conflict (shift 124(5), red'n 70(0)) on '+' +256: shift/reduce conflict (shift 125(5), red'n 70(0)) on '-' +state 256 + attr: AT position. (70) + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + '+' shift 124 + '-' shift 125 + . reduce 70 (src line 210) + + +257: shift/reduce conflict (shift 124(5), red'n 71(0)) on '+' +257: shift/reduce conflict (shift 125(5), red'n 71(0)) on '-' +state 257 + attr: BY position. (71) + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + '+' shift 124 + '-' shift 125 + . reduce 71 (src line 211) + + +258: shift/reduce conflict (shift 163(0), red'n 72(0)) on PLACENAME +258: shift/reduce conflict (shift 69(0), red'n 72(0)) on LAST +258: shift/reduce conflict (shift 165(0), red'n 72(0)) on NTH +state 258 + attr: WITH CORNER. (72) + place: CORNER.PLACENAME + place: CORNER.last type + place: CORNER.NTH type + place: CORNER.blockname + + PLACENAME shift 163 + LAST shift 69 + NTH shift 165 + . reduce 72 (src line 212) + + blockname goto 166 + last goto 164 + +state 259 + attr: WITH '.'.PLACENAME + attr: WITH '.'.PLACENAME CORNER + + PLACENAME shift 300 + . error + + +260: shift/reduce conflict (shift 124(5), red'n 75(0)) on '+' +260: shift/reduce conflict (shift 125(5), red'n 75(0)) on '-' +state 260 + attr: WITH position. (75) + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + + '+' shift 124 + '-' shift 125 + . reduce 75 (src line 216) + + +261: shift/reduce conflict (shift 110(5), red'n 79(0)) on '+' +261: shift/reduce conflict (shift 111(5), red'n 79(0)) on '-' +state 261 + attr: DOT expr. (79) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 79 (src line 220) + + +262: shift/reduce conflict (shift 110(5), red'n 81(0)) on '+' +262: shift/reduce conflict (shift 111(5), red'n 81(0)) on '-' +state 262 + attr: DASH expr. (81) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 81 (src line 222) + + +263: shift/reduce conflict (shift 110(5), red'n 83(0)) on '+' +263: shift/reduce conflict (shift 111(5), red'n 83(0)) on '-' +state 263 + attr: CHOP expr. (83) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 83 (src line 224) + + +264: shift/reduce conflict (shift 137(0), red'n 85(0)) on CORNER +state 264 + attr: CHOP PLACENAME. (85) + place: PLACENAME. (112) + place: PLACENAME.CORNER + blockname: PLACENAME.'.' PLACENAME + expr: PLACENAME.'.' VARNAME + + CORNER shift 137 + DOTX reduce 112 (src line 268) + DOTY reduce 112 (src line 268) + DOTHT reduce 112 (src line 268) + DOTWID reduce 112 (src line 268) + DOTRAD reduce 112 (src line 268) + '.' shift 138 + . reduce 85 (src line 226) + + +265: shift/reduce conflict (shift 110(5), red'n 86(0)) on '+' +265: shift/reduce conflict (shift 111(5), red'n 86(0)) on '-' +state 265 + attr: FILL expr. (86) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 86 (src line 227) + + +state 266 + prim: lbracket piclist ']' $$58.attrlist + attrlist: . (62) + + . reduce 62 (src line 199) + + attrlist goto 301 + +state 267 + for: FOR name FROM expr.TO expr BY optop expr DOSTR + for: FOR name FROM expr.TO expr DOSTR + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + TO shift 302 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . error + + +state 268 + for: FOR name '=' expr.TO expr BY optop expr DOSTR + for: FOR name '=' expr.TO expr DOSTR + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + TO shift 303 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . error + + +state 269 + if: IF if_expr THENSTR ELSESTR. (36) + + . reduce 36 (src line 152) + + +state 270 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr LT expr. (159) + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + GT error + LT error + LE error + GE error + EQ error + NEQ error + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 159 (src line 332) + + +state 271 + if_expr: text EQ text. (39) + + . reduce 39 (src line 158) + + +state 272 + if_expr: text NEQ text. (40) + + . reduce 40 (src line 159) + + +state 273 + text: SPRINTF '(' text ')'. (96) + + . reduce 96 (src line 244) + + +state 274 + text: SPRINTF '(' text ','.exprlist ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 305 + asgn goto 47 + exprlist goto 304 + place goto 95 + blockname goto 68 + last goto 53 + +state 275 + position: expr LT position ','.position GT + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 306 + place goto 51 + blockname goto 68 + last goto 53 + +state 276 + position: expr BETWEEN position AND.position + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 50 + . error + + expr goto 105 + asgn goto 47 + position goto 307 + place goto 51 + blockname goto 68 + last goto 53 + +state 277 + position: position '+' expr ','.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 308 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 278 + position: position '+' '(' expr.',' expr ')' + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: '(' expr.')' + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 309 + ')' shift 229 + . error + + +state 279 + position: position '-' expr ','.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 310 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 280 + position: position '-' '(' expr.',' expr ')' + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: '(' expr.')' + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ',' shift 311 + ')' shift 229 + . error + + +state 281 + position: '(' place ',' place.')' + + ')' shift 312 + . error + + +state 282 + place: PLACENAME. (112) + place: PLACENAME.CORNER + blockname: PLACENAME.'.' PLACENAME + + CORNER shift 137 + '.' shift 246 + . reduce 112 (src line 268) + + +state 283 + place: last.type + place: last.type CORNER + blockname: last.BLOCK '.' PLACENAME + last: last.LAST + + BOX shift 142 + LINE shift 146 + ARROW shift 147 + CIRCLE shift 143 + ELLIPSE shift 144 + ARC shift 145 + SPLINE shift 148 + BLOCK shift 248 + LAST shift 141 + . error + + type goto 139 + +state 284 + place: NTH.type + place: NTH.type CORNER + blockname: NTH.BLOCK '.' PLACENAME + last: NTH.LAST + + BOX shift 142 + LINE shift 146 + ARROW shift 147 + CIRCLE shift 143 + ELLIPSE shift 144 + ARC shift 145 + SPLINE shift 148 + BLOCK shift 250 + LAST shift 151 + . error + + type goto 149 + +state 285 + blockname: last BLOCK '.' PLACENAME. (125) + + . reduce 125 (src line 284) + + +state 286 + expr: last BLOCK '.' VARNAME. (156) + + . reduce 156 (src line 329) + + +state 287 + blockname: NTH BLOCK '.' PLACENAME. (126) + + . reduce 126 (src line 286) + + +state 288 + expr: NTH BLOCK '.' VARNAME. (157) + + . reduce 157 (src line 330) + + +state 289 + expr: LOG '(' expr ')'. (167) + + . reduce 167 (src line 340) + + +state 290 + expr: EXP '(' expr ')'. (168) + + . reduce 168 (src line 341) + + +state 291 + expr: SIN '(' expr ')'. (170) + + . reduce 170 (src line 343) + + +state 292 + expr: COS '(' expr ')'. (171) + + . reduce 171 (src line 344) + + +state 293 + expr: ATAN2 '(' expr ','.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 313 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 294 + expr: SQRT '(' expr ')'. (173) + + . reduce 173 (src line 346) + + +state 295 + expr: MAX '(' expr ','.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 314 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 296 + expr: MIN '(' expr ','.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 315 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 297 + expr: INT '(' expr ')'. (177) + + . reduce 177 (src line 350) + + +state 298 + blockname: last BLOCK '.'.PLACENAME + + PLACENAME shift 285 + . error + + +state 299 + blockname: NTH BLOCK '.'.PLACENAME + + PLACENAME shift 287 + . error + + +300: shift/reduce conflict (shift 316(0), red'n 73(0)) on CORNER +state 300 + attr: WITH '.' PLACENAME. (73) + attr: WITH '.' PLACENAME.CORNER + + CORNER shift 316 + . reduce 73 (src line 213) + + +state 301 + prim: lbracket piclist ']' $$58 attrlist. (59) + attrlist: attrlist.attr + + TEXT shift 35 + PLACENAME shift 52 + VARNAME shift 46 + SPRINTF shift 36 + ATTR shift 172 + TEXTATTR shift 181 + FROM shift 175 + TO shift 176 + AT shift 177 + BY shift 178 + WITH shift 179 + HEAD shift 182 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + SAME shift 180 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + DIR shift 174 + DOT shift 183 + DASH shift 184 + CHOP shift 185 + FILL shift 186 + NOEDGE shift 187 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . reduce 59 (src line 189) + + expr goto 173 + asgn goto 47 + text goto 34 + place goto 95 + blockname goto 68 + textlist goto 188 + textattr goto 32 + last goto 53 + attr goto 171 + +state 302 + for: FOR name FROM expr TO.expr BY optop expr DOSTR + for: FOR name FROM expr TO.expr DOSTR + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 317 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 303 + for: FOR name '=' expr TO.expr BY optop expr DOSTR + for: FOR name '=' expr TO.expr DOSTR + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 318 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 304 + text: SPRINTF '(' text ',' exprlist.')' + exprlist: exprlist.',' expr + + ',' shift 320 + ')' shift 319 + . error + + +state 305 + exprlist: expr. (98) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 98 (src line 248) + + +state 306 + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + position: expr LT position ',' position.GT + + GT shift 321 + '+' shift 124 + '-' shift 125 + . error + + +307: shift/reduce conflict (shift 124(5), red'n 111(0)) on '+' +307: shift/reduce conflict (shift 125(5), red'n 111(0)) on '-' +state 307 + position: position.'+' expr ',' expr + position: position.'-' expr ',' expr + position: position.'+' '(' expr ',' expr ')' + position: position.'-' '(' expr ',' expr ')' + position: position.'+' place + position: position.'-' place + position: expr BETWEEN position AND position. (111) + + '+' shift 124 + '-' shift 125 + . reduce 111 (src line 265) + + +308: shift/reduce conflict (shift 115(4), red'n 103(0)) on GT +308: shift/reduce conflict (shift 110(5), red'n 103(0)) on '+' +308: shift/reduce conflict (shift 111(5), red'n 103(0)) on '-' +state 308 + position: position '+' expr ',' expr. (103) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 103 (src line 257) + + +state 309 + position: position '+' '(' expr ','.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 322 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +310: shift/reduce conflict (shift 115(4), red'n 104(0)) on GT +310: shift/reduce conflict (shift 110(5), red'n 104(0)) on '+' +310: shift/reduce conflict (shift 111(5), red'n 104(0)) on '-' +state 310 + position: position '-' expr ',' expr. (104) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 104 (src line 258) + + +state 311 + position: position '-' '(' expr ','.expr ')' + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 323 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 312 + position: '(' place ',' place ')'. (109) + + . reduce 109 (src line 263) + + +state 313 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: ATAN2 '(' expr ',' expr.')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 324 + . error + + +state 314 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: MAX '(' expr ',' expr.')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 325 + . error + + +state 315 + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + expr: MIN '(' expr ',' expr.')' + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 326 + . error + + +state 316 + attr: WITH '.' PLACENAME CORNER. (74) + + . reduce 74 (src line 214) + + +state 317 + for: FOR name FROM expr TO expr.BY optop expr DOSTR + for: FOR name FROM expr TO expr.DOSTR + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + DOSTR shift 328 + BY shift 327 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . error + + +state 318 + for: FOR name '=' expr TO expr.BY optop expr DOSTR + for: FOR name '=' expr TO expr.DOSTR + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + DOSTR shift 330 + BY shift 329 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . error + + +state 319 + text: SPRINTF '(' text ',' exprlist ')'. (97) + + . reduce 97 (src line 245) + + +state 320 + exprlist: exprlist ','.expr + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 331 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 321 + position: expr LT position ',' position GT. (110) + + . reduce 110 (src line 264) + + +state 322 + position: position '+' '(' expr ',' expr.')' + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 332 + . error + + +state 323 + position: position '-' '(' expr ',' expr.')' + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + ')' shift 333 + . error + + +state 324 + expr: ATAN2 '(' expr ',' expr ')'. (172) + + . reduce 172 (src line 345) + + +state 325 + expr: MAX '(' expr ',' expr ')'. (175) + + . reduce 175 (src line 348) + + +state 326 + expr: MIN '(' expr ',' expr ')'. (176) + + . reduce 176 (src line 349) + + +327: shift/reduce conflict (shift 335(5), red'n 46(0)) on '+' +327: shift/reduce conflict (shift 336(5), red'n 46(0)) on '-' +state 327 + for: FOR name FROM expr TO expr BY.optop expr DOSTR + optop: . (46) + + '+' shift 335 + '-' shift 336 + '*' shift 337 + '/' shift 338 + . reduce 46 (src line 170) + + optop goto 334 + +state 328 + for: FOR name FROM expr TO expr DOSTR. (33) + + . reduce 33 (src line 144) + + +329: shift/reduce conflict (shift 335(5), red'n 46(0)) on '+' +329: shift/reduce conflict (shift 336(5), red'n 46(0)) on '-' +state 329 + for: FOR name '=' expr TO expr BY.optop expr DOSTR + optop: . (46) + + '+' shift 335 + '-' shift 336 + '*' shift 337 + '/' shift 338 + . reduce 46 (src line 170) + + optop goto 339 + +state 330 + for: FOR name '=' expr TO expr DOSTR. (35) + + . reduce 35 (src line 148) + + +state 331 + exprlist: exprlist ',' expr. (99) + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . reduce 99 (src line 250) + + +state 332 + position: position '+' '(' expr ',' expr ')'. (105) + + . reduce 105 (src line 259) + + +state 333 + position: position '-' '(' expr ',' expr ')'. (106) + + . reduce 106 (src line 260) + + +state 334 + for: FOR name FROM expr TO expr BY optop.expr DOSTR + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 340 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 335 + optop: '+'. (42) + + . reduce 42 (src line 165) + + +state 336 + optop: '-'. (43) + + . reduce 43 (src line 167) + + +state 337 + optop: '*'. (44) + + . reduce 44 (src line 168) + + +state 338 + optop: '/'. (45) + + . reduce 45 (src line 169) + + +state 339 + for: FOR name '=' expr TO expr BY optop.expr DOSTR + + PLACENAME shift 52 + VARNAME shift 46 + CORNER shift 66 + HERE shift 67 + LAST shift 69 + NTH shift 54 + NUMBER shift 45 + LOG shift 56 + EXP shift 57 + SIN shift 58 + COS shift 59 + ATAN2 shift 60 + SQRT shift 61 + RAND shift 62 + MIN shift 64 + MAX shift 63 + INT shift 65 + '+' shift 49 + '-' shift 48 + NOT shift 55 + '(' shift 94 + . error + + expr goto 341 + asgn goto 47 + place goto 95 + blockname goto 68 + last goto 53 + +state 340 + for: FOR name FROM expr TO expr BY optop expr.DOSTR + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + DOSTR shift 342 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . error + + +state 341 + for: FOR name '=' expr TO expr BY optop expr.DOSTR + expr: expr.'+' expr + expr: expr.'-' expr + expr: expr.'*' expr + expr: expr.'/' expr + expr: expr.'%' expr + expr: expr.GT expr + expr: expr.LT expr + expr: expr.LE expr + expr: expr.GE expr + expr: expr.EQ expr + expr: expr.NEQ expr + expr: expr.ANDAND expr + expr: expr.OROR expr + expr: expr.'^' expr + + DOSTR shift 343 + OROR shift 121 + ANDAND shift 120 + GT shift 115 + LT shift 197 + LE shift 116 + GE shift 117 + EQ shift 118 + NEQ shift 119 + '+' shift 110 + '-' shift 111 + '*' shift 112 + '/' shift 113 + '%' shift 114 + '^' shift 122 + . error + + +state 342 + for: FOR name FROM expr TO expr BY optop expr DOSTR. (32) + + . reduce 32 (src line 141) + + +state 343 + for: FOR name '=' expr TO expr BY optop expr DOSTR. (34) + + . reduce 34 (src line 146) + + +117 terminals, 30 nonterminals +178 grammar rules, 344/8000 states +208 shift/reduce, 0 reduce/reduce conflicts reported +129 working sets used +memory: parser 785/120000 +323 extra closures +2895 shift entries, 49 exceptions +175 goto entries +398 entries saved by goto default +Optimizer space used: output 1654/120000 +1654 table entries, 501 zero +maximum spread: 117, maximum offset: 339 diff --git a/rest/collection.go b/rest/collection.go old mode 100644 new mode 100755 index 4b5f079..d8bd7cc --- a/rest/collection.go +++ b/rest/collection.go @@ -7,7 +7,7 @@ import ( "strconv" "strings" - jch_http "github.com/jchenry/jchenry/http" + _http "github.com/jchenry/jchenry/http" ) const ( @@ -48,7 +48,7 @@ func Collection(entityPtr interface{}, service CollectionStore) *CollectionInsta } } -func (collection *CollectionInstance) Register(uriBase string, restServer *jch_http.Server) { +func (collection *CollectionInstance) Register(uriBase string, restServer *_http.Server) { plural := properPlural(collection.name) urlBase := uriBase + "/" + plural //collection.name + "s" @@ -73,77 +73,77 @@ func properPlural(word string) string { func (collection *CollectionInstance) create(response http.ResponseWriter, request *http.Request) { entityPtr := reflect.New(collection.instanceType).Interface() //collection.instanceProviderPtr.NewInstance() - err := jch_http.ReadEntity(request, entityPtr) + err := _http.ReadEntity(request, entityPtr) if err != nil { - jch_http.WriteErrorResponse(response, http.StatusBadRequest, err.Error()) + _http.WriteErrorResponse(response, http.StatusBadRequest, err.Error()) return } err = collection.service.Create(entityPtr) if err != nil { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) + _http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) return } response.WriteHeader(http.StatusCreated) - jch_http.WriteEntity(response, entityPtr) + _http.WriteEntity(response, entityPtr) } func (collection *CollectionInstance) update(response http.ResponseWriter, request *http.Request) { entityPtr := reflect.New(collection.instanceType).Interface() //collection.instanceProviderPtr.NewInstance() - err := jch_http.ReadEntity(request, entityPtr) + err := _http.ReadEntity(request, entityPtr) if err != nil { - jch_http.WriteErrorResponse(response, http.StatusBadRequest, err.Error()) + _http.WriteErrorResponse(response, http.StatusBadRequest, err.Error()) return } id := request.Form.Get(IDPathParameter) err = collection.service.Find(&[]interface{}{}, map[string]interface{}{IDPathParameter: id}) if err != nil { - if err == jch_http.ErrNotFound { - jch_http.WriteErrorResponse(response, http.StatusNotFound, fmt.Sprintf("%v with id %v not found", collection.name, id)) + if err == _http.ErrNotFound { + _http.WriteErrorResponse(response, http.StatusNotFound, fmt.Sprintf("%v with id %v not found", collection.name, id)) } else { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) + _http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) } return } err = collection.service.Update(entityPtr) if err != nil { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) + _http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) return } response.WriteHeader(http.StatusOK) - jch_http.WriteEntity(response, entityPtr) + _http.WriteEntity(response, entityPtr) } func (collection *CollectionInstance) remove(response http.ResponseWriter, request *http.Request) { id := request.Form.Get(IDPathParameter) err := collection.service.Find(&[]interface{}{}, map[string]interface{}{IDPathParameter: id}) if err != nil { - if err == jch_http.ErrNotFound { - jch_http.WriteErrorResponse(response, http.StatusNotFound, fmt.Sprintf("%v with id %v not found", collection.name, id)) + if err == _http.ErrNotFound { + _http.WriteErrorResponse(response, http.StatusNotFound, fmt.Sprintf("%v with id %v not found", collection.name, id)) } else { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) + _http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) } return } entityPtr := reflect.New(collection.instanceType).Interface() //collection.instanceProviderPtr.NewInstance() field := reflect.Indirect(reflect.ValueOf(entityPtr)).FieldByName(strings.ToUpper(IDPathParameter)) if !field.CanSet() { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, "entity does not have "+IDPathParameter+" field or field is not setable") + _http.WriteErrorResponse(response, http.StatusInternalServerError, "entity does not have "+IDPathParameter+" field or field is not setable") } parsedID, err := strconv.ParseInt(id, 0, 64) if err != nil { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) + _http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) } field.SetInt(parsedID) err = collection.service.Delete(entityPtr) if err != nil { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) + _http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) return } @@ -157,10 +157,10 @@ func (collection *CollectionInstance) find(response http.ResponseWriter, request err := collection.service.Find(arri, valuesToMap(request.URL.Query(), id)) if err != nil { - if err == jch_http.ErrNotFound { - jch_http.WriteErrorResponse(response, http.StatusNotFound, fmt.Sprintf("%v with id %v not found", collection.name, id)) + if err == _http.ErrNotFound { + _http.WriteErrorResponse(response, http.StatusNotFound, fmt.Sprintf("%v with id %v not found", collection.name, id)) } else { - jch_http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) + _http.WriteErrorResponse(response, http.StatusInternalServerError, err.Error()) } return } @@ -183,7 +183,7 @@ func (collection *CollectionInstance) find(response http.ResponseWriter, request } response.WriteHeader(http.StatusOK) - jch_http.WriteEntity(response, results) + _http.WriteEntity(response, results) } func valuesToMap(params map[string][]string, id string) map[string]interface{} { diff --git a/rest/collection_test.go b/rest/collection_test.go old mode 100644 new mode 100755 diff --git a/rest/resultset_response.go b/rest/resultset_response.go old mode 100644 new mode 100755 diff --git a/tablatal/doc.go b/tablatal/doc.go new file mode 100755 index 0000000..060ffef --- /dev/null +++ b/tablatal/doc.go @@ -0,0 +1 @@ +package tabatal diff --git a/tablatal/tabatal.go b/tablatal/tabatal.go new file mode 100755 index 0000000..5ce2f69 --- /dev/null +++ b/tablatal/tabatal.go @@ -0,0 +1,34 @@ +package tabatal + +import ( + "encoding/csv" + "io" + "strings" +) + +func Parse(data string) (a []map[string]interface{}, err error) { + // a := []map[string]interface{}{} + r := csv.NewReader(strings.NewReader(data)) + r.Comma = '\t' + r.Comment = ';' + var header []string + for i := 0; ; i++ { + row, err := r.Read() + if err == io.EOF { + break + } else if err != nil { + return a, err + } + if i == 0 { + header = row + continue + } + + record := map[string]interface{}{} + for i, h := range header { + record[h] = row[i] + } + a = append(a, record) + } + return a, nil +}