A Nix language compiler into Delta Interaction Nets

init

oeiuwq.com 8e9f3f40

+9420
+15
.github/FUNDING.yml
···
··· 1 + # These are supported funding model platforms 2 + 3 + github: [vic] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 + patreon: # Replace with a single Patreon username 5 + open_collective: # Replace with a single Open Collective username 6 + ko_fi: oeiuwq # Replace with a single Ko-fi username 7 + tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 + community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 + liberapay: # Replace with a single Liberapay username 10 + issuehunt: # Replace with a single IssueHunt username 11 + lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 12 + polar: # Replace with a single Polar username 13 + buy_me_a_coffee: # Replace with a single Buy Me a Coffee username 14 + thanks_dev: # Replace with a single thanks.dev username 15 + custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+39
.github/workflows/go.yml
···
··· 1 + name: Build & Test 2 + 3 + on: 4 + push: 5 + branches: [ "main" ] 6 + pull_request: 7 + branches: [ "main" ] 8 + 9 + jobs: 10 + 11 + test: 12 + runs-on: ubuntu-latest 13 + steps: 14 + - uses: actions/checkout@v4 15 + 16 + - name: Set up Go 17 + uses: actions/setup-go@v5 18 + with: 19 + go-version: '1.25' 20 + 21 + - name: Test 22 + run: go test -v ./... 23 + 24 + lint: 25 + runs-on: ubuntu-latest 26 + steps: 27 + - uses: actions/checkout@v4 28 + 29 + - name: Set up Go 30 + uses: actions/setup-go@v5 31 + with: 32 + go-version: '1.25' 33 + 34 + - name: Check if `go fmt` and `go mod tidy` make any changes 35 + run: | 36 + set -x 37 + go fmt ./... 38 + go mod tidy 39 + git diff --exit-code
+12
.tangled/workflows/mirror.yml
···
··· 1 + when: 2 + - event: ["push"] 3 + branch: ["*"] 4 + engine: "nixery" 5 + clone: 6 + skip: true 7 + dependencies: 8 + nixpkgs: 9 + - gh 10 + steps: 11 + - name: mirror 12 + command: gh -R vic/vic issue comment 3 -b godnix
+201
LICENSE
···
··· 1 + Apache License 2 + Version 2.0, January 2004 3 + http://www.apache.org/licenses/ 4 + 5 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 + 7 + 1. Definitions. 8 + 9 + "License" shall mean the terms and conditions for use, reproduction, 10 + and distribution as defined by Sections 1 through 9 of this document. 11 + 12 + "Licensor" shall mean the copyright owner or entity authorized by 13 + the copyright owner that is granting the License. 14 + 15 + "Legal Entity" shall mean the union of the acting entity and all 16 + other entities that control, are controlled by, or are under common 17 + control with that entity. For the purposes of this definition, 18 + "control" means (i) the power, direct or indirect, to cause the 19 + direction or management of such entity, whether by contract or 20 + otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 + outstanding shares, or (iii) beneficial ownership of such entity. 22 + 23 + "You" (or "Your") shall mean an individual or Legal Entity 24 + exercising permissions granted by this License. 25 + 26 + "Source" form shall mean the preferred form for making modifications, 27 + including but not limited to software source code, documentation 28 + source, and configuration files. 29 + 30 + "Object" form shall mean any form resulting from mechanical 31 + transformation or translation of a Source form, including but 32 + not limited to compiled object code, generated documentation, 33 + and conversions to other media types. 34 + 35 + "Work" shall mean the work of authorship, whether in Source or 36 + Object form, made available under the License, as indicated by a 37 + copyright notice that is included in or attached to the work 38 + (an example is provided in the Appendix below). 39 + 40 + "Derivative Works" shall mean any work, whether in Source or Object 41 + form, that is based on (or derived from) the Work and for which the 42 + editorial revisions, annotations, elaborations, or other modifications 43 + represent, as a whole, an original work of authorship. For the purposes 44 + of this License, Derivative Works shall not include works that remain 45 + separable from, or merely link (or bind by name) to the interfaces of, 46 + the Work and Derivative Works thereof. 47 + 48 + "Contribution" shall mean any work of authorship, including 49 + the original version of the Work and any modifications or additions 50 + to that Work or Derivative Works thereof, that is intentionally 51 + submitted to Licensor for inclusion in the Work by the copyright owner 52 + or by an individual or Legal Entity authorized to submit on behalf of 53 + the copyright owner. For the purposes of this definition, "submitted" 54 + means any form of electronic, verbal, or written communication sent 55 + to the Licensor or its representatives, including but not limited to 56 + communication on electronic mailing lists, source code control systems, 57 + and issue tracking systems that are managed by, or on behalf of, the 58 + Licensor for the purpose of discussing and improving the Work, but 59 + excluding communication that is conspicuously marked or otherwise 60 + designated in writing by the copyright owner as "Not a Contribution." 61 + 62 + "Contributor" shall mean Licensor and any individual or Legal Entity 63 + on behalf of whom a Contribution has been received by Licensor and 64 + subsequently incorporated within the Work. 65 + 66 + 2. Grant of Copyright License. Subject to the terms and conditions of 67 + this License, each Contributor hereby grants to You a perpetual, 68 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 + copyright license to reproduce, prepare Derivative Works of, 70 + publicly display, publicly perform, sublicense, and distribute the 71 + Work and such Derivative Works in Source or Object form. 72 + 73 + 3. Grant of Patent License. Subject to the terms and conditions of 74 + this License, each Contributor hereby grants to You a perpetual, 75 + worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 + (except as stated in this section) patent license to make, have made, 77 + use, offer to sell, sell, import, and otherwise transfer the Work, 78 + where such license applies only to those patent claims licensable 79 + by such Contributor that are necessarily infringed by their 80 + Contribution(s) alone or by combination of their Contribution(s) 81 + with the Work to which such Contribution(s) was submitted. If You 82 + institute patent litigation against any entity (including a 83 + cross-claim or counterclaim in a lawsuit) alleging that the Work 84 + or a Contribution incorporated within the Work constitutes direct 85 + or contributory patent infringement, then any patent licenses 86 + granted to You under this License for that Work shall terminate 87 + as of the date such litigation is filed. 88 + 89 + 4. Redistribution. You may reproduce and distribute copies of the 90 + Work or Derivative Works thereof in any medium, with or without 91 + modifications, and in Source or Object form, provided that You 92 + meet the following conditions: 93 + 94 + (a) You must give any other recipients of the Work or 95 + Derivative Works a copy of this License; and 96 + 97 + (b) You must cause any modified files to carry prominent notices 98 + stating that You changed the files; and 99 + 100 + (c) You must retain, in the Source form of any Derivative Works 101 + that You distribute, all copyright, patent, trademark, and 102 + attribution notices from the Source form of the Work, 103 + excluding those notices that do not pertain to any part of 104 + the Derivative Works; and 105 + 106 + (d) If the Work includes a "NOTICE" text file as part of its 107 + distribution, then any Derivative Works that You distribute must 108 + include a readable copy of the attribution notices contained 109 + within such NOTICE file, excluding those notices that do not 110 + pertain to any part of the Derivative Works, in at least one 111 + of the following places: within a NOTICE text file distributed 112 + as part of the Derivative Works; within the Source form or 113 + documentation, if provided along with the Derivative Works; or, 114 + within a display generated by the Derivative Works, if and 115 + wherever such third-party notices normally appear. The contents 116 + of the NOTICE file are for informational purposes only and 117 + do not modify the License. You may add Your own attribution 118 + notices within Derivative Works that You distribute, alongside 119 + or as an addendum to the NOTICE text from the Work, provided 120 + that such additional attribution notices cannot be construed 121 + as modifying the License. 122 + 123 + You may add Your own copyright statement to Your modifications and 124 + may provide additional or different license terms and conditions 125 + for use, reproduction, or distribution of Your modifications, or 126 + for any such Derivative Works as a whole, provided Your use, 127 + reproduction, and distribution of the Work otherwise complies with 128 + the conditions stated in this License. 129 + 130 + 5. Submission of Contributions. Unless You explicitly state otherwise, 131 + any Contribution intentionally submitted for inclusion in the Work 132 + by You to the Licensor shall be under the terms and conditions of 133 + this License, without any additional terms or conditions. 134 + Notwithstanding the above, nothing herein shall supersede or modify 135 + the terms of any separate license agreement you may have executed 136 + with Licensor regarding such Contributions. 137 + 138 + 6. Trademarks. This License does not grant permission to use the trade 139 + names, trademarks, service marks, or product names of the Licensor, 140 + except as required for reasonable and customary use in describing the 141 + origin of the Work and reproducing the content of the NOTICE file. 142 + 143 + 7. Disclaimer of Warranty. Unless required by applicable law or 144 + agreed to in writing, Licensor provides the Work (and each 145 + Contributor provides its Contributions) on an "AS IS" BASIS, 146 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 + implied, including, without limitation, any warranties or conditions 148 + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 + PARTICULAR PURPOSE. You are solely responsible for determining the 150 + appropriateness of using or redistributing the Work and assume any 151 + risks associated with Your exercise of permissions under this License. 152 + 153 + 8. Limitation of Liability. In no event and under no legal theory, 154 + whether in tort (including negligence), contract, or otherwise, 155 + unless required by applicable law (such as deliberate and grossly 156 + negligent acts) or agreed to in writing, shall any Contributor be 157 + liable to You for damages, including any direct, indirect, special, 158 + incidental, or consequential damages of any character arising as a 159 + result of this License or out of the use or inability to use the 160 + Work (including but not limited to damages for loss of goodwill, 161 + work stoppage, computer failure or malfunction, or any and all 162 + other commercial damages or losses), even if such Contributor 163 + has been advised of the possibility of such damages. 164 + 165 + 9. Accepting Warranty or Additional Liability. While redistributing 166 + the Work or Derivative Works thereof, You may choose to offer, 167 + and charge a fee for, acceptance of support, warranty, indemnity, 168 + or other liability obligations and/or rights consistent with this 169 + License. However, in accepting such obligations, You may act only 170 + on Your own behalf and on Your sole responsibility, not on behalf 171 + of any other Contributor, and only if You agree to indemnify, 172 + defend, and hold each Contributor harmless for any liability 173 + incurred by, or claims asserted against, such Contributor by reason 174 + of your accepting any such warranty or additional liability. 175 + 176 + END OF TERMS AND CONDITIONS 177 + 178 + APPENDIX: How to apply the Apache License to your work. 179 + 180 + To apply the Apache License to your work, attach the following 181 + boilerplate notice, with the fields enclosed by brackets "[]" 182 + replaced with your own identifying information. (Don't include 183 + the brackets!) The text should be enclosed in the appropriate 184 + comment syntax for the file format. We also recommend that a 185 + file or class name and description of purpose be included on the 186 + same "printed page" as the copyright notice for easier 187 + identification within third-party archives. 188 + 189 + Copyright [yyyy] [name of copyright owner] 190 + 191 + Licensed under the Apache License, Version 2.0 (the "License"); 192 + you may not use this file except in compliance with the License. 193 + You may obtain a copy of the License at 194 + 195 + http://www.apache.org/licenses/LICENSE-2.0 196 + 197 + Unless required by applicable law or agreed to in writing, software 198 + distributed under the License is distributed on an "AS IS" BASIS, 199 + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 + See the License for the specific language governing permissions and 201 + limitations under the License.
+177
README.md
···
··· 1 + # Godnix - Nix to Lambda Calculus Compiler 2 + 3 + > **_Go_** D-_Nix_ -- A Nix compiler into Delta Interaction Nets. 4 + 5 + Godnix is a compiler that translates Nix expressions to Lambda calculus and evaluates them using the [godnet](https://github.com/vic/godnet) interaction net reduction engine. 6 + 7 + ## Features 8 + 9 + This first version supports: 10 + - **Integers**: Church numeral encoding 11 + - **Anonymous functions**: `x: body` syntax 12 + - **Function application**: Direct application of functions to arguments 13 + - **Let bindings**: `let x = value; in body` expressions 14 + - **Addition operator**: Pure Church numeral addition (`+`) 15 + 16 + ## Building 17 + 18 + ```bash 19 + go build -o godnix ./cmd/godnix 20 + ``` 21 + 22 + ## Testing 23 + 24 + Run the integration tests: 25 + 26 + ```bash 27 + go test ./cmd/godnix/ 28 + ``` 29 + 30 + For verbose output: 31 + 32 + ```bash 33 + go test -v ./cmd/godnix/ 34 + ``` 35 + 36 + The test suite includes: 37 + - Examples from `examples/` directory 38 + - Inline expression tests 39 + - Church numeral encoding/decoding 40 + - Error handling for unsupported features 41 + - Direct translator unit tests 42 + 43 + ## Usage 44 + 45 + ```bash 46 + ./godnix <file.nix> 47 + ``` 48 + 49 + ## Examples 50 + 51 + ### Simple Integer 52 + ```nix 53 + # examples/simple.nix 54 + 42 55 + ``` 56 + 57 + Output: 58 + ``` 59 + 42 60 + ``` 61 + 62 + ### Addition 63 + ```nix 64 + # examples/add.nix 65 + 2 + 3 66 + ``` 67 + 68 + Output: 69 + ``` 70 + 5 71 + ``` 72 + 73 + ### Identity Function 74 + ```nix 75 + # examples/identity.nix 76 + (x: x) 7 77 + ``` 78 + 79 + Output: 80 + ``` 81 + 7 82 + ``` 83 + 84 + ### Let Binding 85 + ```nix 86 + # examples/let.nix 87 + let 88 + x = 5; 89 + y = 3; 90 + in 91 + x + y 92 + ``` 93 + 94 + Output: 95 + ``` 96 + 8 97 + ``` 98 + 99 + ### Lambda Functions 100 + ```nix 101 + # examples/lambda.nix 102 + let 103 + add = x: y: x + y; 104 + in 105 + add 4 6 106 + ``` 107 + 108 + Output: 109 + ``` 110 + 10 111 + ``` 112 + 113 + ## Architecture 114 + 115 + ### Components 116 + 117 + 1. **Parser** (`pkg/parser/`): Full-featured Nix parser (already present) 118 + 2. **Translator** (`pkg/compiler/translator.go`): Converts Nix AST to Lambda calculus terms 119 + 3. **Compiler** (`cmd/godnix/`): Main application that coordinates parsing, translation, and evaluation 120 + 121 + ### Translation Strategy 122 + 123 + Godnix translates Nix expressions to pure Lambda calculus: 124 + 125 + - **Integers** → Church numerals: `n = λf. λx. f^n x` 126 + - **Addition** → Church numeral addition: `λm. λn. λf. λx. m f (n f x)` 127 + - **Functions** → Lambda abstractions: `x: body` → `λx. body` 128 + - **Let bindings** → Function application: `let x = v in b` → `(λx. b) v` 129 + - **Application** → Standard application: `f x` → Lambda application 130 + 131 + ### Evaluation 132 + 133 + The compiled Lambda terms are evaluated using the godnet deltanet reduction engine, which implements optimal reduction through interaction nets. This provides: 134 + 135 + - Parallel reduction opportunities 136 + - Optimal sharing of computations 137 + - Efficient memory usage 138 + 139 + ## Performance 140 + 141 + The evaluator provides statistics after each run: 142 + - Execution time 143 + - Total reductions performed 144 + - Reductions per second 145 + 146 + Example output: 147 + ``` 148 + Stats: 149 + Time: 337.889µs 150 + Total Reductions: 60 (177573.11 ops/sec) 151 + ``` 152 + 153 + ## Limitations (v1) 154 + 155 + This first version has intentional limitations: 156 + - Only integers (no floats, strings, lists, sets) 157 + - Only `+` operator (no other arithmetic or comparison) 158 + - No built-in functions beyond `+` 159 + - No attribute sets or recursive bindings 160 + - No imports or file system operations 161 + 162 + These limitations allow focusing on the core compilation pipeline. The full Nix parser is available, so adding support for more features is straightforward. 163 + 164 + ## Future Directions 165 + 166 + Potential additions for future versions: 167 + - More arithmetic operators (`-`, `*`, `/`) 168 + - Boolean operations and conditionals 169 + - Lists and list operations 170 + - Attribute sets 171 + - Built-in functions (map, filter, fold) 172 + - String operations 173 + - Native functions for performance-critical operations 174 + 175 + ## License 176 + 177 + See LICENSE file.
+137
cmd/godnix/main.go
···
··· 1 + package main 2 + 3 + import ( 4 + "fmt" 5 + "os" 6 + "time" 7 + 8 + "github.com/vic/godnet/pkg/deltanet" 9 + "github.com/vic/godnet/pkg/lambda" 10 + "github.com/vic/godnix/pkg/compiler" 11 + "github.com/vic/godnix/pkg/parser" 12 + ) 13 + 14 + func main() { 15 + if len(os.Args) < 2 { 16 + fmt.Fprintf(os.Stderr, "Usage: %s <file.nix> [output]\n", os.Args[0]) 17 + os.Exit(1) 18 + } 19 + 20 + nixFile := os.Args[1] 21 + outputName := "" 22 + if len(os.Args) > 2 { 23 + outputName = os.Args[2] 24 + } 25 + 26 + if err := compileAndRun(nixFile, outputName); err != nil { 27 + fmt.Fprintf(os.Stderr, "Error: %v\n", err) 28 + os.Exit(1) 29 + } 30 + } 31 + 32 + func compileAndRun(nixFile, outputName string) error { 33 + // Parse Nix file 34 + fmt.Fprintf(os.Stderr, "Parsing %s...\n", nixFile) 35 + p, err := parser.ParseFile(nixFile) 36 + if err != nil { 37 + return fmt.Errorf("parse error: %w", err) 38 + } 39 + 40 + // Translate to Lambda calculus 41 + fmt.Fprintf(os.Stderr, "Translating to Lambda calculus...\n") 42 + translator := compiler.NewTranslator(p) 43 + term, err := translator.Translate() 44 + if err != nil { 45 + return fmt.Errorf("translation error: %w", err) 46 + } 47 + 48 + fmt.Fprintf(os.Stderr, "Lambda term: %s\n\n", term) 49 + 50 + // Evaluate directly using deltanet 51 + fmt.Fprintf(os.Stderr, "Evaluating...\n") 52 + fmt.Fprintf(os.Stderr, "=================================\n") 53 + return evaluateDirect(term) 54 + } 55 + 56 + func evaluateDirect(term lambda.Term) error { 57 + // Create network 58 + net := deltanet.NewNetwork() 59 + 60 + // Translate lambda term to deltanet 61 + rootNode, rootPort, varNames := lambda.ToDeltaNet(term, net) 62 + 63 + // Connect to output 64 + output := net.NewVar() 65 + net.Link(rootNode, rootPort, output, 0) 66 + 67 + // Reduce 68 + start := time.Now() 69 + net.ReduceAll() 70 + elapsed := time.Since(start) 71 + 72 + // Get result 73 + resultNode, resultPort := net.GetLink(output, 0) 74 + result := lambda.FromDeltaNet(net, resultNode, resultPort, varNames) 75 + 76 + // Try to decode as Church numeral 77 + if num, ok := decodeChurchNumeral(result); ok { 78 + fmt.Printf("%d\n", num) 79 + } else { 80 + fmt.Printf("%s\n", result) 81 + } 82 + 83 + // Print stats 84 + stats := net.GetStats() 85 + seconds := elapsed.Seconds() 86 + fmt.Fprintf(os.Stderr, "\nStats:\n") 87 + fmt.Fprintf(os.Stderr, "Time: %v\n", elapsed) 88 + fmt.Fprintf(os.Stderr, "Total Reductions: %d", stats.TotalReductions) 89 + if seconds > 0 { 90 + fmt.Fprintf(os.Stderr, " (%.2f ops/sec)", float64(stats.TotalReductions)/seconds) 91 + } 92 + fmt.Fprintf(os.Stderr, "\n") 93 + 94 + return nil 95 + } 96 + 97 + // decodeChurchNumeral attempts to decode a lambda term as a Church numeral 98 + // Church numeral: λf. λx. f (f (... (f x) ...)) 99 + func decodeChurchNumeral(term lambda.Term) (int, bool) { 100 + // Must be: λf. λx. body 101 + abs1, ok := term.(lambda.Abs) 102 + if !ok { 103 + return 0, false 104 + } 105 + 106 + abs2, ok := abs1.Body.(lambda.Abs) 107 + if !ok { 108 + return 0, false 109 + } 110 + 111 + // Count applications of f to x 112 + count := 0 113 + current := abs2.Body 114 + 115 + for { 116 + app, ok := current.(lambda.App) 117 + if !ok { 118 + break 119 + } 120 + 121 + // Check if function is the f variable 122 + funVar, ok := app.Fun.(lambda.Var) 123 + if !ok || funVar.Name != abs1.Arg { 124 + return 0, false 125 + } 126 + 127 + count++ 128 + current = app.Arg 129 + } 130 + 131 + // Final term should be x 132 + if varX, ok := current.(lambda.Var); ok && varX.Name == abs2.Arg { 133 + return count, true 134 + } 135 + 136 + return 0, false 137 + }
+352
cmd/godnix/main_test.go
···
··· 1 + package main 2 + 3 + import ( 4 + "os" 5 + "testing" 6 + 7 + "github.com/vic/godnet/pkg/deltanet" 8 + "github.com/vic/godnet/pkg/lambda" 9 + "github.com/vic/godnix/pkg/compiler" 10 + "github.com/vic/godnix/pkg/parser" 11 + ) 12 + 13 + func TestSimpleInteger(t *testing.T) { 14 + result, err := compileAndEvaluate("../../examples/simple.nix") 15 + if err != nil { 16 + t.Fatalf("Failed to compile and evaluate: %v", err) 17 + } 18 + if result != 42 { 19 + t.Errorf("Expected 42, got %d", result) 20 + } 21 + } 22 + 23 + func TestAddition(t *testing.T) { 24 + result, err := compileAndEvaluate("../../examples/add.nix") 25 + if err != nil { 26 + t.Fatalf("Failed to compile and evaluate: %v", err) 27 + } 28 + if result != 5 { 29 + t.Errorf("Expected 5, got %d", result) 30 + } 31 + } 32 + 33 + func TestIdentityFunction(t *testing.T) { 34 + result, err := compileAndEvaluate("../../examples/identity.nix") 35 + if err != nil { 36 + t.Fatalf("Failed to compile and evaluate: %v", err) 37 + } 38 + if result != 7 { 39 + t.Errorf("Expected 7, got %d", result) 40 + } 41 + } 42 + 43 + func TestLetBinding(t *testing.T) { 44 + result, err := compileAndEvaluate("../../examples/let.nix") 45 + if err != nil { 46 + t.Fatalf("Failed to compile and evaluate: %v", err) 47 + } 48 + if result != 8 { 49 + t.Errorf("Expected 8, got %d", result) 50 + } 51 + } 52 + 53 + func TestLambdaFunction(t *testing.T) { 54 + result, err := compileAndEvaluate("../../examples/lambda.nix") 55 + if err != nil { 56 + t.Fatalf("Failed to compile and evaluate: %v", err) 57 + } 58 + if result != 10 { 59 + t.Errorf("Expected 10, got %d", result) 60 + } 61 + } 62 + 63 + func TestInlineExpressions(t *testing.T) { 64 + tests := []struct { 65 + name string 66 + expr string 67 + expected int 68 + }{ 69 + {"zero", "0", 0}, 70 + {"one", "1", 1}, 71 + {"simple_add", "1 + 2", 3}, 72 + {"multi_add", "1 + 2 + 3", 6}, 73 + {"identity_zero", "(x: x) 0", 0}, 74 + {"const_combinator", "(x: y: x) 5 3", 5}, 75 + {"nested_let", "let a = 1; b = 2; c = 3; in a + b + c", 6}, 76 + } 77 + 78 + for _, tt := range tests { 79 + t.Run(tt.name, func(t *testing.T) { 80 + result, err := compileAndEvaluateString(tt.expr) 81 + if err != nil { 82 + t.Fatalf("Failed to compile and evaluate: %v", err) 83 + } 84 + if result != tt.expected { 85 + t.Errorf("Expected %d, got %d", tt.expected, result) 86 + } 87 + }) 88 + } 89 + } 90 + 91 + func TestParseErrors(t *testing.T) { 92 + tests := []struct { 93 + name string 94 + expr string 95 + }{ 96 + {"unclosed_paren", "(x: x"}, 97 + {"invalid_syntax", "let in"}, 98 + } 99 + 100 + for _, tt := range tests { 101 + t.Run(tt.name, func(t *testing.T) { 102 + _, err := compileAndEvaluateString(tt.expr) 103 + if err == nil { 104 + t.Error("Expected error for invalid expression, got nil") 105 + } 106 + }) 107 + } 108 + } 109 + 110 + func TestUnsupportedFeatures(t *testing.T) { 111 + tests := []struct { 112 + name string 113 + expr string 114 + }{ 115 + {"string", `"hello"`}, 116 + {"list", "[1 2 3]"}, 117 + {"set", "{a = 1;}"}, 118 + {"subtraction", "5 - 3"}, 119 + {"multiplication", "2 * 3"}, 120 + } 121 + 122 + for _, tt := range tests { 123 + t.Run(tt.name, func(t *testing.T) { 124 + _, err := compileAndEvaluateString(tt.expr) 125 + if err == nil { 126 + t.Errorf("Expected error for unsupported feature, got nil") 127 + } 128 + }) 129 + } 130 + } 131 + 132 + // Helper functions 133 + 134 + func compileAndEvaluate(nixFile string) (int, error) { 135 + // Parse Nix file 136 + p, err := parser.ParseFile(nixFile) 137 + if err != nil { 138 + return 0, err 139 + } 140 + 141 + // Translate to Lambda calculus 142 + translator := compiler.NewTranslator(p) 143 + term, err := translator.Translate() 144 + if err != nil { 145 + return 0, err 146 + } 147 + 148 + // Evaluate 149 + return evaluate(term) 150 + } 151 + 152 + func compileAndEvaluateString(nixExpr string) (int, error) { 153 + // Parse Nix string 154 + p, err := parser.ParseString(nixExpr) 155 + if err != nil { 156 + return 0, err 157 + } 158 + 159 + // Translate to Lambda calculus 160 + translator := compiler.NewTranslator(p) 161 + term, err := translator.Translate() 162 + if err != nil { 163 + return 0, err 164 + } 165 + 166 + // Evaluate 167 + return evaluate(term) 168 + } 169 + 170 + func evaluate(term lambda.Term) (int, error) { 171 + // Create network 172 + net := deltanet.NewNetwork() 173 + 174 + // Translate lambda term to deltanet 175 + rootNode, rootPort, varNames := lambda.ToDeltaNet(term, net) 176 + 177 + // Connect to output 178 + output := net.NewVar() 179 + net.Link(rootNode, rootPort, output, 0) 180 + 181 + // Reduce 182 + net.ReduceAll() 183 + 184 + // Get result 185 + resultNode, resultPort := net.GetLink(output, 0) 186 + result := lambda.FromDeltaNet(net, resultNode, resultPort, varNames) 187 + 188 + // Try to decode as Church numeral 189 + if num, ok := decodeChurchNumeral(result); ok { 190 + return num, nil 191 + } 192 + 193 + return 0, nil 194 + } 195 + 196 + // TestCompilerPackage tests the compiler package directly 197 + func TestTranslatorIntNode(t *testing.T) { 198 + p, err := parser.ParseString("123") 199 + if err != nil { 200 + t.Fatalf("Parse error: %v", err) 201 + } 202 + 203 + translator := compiler.NewTranslator(p) 204 + term, err := translator.Translate() 205 + if err != nil { 206 + t.Fatalf("Translation error: %v", err) 207 + } 208 + 209 + result, err := evaluate(term) 210 + if err != nil { 211 + t.Fatalf("Evaluation error: %v", err) 212 + } 213 + 214 + if result != 123 { 215 + t.Errorf("Expected 123, got %d", result) 216 + } 217 + } 218 + 219 + func TestTranslatorFunction(t *testing.T) { 220 + p, err := parser.ParseString("x: x") 221 + if err != nil { 222 + t.Fatalf("Parse error: %v", err) 223 + } 224 + 225 + translator := compiler.NewTranslator(p) 226 + term, err := translator.Translate() 227 + if err != nil { 228 + t.Fatalf("Translation error: %v", err) 229 + } 230 + 231 + // Check it's an abstraction 232 + abs, ok := term.(lambda.Abs) 233 + if !ok { 234 + t.Fatalf("Expected Abs, got %T", term) 235 + } 236 + 237 + if abs.Arg != "x" { 238 + t.Errorf("Expected argument 'x', got '%s'", abs.Arg) 239 + } 240 + } 241 + 242 + func TestTranslatorNestedFunctions(t *testing.T) { 243 + p, err := parser.ParseString("x: y: z: x") 244 + if err != nil { 245 + t.Fatalf("Parse error: %v", err) 246 + } 247 + 248 + translator := compiler.NewTranslator(p) 249 + term, err := translator.Translate() 250 + if err != nil { 251 + t.Fatalf("Translation error: %v", err) 252 + } 253 + 254 + // Check it's nested abstractions 255 + abs1, ok := term.(lambda.Abs) 256 + if !ok { 257 + t.Fatalf("Expected first Abs, got %T", term) 258 + } 259 + 260 + abs2, ok := abs1.Body.(lambda.Abs) 261 + if !ok { 262 + t.Fatalf("Expected second Abs, got %T", abs1.Body) 263 + } 264 + 265 + abs3, ok := abs2.Body.(lambda.Abs) 266 + if !ok { 267 + t.Fatalf("Expected third Abs, got %T", abs2.Body) 268 + } 269 + 270 + // Body should be a variable reference to x 271 + varX, ok := abs3.Body.(lambda.Var) 272 + if !ok { 273 + t.Fatalf("Expected Var, got %T", abs3.Body) 274 + } 275 + 276 + if varX.Name != "x" { 277 + t.Errorf("Expected variable 'x', got '%s'", varX.Name) 278 + } 279 + } 280 + 281 + func TestLambdaTermString(t *testing.T) { 282 + tests := []struct { 283 + name string 284 + expr string 285 + }{ 286 + {"simple_var", "x"}, 287 + {"simple_abs", "x: x"}, 288 + {"simple_app", "(x: x) y"}, 289 + {"nested", "x: y: x y"}, 290 + } 291 + 292 + for _, tt := range tests { 293 + t.Run(tt.name, func(t *testing.T) { 294 + p, err := parser.ParseString(tt.expr) 295 + if err != nil { 296 + t.Fatalf("Parse error: %v", err) 297 + } 298 + 299 + translator := compiler.NewTranslator(p) 300 + term, err := translator.Translate() 301 + if err != nil { 302 + t.Fatalf("Translation error: %v", err) 303 + } 304 + 305 + str := term.String() 306 + if str == "" { 307 + t.Error("Expected non-empty string representation") 308 + } 309 + }) 310 + } 311 + } 312 + 313 + func TestChurchNumeralEncoding(t *testing.T) { 314 + // Test that integers are properly encoded and decoded 315 + testCases := []struct { 316 + value int 317 + expr string 318 + }{ 319 + {0, "0"}, 320 + {1, "1"}, 321 + {2, "2"}, 322 + {5, "5"}, 323 + {10, "10"}, 324 + {42, "42"}, 325 + {100, "100"}, 326 + } 327 + 328 + for _, tc := range testCases { 329 + t.Run(tc.expr, func(t *testing.T) { 330 + result, err := compileAndEvaluateString(tc.expr) 331 + if err != nil { 332 + t.Fatalf("Failed to evaluate %s: %v", tc.expr, err) 333 + } 334 + 335 + if result != tc.value { 336 + t.Errorf("Expected %d, got %d", tc.value, result) 337 + } 338 + }) 339 + } 340 + } 341 + 342 + func TestMain(m *testing.M) { 343 + // Ensure examples directory exists before running tests 344 + if _, err := os.Stat("../../examples"); os.IsNotExist(err) { 345 + // Running from different directory, try current 346 + if _, err := os.Stat("examples"); os.IsNotExist(err) { 347 + panic("examples directory not found") 348 + } 349 + } 350 + 351 + os.Exit(m.Run()) 352 + }
+96
cmd/parse-check/main.go
···
··· 1 + package main 2 + 3 + import ( 4 + "flag" 5 + "fmt" 6 + "os" 7 + "path/filepath" 8 + "strings" 9 + "sync" 10 + "time" 11 + 12 + "github.com/vic/godnix/pkg/parser" 13 + ) 14 + 15 + func main() { 16 + parseCmd := flag.NewFlagSet("parse", flag.ExitOnError) 17 + printSexp := parseCmd.Bool("sexp", false, "Print Sexp") 18 + filePath := parseCmd.String("file", "", "Path to the Nix file to parse") 19 + dirPath := parseCmd.String("dir", "", "Path to the directory containing Nix files to parse") 20 + 21 + parseCmd.Parse(os.Args[1:]) 22 + if *filePath != "" { 23 + result, err := parser.ParseFile(*filePath) 24 + if err != nil { 25 + fmt.Printf("Error parsing file: %v\n", err) 26 + os.Exit(1) 27 + } 28 + if *printSexp { 29 + fmt.Printf("%v\n", result.LispResult()) 30 + } 31 + } else if *dirPath != "" { 32 + parseDirectory(*dirPath) 33 + } else { 34 + fmt.Println("Please provide a file path using --file or a directory path using --dir") 35 + os.Exit(1) 36 + } 37 + } 38 + 39 + func parseDirectory(dirPath string) { 40 + start := time.Now() 41 + fmt.Println("Reading .nix files...") 42 + 43 + var nixFiles []string 44 + err := filepath.Walk(dirPath, func(path string, info os.FileInfo, err error) error { 45 + if err != nil { 46 + return err 47 + } 48 + if !info.IsDir() && strings.HasSuffix(info.Name(), ".nix") { 49 + nixFiles = append(nixFiles, path) 50 + } 51 + return nil 52 + }) 53 + 54 + if err != nil { 55 + fmt.Printf("Error walking the path %s: %v\n", dirPath, err) 56 + return 57 + } 58 + 59 + readDuration := time.Since(start) 60 + fmt.Printf("Time taken to find %v .nix files: %v\n", len(nixFiles), readDuration) 61 + 62 + startParsing := time.Now() 63 + var wg sync.WaitGroup 64 + var mu sync.Mutex 65 + parsedCount := 0 66 + failedCount := 0 67 + failedFiles := []string{} 68 + 69 + for _, file := range nixFiles { 70 + wg.Add(1) 71 + go func(file string) { 72 + defer wg.Done() 73 + _, err := parser.ParseFile(file) 74 + mu.Lock() 75 + if err != nil { 76 + failedCount++ 77 + failedFiles = append(failedFiles, file) 78 + } else { 79 + parsedCount++ 80 + } 81 + mu.Unlock() 82 + }(file) 83 + } 84 + 85 + wg.Wait() 86 + parsingDuration := time.Since(startParsing) 87 + fmt.Printf("Parsing completed in %v\n", parsingDuration) 88 + fmt.Printf("Total files parsed: %d\n", parsedCount) 89 + fmt.Printf("Total files failed: %d\n", failedCount) 90 + if failedCount > 0 { 91 + fmt.Println("Failed files:") 92 + for _, file := range failedFiles { 93 + fmt.Println(file) 94 + } 95 + } 96 + }
+2
examples/add.nix
···
··· 1 + # Simple addition 2 + 2 + 3
+2
examples/identity.nix
···
··· 1 + # Identity function applied to a number 2 + (x: x) 7
+5
examples/lambda.nix
···
··· 1 + # Lambda function 2 + let 3 + add = x: y: x + y; 4 + in 5 + add 4 6
+6
examples/let.nix
···
··· 1 + # Let binding 2 + let 3 + x = 5; 4 + y = 3; 5 + in 6 + x + y
+2
examples/simple.nix
···
··· 1 + # Simple integer 2 + 42
+7
go.mod
···
··· 1 + module github.com/vic/godnix 2 + 3 + go 1.25.3 4 + 5 + replace github.com/vic/godnet => ./vic/godnet 6 + 7 + require github.com/vic/godnet v0.0.0-00010101000000-000000000000
go.sum

This is a binary file and will not be displayed.

+283
pkg/compiler/translator.go
···
··· 1 + package compiler 2 + 3 + import ( 4 + "fmt" 5 + "strconv" 6 + 7 + "github.com/vic/godnet/pkg/lambda" 8 + "github.com/vic/godnix/pkg/parser" 9 + ) 10 + 11 + // Translator converts Nix AST to Lambda calculus terms 12 + type Translator struct { 13 + parser *parser.Parser 14 + } 15 + 16 + // NewTranslator creates a new Nix to Lambda translator 17 + func NewTranslator(p *parser.Parser) *Translator { 18 + return &Translator{parser: p} 19 + } 20 + 21 + // Translate converts the parsed Nix AST to a Lambda term 22 + func (t *Translator) Translate() (lambda.Term, error) { 23 + if t.parser.Result == nil { 24 + return nil, fmt.Errorf("no parse result available") 25 + } 26 + return t.translateNode(t.parser.Result) 27 + } 28 + 29 + func (t *Translator) translateNode(n *parser.Node) (lambda.Term, error) { 30 + switch n.Type { 31 + case parser.IntNode: 32 + return t.translateInt(n) 33 + case parser.IDNode: 34 + return t.translateID(n) 35 + case parser.FunctionNode: 36 + return t.translateFunction(n) 37 + case parser.LetNode: 38 + return t.translateLet(n) 39 + case parser.ApplyNode: 40 + return t.translateApply(n) 41 + case parser.ParensNode: 42 + return t.translateParens(n) 43 + default: 44 + if n.Type >= parser.OpNode { 45 + return t.translateOp(n) 46 + } 47 + return nil, fmt.Errorf("unsupported node type: %s", n.Type) 48 + } 49 + } 50 + 51 + func (t *Translator) translateInt(n *parser.Node) (lambda.Term, error) { 52 + if len(n.Tokens) == 0 { 53 + return nil, fmt.Errorf("int node has no tokens") 54 + } 55 + 56 + intStr := t.parser.TokenString(n.Tokens[0]) 57 + val, err := strconv.ParseInt(intStr, 10, 64) 58 + if err != nil { 59 + return nil, fmt.Errorf("invalid integer: %s", intStr) 60 + } 61 + 62 + // Encode integer as Church numeral 63 + return t.encodeChurchNumeral(int(val)), nil 64 + } 65 + 66 + func (t *Translator) translateID(n *parser.Node) (lambda.Term, error) { 67 + if len(n.Tokens) == 0 { 68 + return nil, fmt.Errorf("id node has no tokens") 69 + } 70 + 71 + name := t.parser.TokenString(n.Tokens[0]) 72 + return lambda.Var{Name: name}, nil 73 + } 74 + 75 + func (t *Translator) translateFunction(n *parser.Node) (lambda.Term, error) { 76 + if len(n.Nodes) < 2 { 77 + return nil, fmt.Errorf("function node needs at least 2 child nodes") 78 + } 79 + 80 + // First node is the argument pattern 81 + argNode := n.Nodes[0] 82 + bodyNode := n.Nodes[1] 83 + 84 + var argName string 85 + 86 + // Handle different argument patterns 87 + switch argNode.Type { 88 + case parser.IDNode: 89 + // Direct identifier: x: body 90 + argName = t.parser.TokenString(argNode.Tokens[0]) 91 + 92 + case parser.ArgNode: 93 + // Wrapped in ArgNode 94 + if len(argNode.Nodes) == 0 || argNode.Nodes[0].Type != parser.IDNode { 95 + return nil, fmt.Errorf("function argument must be an identifier") 96 + } 97 + argName = t.parser.TokenString(argNode.Nodes[0].Tokens[0]) 98 + 99 + default: 100 + return nil, fmt.Errorf("unsupported function argument type: %s", argNode.Type) 101 + } 102 + 103 + body, err := t.translateNode(bodyNode) 104 + if err != nil { 105 + return nil, err 106 + } 107 + 108 + return lambda.Abs{Arg: argName, Body: body}, nil 109 + } 110 + 111 + func (t *Translator) translateLet(n *parser.Node) (lambda.Term, error) { 112 + if len(n.Nodes) < 2 { 113 + return nil, fmt.Errorf("let node needs at least 2 child nodes") 114 + } 115 + 116 + // First node is bindings, last node is body 117 + bindsNode := n.Nodes[0] 118 + bodyNode := n.Nodes[len(n.Nodes)-1] 119 + 120 + if bindsNode.Type != parser.BindsNode { 121 + return nil, fmt.Errorf("expected binds node, got %s", bindsNode.Type) 122 + } 123 + 124 + body, err := t.translateNode(bodyNode) 125 + if err != nil { 126 + return nil, err 127 + } 128 + 129 + // Process bindings in reverse order (desugar from inside out) 130 + for i := len(bindsNode.Nodes) - 1; i >= 0; i-- { 131 + bindNode := bindsNode.Nodes[i] 132 + if bindNode.Type != parser.BindNode { 133 + continue 134 + } 135 + 136 + if len(bindNode.Nodes) < 2 { 137 + return nil, fmt.Errorf("bind node needs at least 2 child nodes") 138 + } 139 + 140 + // First child is attrpath (name), second is value 141 + attrPath := bindNode.Nodes[0] 142 + if attrPath.Type != parser.AttrPathNode || len(attrPath.Nodes) == 0 { 143 + return nil, fmt.Errorf("invalid bind attrpath") 144 + } 145 + 146 + nameNode := attrPath.Nodes[0] 147 + if nameNode.Type != parser.IDNode { 148 + return nil, fmt.Errorf("bind name must be an identifier") 149 + } 150 + 151 + name := t.parser.TokenString(nameNode.Tokens[0]) 152 + 153 + val, err := t.translateNode(bindNode.Nodes[1]) 154 + if err != nil { 155 + return nil, err 156 + } 157 + 158 + // Desugar: let x = v in body -> (λx. body) v 159 + body = lambda.App{ 160 + Fun: lambda.Abs{Arg: name, Body: body}, 161 + Arg: val, 162 + } 163 + } 164 + 165 + return body, nil 166 + } 167 + 168 + func (t *Translator) translateApply(n *parser.Node) (lambda.Term, error) { 169 + if len(n.Nodes) < 2 { 170 + return nil, fmt.Errorf("apply node needs at least 2 child nodes") 171 + } 172 + 173 + fun, err := t.translateNode(n.Nodes[0]) 174 + if err != nil { 175 + return nil, err 176 + } 177 + 178 + arg, err := t.translateNode(n.Nodes[1]) 179 + if err != nil { 180 + return nil, err 181 + } 182 + 183 + return lambda.App{Fun: fun, Arg: arg}, nil 184 + } 185 + 186 + func (t *Translator) translateParens(n *parser.Node) (lambda.Term, error) { 187 + if len(n.Nodes) == 0 { 188 + return nil, fmt.Errorf("parens node has no child") 189 + } 190 + return t.translateNode(n.Nodes[0]) 191 + } 192 + 193 + func (t *Translator) translateOp(n *parser.Node) (lambda.Term, error) { 194 + opType := n.Type - parser.OpNode 195 + 196 + // For now, only support + operator 197 + if opType != '+' { 198 + return nil, fmt.Errorf("unsupported operator: %s", n.Type) 199 + } 200 + 201 + if len(n.Nodes) < 2 { 202 + return nil, fmt.Errorf("binary operator needs 2 operands") 203 + } 204 + 205 + left, err := t.translateNode(n.Nodes[0]) 206 + if err != nil { 207 + return nil, err 208 + } 209 + 210 + right, err := t.translateNode(n.Nodes[1]) 211 + if err != nil { 212 + return nil, err 213 + } 214 + 215 + // Translate + using Church numeral addition 216 + // add = λm. λn. λf. λx. m f (n f x) 217 + return t.createAddition(left, right), nil 218 + } 219 + 220 + // encodeChurchNumeral creates a Church numeral for the given integer 221 + // n = λf. λx. f (f (... (f x) ...)) [n times] 222 + func (t *Translator) encodeChurchNumeral(n int) lambda.Term { 223 + if n < 0 { 224 + // For simplicity, treat negative numbers as 0 225 + n = 0 226 + } 227 + 228 + // λf. λx. f^n x 229 + var body lambda.Term = lambda.Var{Name: "x"} 230 + for i := 0; i < n; i++ { 231 + body = lambda.App{ 232 + Fun: lambda.Var{Name: "f"}, 233 + Arg: body, 234 + } 235 + } 236 + 237 + return lambda.Abs{ 238 + Arg: "f", 239 + Body: lambda.Abs{ 240 + Arg: "x", 241 + Body: body, 242 + }, 243 + } 244 + } 245 + 246 + // createAddition creates Church numeral addition: m + n 247 + // add = λm. λn. λf. λx. m f (n f x) 248 + func (t *Translator) createAddition(m, n lambda.Term) lambda.Term { 249 + // (λm. λn. λf. λx. m f (n f x)) m n 250 + addLambda := lambda.Abs{ 251 + Arg: "m", 252 + Body: lambda.Abs{ 253 + Arg: "n", 254 + Body: lambda.Abs{ 255 + Arg: "f", 256 + Body: lambda.Abs{ 257 + Arg: "x", 258 + Body: lambda.App{ 259 + Fun: lambda.App{ 260 + Fun: lambda.Var{Name: "m"}, 261 + Arg: lambda.Var{Name: "f"}, 262 + }, 263 + Arg: lambda.App{ 264 + Fun: lambda.App{ 265 + Fun: lambda.Var{Name: "n"}, 266 + Arg: lambda.Var{Name: "f"}, 267 + }, 268 + Arg: lambda.Var{Name: "x"}, 269 + }, 270 + }, 271 + }, 272 + }, 273 + }, 274 + } 275 + 276 + return lambda.App{ 277 + Fun: lambda.App{ 278 + Fun: addLambda, 279 + Arg: m, 280 + }, 281 + Arg: n, 282 + } 283 + }
+87
pkg/parser/lexer.go
···
··· 1 + package parser 2 + 3 + //go:generate ragel -Z -G2 machine.rl 4 + 5 + import ( 6 + "fmt" 7 + "go/token" 8 + "os" 9 + ) 10 + 11 + type lexerToken struct{ Sym, Pos, End, Prev int } 12 + 13 + type LexResult struct { 14 + File *token.File 15 + Data []byte 16 + Tokens []lexerToken 17 + Comments []lexerToken 18 + } 19 + 20 + var fileset = token.NewFileSet() 21 + 22 + func newLexResult(path string, size int) *LexResult { 23 + if path == "" { 24 + path = "(string)" 25 + } 26 + return &LexResult{File: fileset.AddFile(path, -1, size)} 27 + } 28 + 29 + func (r *LexResult) At(offset int) string { 30 + p := r.File.Position(r.File.Pos(offset)) 31 + return fmt.Sprintf("%s:%d:%d: ", p.Filename, p.Line, p.Column) 32 + } 33 + 34 + func (r *LexResult) TokenBytes(i int) []byte { 35 + tok := r.Tokens[i] 36 + return r.Data[tok.Pos:tok.End] 37 + } 38 + 39 + func (r *LexResult) TokenString(i int) string { 40 + return string(r.TokenBytes(i)) 41 + } 42 + 43 + func (r *LexResult) Last() string { 44 + tok := r.Tokens[len(r.Tokens)-1] 45 + return r.At(tok.Pos) + symString(tok.Sym) 46 + } 47 + 48 + func (r *LexResult) Errorf(format string, a ...interface{}) error { 49 + return fmt.Errorf("%s "+format, append([]interface{}{r.Last()}, a...)) 50 + } 51 + 52 + func symString(sym int) string { 53 + if sym >= yyPrivate-1 && sym < yyPrivate+len(yyToknames) { 54 + return yyToknames[sym-yyPrivate+1] 55 + } 56 + return fmt.Sprintf("'%c'", sym) 57 + } 58 + 59 + func (tok lexerToken) String() string { 60 + return fmt.Sprintf("%d-%d:%s", tok.Pos, tok.End, symString(tok.Sym)) 61 + } 62 + 63 + func lex(data []byte, path string) (r *LexResult, err error) { 64 + r = newLexResult(path, len(data)) 65 + err = lexData(data, r) 66 + return 67 + } 68 + 69 + func lexFile(path string) (r *LexResult, err error) { 70 + data, err := os.ReadFile(path) 71 + if err != nil { 72 + return nil, err 73 + } 74 + return lex(data, path) 75 + } 76 + 77 + type Backrefs [][2]int 78 + 79 + func (stack *Backrefs) Push(i, fin int) { 80 + *stack = append(*stack, [2]int{i, fin}) 81 + } 82 + 83 + func (stack *Backrefs) Pop() (i, fin int) { 84 + backref := (*stack)[len(*stack)-1] 85 + *stack = (*stack)[:len(*stack)-1] 86 + return backref[0], backref[1] 87 + }
+4007
pkg/parser/machine.go
···
··· 1 + //line machine.rl:1 2 + // compile-command: "ragel -Z -G2 machine.rl" 3 + 4 + package parser 5 + 6 + import "fmt" 7 + 8 + const maxstack = 64 9 + 10 + //line machine.rl:99 11 + 12 + //line machine.go:14 13 + const expr_start int = 22 14 + const expr_first_final int = 22 15 + const expr_error int = 0 16 + 17 + const expr_en_qstring int = 79 18 + const expr_en_istring int = 82 19 + const expr_en_expr int = 22 20 + 21 + //line machine.rl:102 22 + 23 + func lexData(data []byte, r *LexResult) (err error) { 24 + var cs, act, ts, te, top int 25 + var stack [maxstack]int 26 + p, pe := 0, len(data) 27 + eof := pe 28 + 29 + //line machine.go:30 30 + { 31 + cs = expr_start 32 + top = 0 33 + ts = 0 34 + te = 0 35 + act = 0 36 + } 37 + 38 + //line machine.rl:109 39 + _, _, _, _, _ = expr_first_final, expr_error, expr_en_qstring, expr_en_istring, expr_en_expr 40 + if r.File == nil { 41 + r.File = fileset.AddFile("(string)", -1, len(data)) 42 + } 43 + if r.Data == nil { 44 + r.Data = data 45 + } else { 46 + r.Data = append(r.Data, data...) 47 + } 48 + nostack := func() bool { 49 + if top != maxstack { 50 + return false 51 + } 52 + err = r.Errorf("exceeds recursion limit") 53 + return true 54 + } 55 + tok := func(sym int) { r.Tokens = append(r.Tokens, lexerToken{Sym: sym, Pos: ts, End: te}) } 56 + tokcomment := func(sym int) { r.Comments = append(r.Comments, lexerToken{Sym: sym, Pos: ts, End: te}) } 57 + var backrefs Backrefs 58 + tokenter := func(sym, fin int) { backrefs.Push(len(r.Tokens), fin); tok(sym) } 59 + tokleave := func(sym int) bool { 60 + tok(sym) 61 + if top == 0 || len(backrefs) == 0 { 62 + err = r.Errorf("does not close anything") 63 + return false 64 + } 65 + iprev, prevsym := backrefs.Pop() 66 + if prevsym != sym { 67 + err = r.Errorf("does not close %v", r.Tokens[iprev]) 68 + return false 69 + } 70 + r.Tokens[len(r.Tokens)-1].Prev = iprev 71 + return true 72 + } 73 + tokarg := func() bool { 74 + tok(int(data[ts])) 75 + if len(r.Tokens) == 1 { 76 + err = r.Errorf("does not follow anything") 77 + return false 78 + } 79 + prev := &r.Tokens[len(r.Tokens)-2] 80 + switch prev.Sym { 81 + case id: 82 + prev.Sym = argID 83 + case '}': 84 + r.Tokens[prev.Prev].Sym = argBracket 85 + default: 86 + err = r.Errorf("does not follow an argument of a function") 87 + return false 88 + } 89 + return true 90 + } 91 + addLines := func() { 92 + for i := ts; i < te; i++ { 93 + if data[i] == '\n' { 94 + r.File.AddLine(i) 95 + } 96 + } 97 + } 98 + 99 + //line machine.go:99 100 + { 101 + if p == pe { 102 + goto _test_eof 103 + } 104 + goto _resume 105 + 106 + _again: 107 + switch cs { 108 + case 22: 109 + goto st22 110 + case 23: 111 + goto st23 112 + case 1: 113 + goto st1 114 + case 24: 115 + goto st24 116 + case 2: 117 + goto st2 118 + case 3: 119 + goto st3 120 + case 25: 121 + goto st25 122 + case 26: 123 + goto st26 124 + case 27: 125 + goto st27 126 + case 28: 127 + goto st28 128 + case 29: 129 + goto st29 130 + case 30: 131 + goto st30 132 + case 31: 133 + goto st31 134 + case 32: 135 + goto st32 136 + case 33: 137 + goto st33 138 + case 4: 139 + goto st4 140 + case 5: 141 + goto st5 142 + case 34: 143 + goto st34 144 + case 35: 145 + goto st35 146 + case 36: 147 + goto st36 148 + case 37: 149 + goto st37 150 + case 6: 151 + goto st6 152 + case 38: 153 + goto st38 154 + case 7: 155 + goto st7 156 + case 8: 157 + goto st8 158 + case 39: 159 + goto st39 160 + case 40: 161 + goto st40 162 + case 9: 163 + goto st9 164 + case 10: 165 + goto st10 166 + case 41: 167 + goto st41 168 + case 42: 169 + goto st42 170 + case 43: 171 + goto st43 172 + case 44: 173 + goto st44 174 + case 45: 175 + goto st45 176 + case 11: 177 + goto st11 178 + case 12: 179 + goto st12 180 + case 46: 181 + goto st46 182 + case 47: 183 + goto st47 184 + case 48: 185 + goto st48 186 + case 13: 187 + goto st13 188 + case 14: 189 + goto st14 190 + case 49: 191 + goto st49 192 + case 50: 193 + goto st50 194 + case 51: 195 + goto st51 196 + case 52: 197 + goto st52 198 + case 53: 199 + goto st53 200 + case 54: 201 + goto st54 202 + case 55: 203 + goto st55 204 + case 56: 205 + goto st56 206 + case 57: 207 + goto st57 208 + case 58: 209 + goto st58 210 + case 59: 211 + goto st59 212 + case 60: 213 + goto st60 214 + case 61: 215 + goto st61 216 + case 62: 217 + goto st62 218 + case 63: 219 + goto st63 220 + case 64: 221 + goto st64 222 + case 65: 223 + goto st65 224 + case 66: 225 + goto st66 226 + case 67: 227 + goto st67 228 + case 68: 229 + goto st68 230 + case 69: 231 + goto st69 232 + case 70: 233 + goto st70 234 + case 71: 235 + goto st71 236 + case 72: 237 + goto st72 238 + case 73: 239 + goto st73 240 + case 74: 241 + goto st74 242 + case 75: 243 + goto st75 244 + case 76: 245 + goto st76 246 + case 15: 247 + goto st15 248 + case 77: 249 + goto st77 250 + case 78: 251 + goto st78 252 + case 79: 253 + goto st79 254 + case 80: 255 + goto st80 256 + case 16: 257 + goto st16 258 + case 17: 259 + goto st17 260 + case 81: 261 + goto st81 262 + case 82: 263 + goto st82 264 + case 83: 265 + goto st83 266 + case 18: 267 + goto st18 268 + case 19: 269 + goto st19 270 + case 20: 271 + goto st20 272 + case 21: 273 + goto st21 274 + case 84: 275 + goto st84 276 + case 85: 277 + goto st85 278 + case 86: 279 + goto st86 280 + case 0: 281 + goto st0 282 + } 283 + 284 + if p++; p == pe { 285 + goto _test_eof 286 + } 287 + _resume: 288 + switch cs { 289 + case 22: 290 + goto st_case_22 291 + case 23: 292 + goto st_case_23 293 + case 1: 294 + goto st_case_1 295 + case 24: 296 + goto st_case_24 297 + case 2: 298 + goto st_case_2 299 + case 3: 300 + goto st_case_3 301 + case 25: 302 + goto st_case_25 303 + case 26: 304 + goto st_case_26 305 + case 27: 306 + goto st_case_27 307 + case 28: 308 + goto st_case_28 309 + case 29: 310 + goto st_case_29 311 + case 30: 312 + goto st_case_30 313 + case 31: 314 + goto st_case_31 315 + case 32: 316 + goto st_case_32 317 + case 33: 318 + goto st_case_33 319 + case 4: 320 + goto st_case_4 321 + case 5: 322 + goto st_case_5 323 + case 34: 324 + goto st_case_34 325 + case 35: 326 + goto st_case_35 327 + case 36: 328 + goto st_case_36 329 + case 37: 330 + goto st_case_37 331 + case 6: 332 + goto st_case_6 333 + case 38: 334 + goto st_case_38 335 + case 7: 336 + goto st_case_7 337 + case 8: 338 + goto st_case_8 339 + case 39: 340 + goto st_case_39 341 + case 40: 342 + goto st_case_40 343 + case 9: 344 + goto st_case_9 345 + case 10: 346 + goto st_case_10 347 + case 41: 348 + goto st_case_41 349 + case 42: 350 + goto st_case_42 351 + case 43: 352 + goto st_case_43 353 + case 44: 354 + goto st_case_44 355 + case 45: 356 + goto st_case_45 357 + case 11: 358 + goto st_case_11 359 + case 12: 360 + goto st_case_12 361 + case 46: 362 + goto st_case_46 363 + case 47: 364 + goto st_case_47 365 + case 48: 366 + goto st_case_48 367 + case 13: 368 + goto st_case_13 369 + case 14: 370 + goto st_case_14 371 + case 49: 372 + goto st_case_49 373 + case 50: 374 + goto st_case_50 375 + case 51: 376 + goto st_case_51 377 + case 52: 378 + goto st_case_52 379 + case 53: 380 + goto st_case_53 381 + case 54: 382 + goto st_case_54 383 + case 55: 384 + goto st_case_55 385 + case 56: 386 + goto st_case_56 387 + case 57: 388 + goto st_case_57 389 + case 58: 390 + goto st_case_58 391 + case 59: 392 + goto st_case_59 393 + case 60: 394 + goto st_case_60 395 + case 61: 396 + goto st_case_61 397 + case 62: 398 + goto st_case_62 399 + case 63: 400 + goto st_case_63 401 + case 64: 402 + goto st_case_64 403 + case 65: 404 + goto st_case_65 405 + case 66: 406 + goto st_case_66 407 + case 67: 408 + goto st_case_67 409 + case 68: 410 + goto st_case_68 411 + case 69: 412 + goto st_case_69 413 + case 70: 414 + goto st_case_70 415 + case 71: 416 + goto st_case_71 417 + case 72: 418 + goto st_case_72 419 + case 73: 420 + goto st_case_73 421 + case 74: 422 + goto st_case_74 423 + case 75: 424 + goto st_case_75 425 + case 76: 426 + goto st_case_76 427 + case 15: 428 + goto st_case_15 429 + case 77: 430 + goto st_case_77 431 + case 78: 432 + goto st_case_78 433 + case 79: 434 + goto st_case_79 435 + case 80: 436 + goto st_case_80 437 + case 16: 438 + goto st_case_16 439 + case 17: 440 + goto st_case_17 441 + case 81: 442 + goto st_case_81 443 + case 82: 444 + goto st_case_82 445 + case 83: 446 + goto st_case_83 447 + case 18: 448 + goto st_case_18 449 + case 19: 450 + goto st_case_19 451 + case 20: 452 + goto st_case_20 453 + case 21: 454 + goto st_case_21 455 + case 84: 456 + goto st_case_84 457 + case 85: 458 + goto st_case_85 459 + case 86: 460 + goto st_case_86 461 + case 0: 462 + goto st_case_0 463 + } 464 + goto st_out 465 + tr0: 466 + //line machine.rl:95 467 + p = (te) - 1 468 + { 469 + tok(int(data[ts])) 470 + } 471 + goto st22 472 + tr2: 473 + //line machine.rl:69 474 + p = (te) - 1 475 + { 476 + tok(float) 477 + } 478 + goto st22 479 + tr5: 480 + //line NONE:1 481 + switch act { 482 + case 9: 483 + { 484 + p = (te) - 1 485 + tok(assert_) 486 + } 487 + case 10: 488 + { 489 + p = (te) - 1 490 + tok(else_) 491 + } 492 + case 11: 493 + { 494 + p = (te) - 1 495 + tok(if_) 496 + } 497 + case 12: 498 + { 499 + p = (te) - 1 500 + tok(in) 501 + } 502 + case 13: 503 + { 504 + p = (te) - 1 505 + tok(inherit) 506 + } 507 + case 14: 508 + { 509 + p = (te) - 1 510 + tok(let) 511 + } 512 + case 15: 513 + { 514 + p = (te) - 1 515 + tok(or_) 516 + } 517 + case 16: 518 + { 519 + p = (te) - 1 520 + tok(rec) 521 + } 522 + case 17: 523 + { 524 + p = (te) - 1 525 + tok(then) 526 + } 527 + case 18: 528 + { 529 + p = (te) - 1 530 + tok(with) 531 + } 532 + case 27: 533 + { 534 + p = (te) - 1 535 + tok(float) 536 + } 537 + case 28: 538 + { 539 + p = (te) - 1 540 + tok(int_) 541 + } 542 + case 29: 543 + { 544 + p = (te) - 1 545 + tok(id) 546 + } 547 + case 30: 548 + { 549 + p = (te) - 1 550 + tok(ellipsis) 551 + } 552 + case 39: 553 + { 554 + p = (te) - 1 555 + tok(concat) 556 + } 557 + case 48: 558 + { 559 + p = (te) - 1 560 + tok(int(data[ts])) 561 + } 562 + } 563 + 564 + goto st22 565 + tr14: 566 + //line machine.rl:64 567 + te = p + 1 568 + { 569 + tokcomment(comment) 570 + addLines() 571 + } 572 + goto st22 573 + tr17: 574 + //line machine.rl:68 575 + te = p + 1 576 + { 577 + tok(path) 578 + } 579 + goto st22 580 + tr31: 581 + //line machine.rl:95 582 + te = p + 1 583 + { 584 + tok(int(data[ts])) 585 + } 586 + goto st22 587 + tr33: 588 + //line machine.rl:62 589 + te = p + 1 590 + { 591 + r.File.AddLine(ts) 592 + } 593 + goto st22 594 + tr35: 595 + //line machine.rl:84 596 + te = p + 1 597 + { 598 + tokenter('"', '"') 599 + { 600 + if nostack() { 601 + return 602 + } 603 + { 604 + stack[top] = 22 605 + top++ 606 + goto st79 607 + } 608 + } 609 + } 610 + goto st22 611 + tr40: 612 + //line machine.rl:88 613 + te = p + 1 614 + { 615 + tokenter('(', ')') 616 + { 617 + if nostack() { 618 + return 619 + } 620 + { 621 + stack[top] = 22 622 + top++ 623 + goto st22 624 + } 625 + } 626 + } 627 + goto st22 628 + tr41: 629 + //line machine.rl:91 630 + te = p + 1 631 + { 632 + if !tokleave(int(data[ts])) { 633 + return 634 + } 635 + { 636 + top-- 637 + cs = stack[top] 638 + goto _again 639 + } 640 + } 641 + goto st22 642 + tr48: 643 + //line machine.rl:93 644 + te = p + 1 645 + { 646 + if !tokarg() { 647 + return 648 + } 649 + } 650 + goto st22 651 + tr53: 652 + //line machine.rl:89 653 + te = p + 1 654 + { 655 + tokenter('[', ']') 656 + { 657 + if nostack() { 658 + return 659 + } 660 + { 661 + stack[top] = 22 662 + top++ 663 + goto st22 664 + } 665 + } 666 + } 667 + goto st22 668 + tr63: 669 + //line machine.rl:90 670 + te = p + 1 671 + { 672 + tokenter('{', '}') 673 + { 674 + if nostack() { 675 + return 676 + } 677 + { 678 + stack[top] = 22 679 + top++ 680 + goto st22 681 + } 682 + } 683 + } 684 + goto st22 685 + tr66: 686 + //line machine.rl:95 687 + te = p 688 + p-- 689 + { 690 + tok(int(data[ts])) 691 + } 692 + goto st22 693 + tr68: 694 + //line machine.rl:69 695 + te = p 696 + p-- 697 + { 698 + tok(float) 699 + } 700 + goto st22 701 + tr70: 702 + //line machine.rl:61 703 + te = p 704 + p-- 705 + 706 + goto st22 707 + tr71: 708 + //line machine.rl:78 709 + te = p + 1 710 + { 711 + tok(neq) 712 + } 713 + goto st22 714 + tr72: 715 + //line machine.rl:63 716 + te = p 717 + p-- 718 + { 719 + tokcomment(comment) 720 + } 721 + goto st22 722 + tr73: 723 + //line machine.rl:87 724 + te = p + 1 725 + { 726 + tokenter(interp, '}') 727 + { 728 + if nostack() { 729 + return 730 + } 731 + { 732 + stack[top] = 22 733 + top++ 734 + goto st22 735 + } 736 + } 737 + } 738 + goto st22 739 + tr74: 740 + //line machine.rl:76 741 + te = p + 1 742 + { 743 + tok(and) 744 + } 745 + goto st22 746 + tr75: 747 + //line machine.rl:85 748 + te = p + 1 749 + { 750 + tokenter(ii, ii) 751 + { 752 + if nostack() { 753 + return 754 + } 755 + { 756 + stack[top] = 22 757 + top++ 758 + goto st82 759 + } 760 + } 761 + } 762 + goto st22 763 + tr77: 764 + //line machine.rl:66 765 + te = p 766 + p-- 767 + { 768 + tok(path) 769 + } 770 + goto st22 771 + tr79: 772 + //line machine.rl:74 773 + te = p + 1 774 + { 775 + tok(impl) 776 + } 777 + goto st22 778 + tr83: 779 + //line machine.rl:81 780 + te = p + 1 781 + { 782 + tok(update) 783 + } 784 + goto st22 785 + tr84: 786 + //line machine.rl:70 787 + te = p 788 + p-- 789 + { 790 + tok(int_) 791 + } 792 + goto st22 793 + tr86: 794 + //line machine.rl:71 795 + te = p 796 + p-- 797 + { 798 + tok(id) 799 + } 800 + goto st22 801 + tr87: 802 + //line machine.rl:79 803 + te = p + 1 804 + { 805 + tok(leq) 806 + } 807 + goto st22 808 + tr88: 809 + //line machine.rl:77 810 + te = p + 1 811 + { 812 + tok(eq) 813 + } 814 + goto st22 815 + tr89: 816 + //line machine.rl:80 817 + te = p + 1 818 + { 819 + tok(geq) 820 + } 821 + goto st22 822 + tr90: 823 + //line machine.rl:65 824 + te = p 825 + p-- 826 + { 827 + tok(uri) 828 + } 829 + goto st22 830 + tr101: 831 + //line machine.rl:53 832 + te = p 833 + p-- 834 + { 835 + tok(in) 836 + } 837 + goto st22 838 + tr118: 839 + //line machine.rl:75 840 + te = p + 1 841 + { 842 + tok(or) 843 + } 844 + goto st22 845 + tr120: 846 + //line machine.rl:67 847 + te = p 848 + p-- 849 + { 850 + tok(path) 851 + } 852 + goto st22 853 + st22: 854 + //line NONE:1 855 + ts = 0 856 + 857 + if p++; p == pe { 858 + goto _test_eof22 859 + } 860 + st_case_22: 861 + //line NONE:1 862 + ts = p 863 + 864 + //line machine.go:700 865 + switch data[p] { 866 + case 0: 867 + goto tr30 868 + case 9: 869 + goto st26 870 + case 10: 871 + goto tr33 872 + case 13: 873 + goto st26 874 + case 32: 875 + goto st26 876 + case 33: 877 + goto st27 878 + case 34: 879 + goto tr35 880 + case 35: 881 + goto st28 882 + case 36: 883 + goto st29 884 + case 38: 885 + goto st30 886 + case 39: 887 + goto st31 888 + case 40: 889 + goto tr40 890 + case 41: 891 + goto tr41 892 + case 43: 893 + goto tr42 894 + case 45: 895 + goto tr43 896 + case 46: 897 + goto tr44 898 + case 47: 899 + goto tr45 900 + case 48: 901 + goto tr46 902 + case 58: 903 + goto tr48 904 + case 60: 905 + goto tr49 906 + case 61: 907 + goto st46 908 + case 62: 909 + goto st47 910 + case 64: 911 + goto tr48 912 + case 91: 913 + goto tr53 914 + case 93: 915 + goto tr41 916 + case 95: 917 + goto tr54 918 + case 97: 919 + goto tr55 920 + case 101: 921 + goto tr56 922 + case 105: 923 + goto tr57 924 + case 108: 925 + goto tr58 926 + case 111: 927 + goto tr59 928 + case 114: 929 + goto tr60 930 + case 116: 931 + goto tr61 932 + case 119: 933 + goto tr62 934 + case 123: 935 + goto tr63 936 + case 124: 937 + goto st75 938 + case 125: 939 + goto tr41 940 + case 126: 941 + goto tr65 942 + } 943 + switch { 944 + case data[p] < 65: 945 + if 49 <= data[p] && data[p] <= 57 { 946 + goto tr47 947 + } 948 + case data[p] > 90: 949 + if 98 <= data[p] && data[p] <= 122 { 950 + goto tr52 951 + } 952 + default: 953 + goto tr52 954 + } 955 + goto tr31 956 + tr30: 957 + //line NONE:1 958 + te = p + 1 959 + 960 + goto st23 961 + st23: 962 + if p++; p == pe { 963 + goto _test_eof23 964 + } 965 + st_case_23: 966 + //line machine.go:802 967 + if data[p] == 46 { 968 + goto st1 969 + } 970 + goto tr66 971 + st1: 972 + if p++; p == pe { 973 + goto _test_eof1 974 + } 975 + st_case_1: 976 + if 48 <= data[p] && data[p] <= 57 { 977 + goto tr1 978 + } 979 + goto tr0 980 + tr1: 981 + //line NONE:1 982 + te = p + 1 983 + 984 + goto st24 985 + st24: 986 + if p++; p == pe { 987 + goto _test_eof24 988 + } 989 + st_case_24: 990 + //line machine.go:826 991 + switch data[p] { 992 + case 69: 993 + goto st2 994 + case 101: 995 + goto st2 996 + } 997 + if 48 <= data[p] && data[p] <= 57 { 998 + goto tr1 999 + } 1000 + goto tr68 1001 + st2: 1002 + if p++; p == pe { 1003 + goto _test_eof2 1004 + } 1005 + st_case_2: 1006 + switch data[p] { 1007 + case 43: 1008 + goto st3 1009 + case 45: 1010 + goto st3 1011 + } 1012 + if 48 <= data[p] && data[p] <= 57 { 1013 + goto st25 1014 + } 1015 + goto tr2 1016 + st3: 1017 + if p++; p == pe { 1018 + goto _test_eof3 1019 + } 1020 + st_case_3: 1021 + if 48 <= data[p] && data[p] <= 57 { 1022 + goto st25 1023 + } 1024 + goto tr2 1025 + st25: 1026 + if p++; p == pe { 1027 + goto _test_eof25 1028 + } 1029 + st_case_25: 1030 + if 48 <= data[p] && data[p] <= 57 { 1031 + goto st25 1032 + } 1033 + goto tr68 1034 + st26: 1035 + if p++; p == pe { 1036 + goto _test_eof26 1037 + } 1038 + st_case_26: 1039 + switch data[p] { 1040 + case 9: 1041 + goto st26 1042 + case 13: 1043 + goto st26 1044 + case 32: 1045 + goto st26 1046 + } 1047 + goto tr70 1048 + st27: 1049 + if p++; p == pe { 1050 + goto _test_eof27 1051 + } 1052 + st_case_27: 1053 + if data[p] == 61 { 1054 + goto tr71 1055 + } 1056 + goto tr66 1057 + st28: 1058 + if p++; p == pe { 1059 + goto _test_eof28 1060 + } 1061 + st_case_28: 1062 + switch data[p] { 1063 + case 10: 1064 + goto tr72 1065 + case 13: 1066 + goto tr72 1067 + } 1068 + goto st28 1069 + st29: 1070 + if p++; p == pe { 1071 + goto _test_eof29 1072 + } 1073 + st_case_29: 1074 + if data[p] == 123 { 1075 + goto tr73 1076 + } 1077 + goto tr66 1078 + st30: 1079 + if p++; p == pe { 1080 + goto _test_eof30 1081 + } 1082 + st_case_30: 1083 + if data[p] == 38 { 1084 + goto tr74 1085 + } 1086 + goto tr66 1087 + st31: 1088 + if p++; p == pe { 1089 + goto _test_eof31 1090 + } 1091 + st_case_31: 1092 + if data[p] == 39 { 1093 + goto tr75 1094 + } 1095 + goto tr66 1096 + tr42: 1097 + //line NONE:1 1098 + te = p + 1 1099 + 1100 + //line machine.rl:95 1101 + act = 48 1102 + goto st32 1103 + st32: 1104 + if p++; p == pe { 1105 + goto _test_eof32 1106 + } 1107 + st_case_32: 1108 + //line machine.go:944 1109 + switch data[p] { 1110 + case 43: 1111 + goto tr76 1112 + case 47: 1113 + goto st5 1114 + case 95: 1115 + goto st4 1116 + } 1117 + switch { 1118 + case data[p] < 65: 1119 + if 45 <= data[p] && data[p] <= 57 { 1120 + goto st4 1121 + } 1122 + case data[p] > 90: 1123 + if 97 <= data[p] && data[p] <= 122 { 1124 + goto st4 1125 + } 1126 + default: 1127 + goto st4 1128 + } 1129 + goto tr66 1130 + tr9: 1131 + //line NONE:1 1132 + te = p + 1 1133 + 1134 + //line machine.rl:73 1135 + act = 30 1136 + goto st33 1137 + tr76: 1138 + //line NONE:1 1139 + te = p + 1 1140 + 1141 + //line machine.rl:82 1142 + act = 39 1143 + goto st33 1144 + st33: 1145 + if p++; p == pe { 1146 + goto _test_eof33 1147 + } 1148 + st_case_33: 1149 + //line machine.go:985 1150 + switch data[p] { 1151 + case 43: 1152 + goto st4 1153 + case 47: 1154 + goto st5 1155 + case 95: 1156 + goto st4 1157 + } 1158 + switch { 1159 + case data[p] < 65: 1160 + if 45 <= data[p] && data[p] <= 57 { 1161 + goto st4 1162 + } 1163 + case data[p] > 90: 1164 + if 97 <= data[p] && data[p] <= 122 { 1165 + goto st4 1166 + } 1167 + default: 1168 + goto st4 1169 + } 1170 + goto tr5 1171 + st4: 1172 + if p++; p == pe { 1173 + goto _test_eof4 1174 + } 1175 + st_case_4: 1176 + switch data[p] { 1177 + case 43: 1178 + goto st4 1179 + case 47: 1180 + goto st5 1181 + case 95: 1182 + goto st4 1183 + } 1184 + switch { 1185 + case data[p] < 65: 1186 + if 45 <= data[p] && data[p] <= 57 { 1187 + goto st4 1188 + } 1189 + case data[p] > 90: 1190 + if 97 <= data[p] && data[p] <= 122 { 1191 + goto st4 1192 + } 1193 + default: 1194 + goto st4 1195 + } 1196 + goto tr5 1197 + st5: 1198 + if p++; p == pe { 1199 + goto _test_eof5 1200 + } 1201 + st_case_5: 1202 + switch data[p] { 1203 + case 43: 1204 + goto st34 1205 + case 95: 1206 + goto st34 1207 + } 1208 + switch { 1209 + case data[p] < 48: 1210 + if 45 <= data[p] && data[p] <= 46 { 1211 + goto st34 1212 + } 1213 + case data[p] > 57: 1214 + switch { 1215 + case data[p] > 90: 1216 + if 97 <= data[p] && data[p] <= 122 { 1217 + goto st34 1218 + } 1219 + case data[p] >= 65: 1220 + goto st34 1221 + } 1222 + default: 1223 + goto st34 1224 + } 1225 + goto tr5 1226 + st34: 1227 + if p++; p == pe { 1228 + goto _test_eof34 1229 + } 1230 + st_case_34: 1231 + switch data[p] { 1232 + case 43: 1233 + goto st34 1234 + case 47: 1235 + goto st35 1236 + case 95: 1237 + goto st34 1238 + } 1239 + switch { 1240 + case data[p] < 65: 1241 + if 45 <= data[p] && data[p] <= 57 { 1242 + goto st34 1243 + } 1244 + case data[p] > 90: 1245 + if 97 <= data[p] && data[p] <= 122 { 1246 + goto st34 1247 + } 1248 + default: 1249 + goto st34 1250 + } 1251 + goto tr77 1252 + st35: 1253 + if p++; p == pe { 1254 + goto _test_eof35 1255 + } 1256 + st_case_35: 1257 + switch data[p] { 1258 + case 43: 1259 + goto st34 1260 + case 95: 1261 + goto st34 1262 + } 1263 + switch { 1264 + case data[p] < 48: 1265 + if 45 <= data[p] && data[p] <= 46 { 1266 + goto st34 1267 + } 1268 + case data[p] > 57: 1269 + switch { 1270 + case data[p] > 90: 1271 + if 97 <= data[p] && data[p] <= 122 { 1272 + goto st34 1273 + } 1274 + case data[p] >= 65: 1275 + goto st34 1276 + } 1277 + default: 1278 + goto st34 1279 + } 1280 + goto tr77 1281 + tr43: 1282 + //line NONE:1 1283 + te = p + 1 1284 + 1285 + //line machine.rl:95 1286 + act = 48 1287 + goto st36 1288 + st36: 1289 + if p++; p == pe { 1290 + goto _test_eof36 1291 + } 1292 + st_case_36: 1293 + //line machine.go:1129 1294 + switch data[p] { 1295 + case 43: 1296 + goto st4 1297 + case 47: 1298 + goto st5 1299 + case 62: 1300 + goto tr79 1301 + case 95: 1302 + goto st4 1303 + } 1304 + switch { 1305 + case data[p] < 65: 1306 + if 45 <= data[p] && data[p] <= 57 { 1307 + goto st4 1308 + } 1309 + case data[p] > 90: 1310 + if 97 <= data[p] && data[p] <= 122 { 1311 + goto st4 1312 + } 1313 + default: 1314 + goto st4 1315 + } 1316 + goto tr66 1317 + tr44: 1318 + //line NONE:1 1319 + te = p + 1 1320 + 1321 + //line machine.rl:95 1322 + act = 48 1323 + goto st37 1324 + st37: 1325 + if p++; p == pe { 1326 + goto _test_eof37 1327 + } 1328 + st_case_37: 1329 + //line machine.go:1165 1330 + switch data[p] { 1331 + case 43: 1332 + goto st4 1333 + case 45: 1334 + goto st4 1335 + case 46: 1336 + goto st6 1337 + case 47: 1338 + goto st5 1339 + case 95: 1340 + goto st4 1341 + } 1342 + switch { 1343 + case data[p] < 65: 1344 + if 48 <= data[p] && data[p] <= 57 { 1345 + goto tr81 1346 + } 1347 + case data[p] > 90: 1348 + if 97 <= data[p] && data[p] <= 122 { 1349 + goto st4 1350 + } 1351 + default: 1352 + goto st4 1353 + } 1354 + goto tr66 1355 + st6: 1356 + if p++; p == pe { 1357 + goto _test_eof6 1358 + } 1359 + st_case_6: 1360 + switch data[p] { 1361 + case 43: 1362 + goto st4 1363 + case 46: 1364 + goto tr9 1365 + case 47: 1366 + goto st5 1367 + case 95: 1368 + goto st4 1369 + } 1370 + switch { 1371 + case data[p] < 65: 1372 + if 45 <= data[p] && data[p] <= 57 { 1373 + goto st4 1374 + } 1375 + case data[p] > 90: 1376 + if 97 <= data[p] && data[p] <= 122 { 1377 + goto st4 1378 + } 1379 + default: 1380 + goto st4 1381 + } 1382 + goto tr0 1383 + tr81: 1384 + //line NONE:1 1385 + te = p + 1 1386 + 1387 + //line machine.rl:69 1388 + act = 27 1389 + goto st38 1390 + st38: 1391 + if p++; p == pe { 1392 + goto _test_eof38 1393 + } 1394 + st_case_38: 1395 + //line machine.go:1231 1396 + switch data[p] { 1397 + case 43: 1398 + goto st4 1399 + case 47: 1400 + goto st5 1401 + case 69: 1402 + goto st7 1403 + case 95: 1404 + goto st4 1405 + case 101: 1406 + goto st7 1407 + } 1408 + switch { 1409 + case data[p] < 48: 1410 + if 45 <= data[p] && data[p] <= 46 { 1411 + goto st4 1412 + } 1413 + case data[p] > 57: 1414 + switch { 1415 + case data[p] > 90: 1416 + if 97 <= data[p] && data[p] <= 122 { 1417 + goto st4 1418 + } 1419 + case data[p] >= 65: 1420 + goto st4 1421 + } 1422 + default: 1423 + goto tr81 1424 + } 1425 + goto tr68 1426 + st7: 1427 + if p++; p == pe { 1428 + goto _test_eof7 1429 + } 1430 + st_case_7: 1431 + switch data[p] { 1432 + case 43: 1433 + goto st8 1434 + case 45: 1435 + goto st8 1436 + case 46: 1437 + goto st4 1438 + case 47: 1439 + goto st5 1440 + case 95: 1441 + goto st4 1442 + } 1443 + switch { 1444 + case data[p] < 65: 1445 + if 48 <= data[p] && data[p] <= 57 { 1446 + goto tr11 1447 + } 1448 + case data[p] > 90: 1449 + if 97 <= data[p] && data[p] <= 122 { 1450 + goto st4 1451 + } 1452 + default: 1453 + goto st4 1454 + } 1455 + goto tr2 1456 + st8: 1457 + if p++; p == pe { 1458 + goto _test_eof8 1459 + } 1460 + st_case_8: 1461 + switch data[p] { 1462 + case 43: 1463 + goto st4 1464 + case 47: 1465 + goto st5 1466 + case 95: 1467 + goto st4 1468 + } 1469 + switch { 1470 + case data[p] < 48: 1471 + if 45 <= data[p] && data[p] <= 46 { 1472 + goto st4 1473 + } 1474 + case data[p] > 57: 1475 + switch { 1476 + case data[p] > 90: 1477 + if 97 <= data[p] && data[p] <= 122 { 1478 + goto st4 1479 + } 1480 + case data[p] >= 65: 1481 + goto st4 1482 + } 1483 + default: 1484 + goto tr11 1485 + } 1486 + goto tr2 1487 + tr11: 1488 + //line NONE:1 1489 + te = p + 1 1490 + 1491 + //line machine.rl:69 1492 + act = 27 1493 + goto st39 1494 + st39: 1495 + if p++; p == pe { 1496 + goto _test_eof39 1497 + } 1498 + st_case_39: 1499 + //line machine.go:1335 1500 + switch data[p] { 1501 + case 43: 1502 + goto st4 1503 + case 47: 1504 + goto st5 1505 + case 95: 1506 + goto st4 1507 + } 1508 + switch { 1509 + case data[p] < 48: 1510 + if 45 <= data[p] && data[p] <= 46 { 1511 + goto st4 1512 + } 1513 + case data[p] > 57: 1514 + switch { 1515 + case data[p] > 90: 1516 + if 97 <= data[p] && data[p] <= 122 { 1517 + goto st4 1518 + } 1519 + case data[p] >= 65: 1520 + goto st4 1521 + } 1522 + default: 1523 + goto tr11 1524 + } 1525 + goto tr68 1526 + tr45: 1527 + //line NONE:1 1528 + te = p + 1 1529 + 1530 + goto st40 1531 + st40: 1532 + if p++; p == pe { 1533 + goto _test_eof40 1534 + } 1535 + st_case_40: 1536 + //line machine.go:1372 1537 + switch data[p] { 1538 + case 42: 1539 + goto st9 1540 + case 43: 1541 + goto st34 1542 + case 47: 1543 + goto tr83 1544 + case 95: 1545 + goto st34 1546 + } 1547 + switch { 1548 + case data[p] < 65: 1549 + if 45 <= data[p] && data[p] <= 57 { 1550 + goto st34 1551 + } 1552 + case data[p] > 90: 1553 + if 97 <= data[p] && data[p] <= 122 { 1554 + goto st34 1555 + } 1556 + default: 1557 + goto st34 1558 + } 1559 + goto tr66 1560 + st9: 1561 + if p++; p == pe { 1562 + goto _test_eof9 1563 + } 1564 + st_case_9: 1565 + if data[p] == 42 { 1566 + goto st10 1567 + } 1568 + goto st9 1569 + st10: 1570 + if p++; p == pe { 1571 + goto _test_eof10 1572 + } 1573 + st_case_10: 1574 + switch data[p] { 1575 + case 42: 1576 + goto st10 1577 + case 47: 1578 + goto tr14 1579 + } 1580 + goto st9 1581 + tr46: 1582 + //line NONE:1 1583 + te = p + 1 1584 + 1585 + //line machine.rl:70 1586 + act = 28 1587 + goto st41 1588 + st41: 1589 + if p++; p == pe { 1590 + goto _test_eof41 1591 + } 1592 + st_case_41: 1593 + //line machine.go:1429 1594 + switch data[p] { 1595 + case 39: 1596 + goto st42 1597 + case 43: 1598 + goto st4 1599 + case 45: 1600 + goto tr54 1601 + case 46: 1602 + goto st4 1603 + case 47: 1604 + goto st5 1605 + case 95: 1606 + goto tr54 1607 + } 1608 + switch { 1609 + case data[p] < 65: 1610 + if 48 <= data[p] && data[p] <= 57 { 1611 + goto tr46 1612 + } 1613 + case data[p] > 90: 1614 + if 97 <= data[p] && data[p] <= 122 { 1615 + goto tr54 1616 + } 1617 + default: 1618 + goto tr54 1619 + } 1620 + goto tr84 1621 + st42: 1622 + if p++; p == pe { 1623 + goto _test_eof42 1624 + } 1625 + st_case_42: 1626 + switch data[p] { 1627 + case 39: 1628 + goto st42 1629 + case 45: 1630 + goto st42 1631 + case 95: 1632 + goto st42 1633 + } 1634 + switch { 1635 + case data[p] < 65: 1636 + if 48 <= data[p] && data[p] <= 57 { 1637 + goto st42 1638 + } 1639 + case data[p] > 90: 1640 + if 97 <= data[p] && data[p] <= 122 { 1641 + goto st42 1642 + } 1643 + default: 1644 + goto st42 1645 + } 1646 + goto tr86 1647 + tr54: 1648 + //line NONE:1 1649 + te = p + 1 1650 + 1651 + //line machine.rl:71 1652 + act = 29 1653 + goto st43 1654 + st43: 1655 + if p++; p == pe { 1656 + goto _test_eof43 1657 + } 1658 + st_case_43: 1659 + //line machine.go:1495 1660 + switch data[p] { 1661 + case 39: 1662 + goto st42 1663 + case 43: 1664 + goto st4 1665 + case 46: 1666 + goto st4 1667 + case 47: 1668 + goto st5 1669 + case 95: 1670 + goto tr54 1671 + } 1672 + switch { 1673 + case data[p] < 65: 1674 + if 45 <= data[p] && data[p] <= 57 { 1675 + goto tr54 1676 + } 1677 + case data[p] > 90: 1678 + if 97 <= data[p] && data[p] <= 122 { 1679 + goto tr54 1680 + } 1681 + default: 1682 + goto tr54 1683 + } 1684 + goto tr86 1685 + tr47: 1686 + //line NONE:1 1687 + te = p + 1 1688 + 1689 + //line machine.rl:70 1690 + act = 28 1691 + goto st44 1692 + st44: 1693 + if p++; p == pe { 1694 + goto _test_eof44 1695 + } 1696 + st_case_44: 1697 + //line machine.go:1533 1698 + switch data[p] { 1699 + case 39: 1700 + goto st42 1701 + case 43: 1702 + goto st4 1703 + case 45: 1704 + goto tr54 1705 + case 46: 1706 + goto tr81 1707 + case 47: 1708 + goto st5 1709 + case 95: 1710 + goto tr54 1711 + } 1712 + switch { 1713 + case data[p] < 65: 1714 + if 48 <= data[p] && data[p] <= 57 { 1715 + goto tr47 1716 + } 1717 + case data[p] > 90: 1718 + if 97 <= data[p] && data[p] <= 122 { 1719 + goto tr54 1720 + } 1721 + default: 1722 + goto tr54 1723 + } 1724 + goto tr84 1725 + tr49: 1726 + //line NONE:1 1727 + te = p + 1 1728 + 1729 + goto st45 1730 + st45: 1731 + if p++; p == pe { 1732 + goto _test_eof45 1733 + } 1734 + st_case_45: 1735 + //line machine.go:1571 1736 + switch data[p] { 1737 + case 43: 1738 + goto st11 1739 + case 61: 1740 + goto tr87 1741 + case 95: 1742 + goto st11 1743 + } 1744 + switch { 1745 + case data[p] < 48: 1746 + if 45 <= data[p] && data[p] <= 46 { 1747 + goto st11 1748 + } 1749 + case data[p] > 57: 1750 + switch { 1751 + case data[p] > 90: 1752 + if 97 <= data[p] && data[p] <= 122 { 1753 + goto st11 1754 + } 1755 + case data[p] >= 65: 1756 + goto st11 1757 + } 1758 + default: 1759 + goto st11 1760 + } 1761 + goto tr66 1762 + st11: 1763 + if p++; p == pe { 1764 + goto _test_eof11 1765 + } 1766 + st_case_11: 1767 + switch data[p] { 1768 + case 43: 1769 + goto st11 1770 + case 47: 1771 + goto st12 1772 + case 62: 1773 + goto tr17 1774 + case 95: 1775 + goto st11 1776 + } 1777 + switch { 1778 + case data[p] < 65: 1779 + if 45 <= data[p] && data[p] <= 57 { 1780 + goto st11 1781 + } 1782 + case data[p] > 90: 1783 + if 97 <= data[p] && data[p] <= 122 { 1784 + goto st11 1785 + } 1786 + default: 1787 + goto st11 1788 + } 1789 + goto tr0 1790 + st12: 1791 + if p++; p == pe { 1792 + goto _test_eof12 1793 + } 1794 + st_case_12: 1795 + switch data[p] { 1796 + case 43: 1797 + goto st11 1798 + case 95: 1799 + goto st11 1800 + } 1801 + switch { 1802 + case data[p] < 48: 1803 + if 45 <= data[p] && data[p] <= 46 { 1804 + goto st11 1805 + } 1806 + case data[p] > 57: 1807 + switch { 1808 + case data[p] > 90: 1809 + if 97 <= data[p] && data[p] <= 122 { 1810 + goto st11 1811 + } 1812 + case data[p] >= 65: 1813 + goto st11 1814 + } 1815 + default: 1816 + goto st11 1817 + } 1818 + goto tr0 1819 + st46: 1820 + if p++; p == pe { 1821 + goto _test_eof46 1822 + } 1823 + st_case_46: 1824 + if data[p] == 61 { 1825 + goto tr88 1826 + } 1827 + goto tr66 1828 + st47: 1829 + if p++; p == pe { 1830 + goto _test_eof47 1831 + } 1832 + st_case_47: 1833 + if data[p] == 61 { 1834 + goto tr89 1835 + } 1836 + goto tr66 1837 + tr52: 1838 + //line NONE:1 1839 + te = p + 1 1840 + 1841 + //line machine.rl:71 1842 + act = 29 1843 + goto st48 1844 + tr95: 1845 + //line NONE:1 1846 + te = p + 1 1847 + 1848 + //line machine.rl:50 1849 + act = 9 1850 + goto st48 1851 + tr98: 1852 + //line NONE:1 1853 + te = p + 1 1854 + 1855 + //line machine.rl:51 1856 + act = 10 1857 + goto st48 1858 + tr99: 1859 + //line NONE:1 1860 + te = p + 1 1861 + 1862 + //line machine.rl:52 1863 + act = 11 1864 + goto st48 1865 + tr106: 1866 + //line NONE:1 1867 + te = p + 1 1868 + 1869 + //line machine.rl:54 1870 + act = 13 1871 + goto st48 1872 + tr108: 1873 + //line NONE:1 1874 + te = p + 1 1875 + 1876 + //line machine.rl:55 1877 + act = 14 1878 + goto st48 1879 + tr109: 1880 + //line NONE:1 1881 + te = p + 1 1882 + 1883 + //line machine.rl:56 1884 + act = 15 1885 + goto st48 1886 + tr111: 1887 + //line NONE:1 1888 + te = p + 1 1889 + 1890 + //line machine.rl:57 1891 + act = 16 1892 + goto st48 1893 + tr114: 1894 + //line NONE:1 1895 + te = p + 1 1896 + 1897 + //line machine.rl:58 1898 + act = 17 1899 + goto st48 1900 + tr117: 1901 + //line NONE:1 1902 + te = p + 1 1903 + 1904 + //line machine.rl:59 1905 + act = 18 1906 + goto st48 1907 + st48: 1908 + if p++; p == pe { 1909 + goto _test_eof48 1910 + } 1911 + st_case_48: 1912 + //line machine.go:1748 1913 + switch data[p] { 1914 + case 39: 1915 + goto st42 1916 + case 43: 1917 + goto st13 1918 + case 46: 1919 + goto st13 1920 + case 47: 1921 + goto st5 1922 + case 58: 1923 + goto st14 1924 + case 95: 1925 + goto tr54 1926 + } 1927 + switch { 1928 + case data[p] < 65: 1929 + if 45 <= data[p] && data[p] <= 57 { 1930 + goto tr52 1931 + } 1932 + case data[p] > 90: 1933 + if 97 <= data[p] && data[p] <= 122 { 1934 + goto tr52 1935 + } 1936 + default: 1937 + goto tr52 1938 + } 1939 + goto tr5 1940 + st13: 1941 + if p++; p == pe { 1942 + goto _test_eof13 1943 + } 1944 + st_case_13: 1945 + switch data[p] { 1946 + case 43: 1947 + goto st13 1948 + case 47: 1949 + goto st5 1950 + case 58: 1951 + goto st14 1952 + case 95: 1953 + goto st4 1954 + } 1955 + switch { 1956 + case data[p] < 65: 1957 + if 45 <= data[p] && data[p] <= 57 { 1958 + goto st13 1959 + } 1960 + case data[p] > 90: 1961 + if 97 <= data[p] && data[p] <= 122 { 1962 + goto st13 1963 + } 1964 + default: 1965 + goto st13 1966 + } 1967 + goto tr5 1968 + st14: 1969 + if p++; p == pe { 1970 + goto _test_eof14 1971 + } 1972 + st_case_14: 1973 + switch data[p] { 1974 + case 33: 1975 + goto st49 1976 + case 61: 1977 + goto st49 1978 + case 95: 1979 + goto st49 1980 + case 126: 1981 + goto st49 1982 + } 1983 + switch { 1984 + case data[p] < 42: 1985 + if 36 <= data[p] && data[p] <= 39 { 1986 + goto st49 1987 + } 1988 + case data[p] > 58: 1989 + switch { 1990 + case data[p] > 90: 1991 + if 97 <= data[p] && data[p] <= 122 { 1992 + goto st49 1993 + } 1994 + case data[p] >= 63: 1995 + goto st49 1996 + } 1997 + default: 1998 + goto st49 1999 + } 2000 + goto tr5 2001 + st49: 2002 + if p++; p == pe { 2003 + goto _test_eof49 2004 + } 2005 + st_case_49: 2006 + switch data[p] { 2007 + case 33: 2008 + goto st49 2009 + case 61: 2010 + goto st49 2011 + case 95: 2012 + goto st49 2013 + case 126: 2014 + goto st49 2015 + } 2016 + switch { 2017 + case data[p] < 42: 2018 + if 36 <= data[p] && data[p] <= 39 { 2019 + goto st49 2020 + } 2021 + case data[p] > 58: 2022 + switch { 2023 + case data[p] > 90: 2024 + if 97 <= data[p] && data[p] <= 122 { 2025 + goto st49 2026 + } 2027 + case data[p] >= 63: 2028 + goto st49 2029 + } 2030 + default: 2031 + goto st49 2032 + } 2033 + goto tr90 2034 + tr55: 2035 + //line NONE:1 2036 + te = p + 1 2037 + 2038 + //line machine.rl:71 2039 + act = 29 2040 + goto st50 2041 + st50: 2042 + if p++; p == pe { 2043 + goto _test_eof50 2044 + } 2045 + st_case_50: 2046 + //line machine.go:1882 2047 + switch data[p] { 2048 + case 39: 2049 + goto st42 2050 + case 43: 2051 + goto st13 2052 + case 46: 2053 + goto st13 2054 + case 47: 2055 + goto st5 2056 + case 58: 2057 + goto st14 2058 + case 95: 2059 + goto tr54 2060 + case 115: 2061 + goto tr91 2062 + } 2063 + switch { 2064 + case data[p] < 65: 2065 + if 45 <= data[p] && data[p] <= 57 { 2066 + goto tr52 2067 + } 2068 + case data[p] > 90: 2069 + if 97 <= data[p] && data[p] <= 122 { 2070 + goto tr52 2071 + } 2072 + default: 2073 + goto tr52 2074 + } 2075 + goto tr86 2076 + tr91: 2077 + //line NONE:1 2078 + te = p + 1 2079 + 2080 + //line machine.rl:71 2081 + act = 29 2082 + goto st51 2083 + st51: 2084 + if p++; p == pe { 2085 + goto _test_eof51 2086 + } 2087 + st_case_51: 2088 + //line machine.go:1924 2089 + switch data[p] { 2090 + case 39: 2091 + goto st42 2092 + case 43: 2093 + goto st13 2094 + case 46: 2095 + goto st13 2096 + case 47: 2097 + goto st5 2098 + case 58: 2099 + goto st14 2100 + case 95: 2101 + goto tr54 2102 + case 115: 2103 + goto tr92 2104 + } 2105 + switch { 2106 + case data[p] < 65: 2107 + if 45 <= data[p] && data[p] <= 57 { 2108 + goto tr52 2109 + } 2110 + case data[p] > 90: 2111 + if 97 <= data[p] && data[p] <= 122 { 2112 + goto tr52 2113 + } 2114 + default: 2115 + goto tr52 2116 + } 2117 + goto tr86 2118 + tr92: 2119 + //line NONE:1 2120 + te = p + 1 2121 + 2122 + //line machine.rl:71 2123 + act = 29 2124 + goto st52 2125 + st52: 2126 + if p++; p == pe { 2127 + goto _test_eof52 2128 + } 2129 + st_case_52: 2130 + //line machine.go:1966 2131 + switch data[p] { 2132 + case 39: 2133 + goto st42 2134 + case 43: 2135 + goto st13 2136 + case 46: 2137 + goto st13 2138 + case 47: 2139 + goto st5 2140 + case 58: 2141 + goto st14 2142 + case 95: 2143 + goto tr54 2144 + case 101: 2145 + goto tr93 2146 + } 2147 + switch { 2148 + case data[p] < 65: 2149 + if 45 <= data[p] && data[p] <= 57 { 2150 + goto tr52 2151 + } 2152 + case data[p] > 90: 2153 + if 97 <= data[p] && data[p] <= 122 { 2154 + goto tr52 2155 + } 2156 + default: 2157 + goto tr52 2158 + } 2159 + goto tr86 2160 + tr93: 2161 + //line NONE:1 2162 + te = p + 1 2163 + 2164 + //line machine.rl:71 2165 + act = 29 2166 + goto st53 2167 + st53: 2168 + if p++; p == pe { 2169 + goto _test_eof53 2170 + } 2171 + st_case_53: 2172 + //line machine.go:2008 2173 + switch data[p] { 2174 + case 39: 2175 + goto st42 2176 + case 43: 2177 + goto st13 2178 + case 46: 2179 + goto st13 2180 + case 47: 2181 + goto st5 2182 + case 58: 2183 + goto st14 2184 + case 95: 2185 + goto tr54 2186 + case 114: 2187 + goto tr94 2188 + } 2189 + switch { 2190 + case data[p] < 65: 2191 + if 45 <= data[p] && data[p] <= 57 { 2192 + goto tr52 2193 + } 2194 + case data[p] > 90: 2195 + if 97 <= data[p] && data[p] <= 122 { 2196 + goto tr52 2197 + } 2198 + default: 2199 + goto tr52 2200 + } 2201 + goto tr86 2202 + tr94: 2203 + //line NONE:1 2204 + te = p + 1 2205 + 2206 + //line machine.rl:71 2207 + act = 29 2208 + goto st54 2209 + st54: 2210 + if p++; p == pe { 2211 + goto _test_eof54 2212 + } 2213 + st_case_54: 2214 + //line machine.go:2050 2215 + switch data[p] { 2216 + case 39: 2217 + goto st42 2218 + case 43: 2219 + goto st13 2220 + case 46: 2221 + goto st13 2222 + case 47: 2223 + goto st5 2224 + case 58: 2225 + goto st14 2226 + case 95: 2227 + goto tr54 2228 + case 116: 2229 + goto tr95 2230 + } 2231 + switch { 2232 + case data[p] < 65: 2233 + if 45 <= data[p] && data[p] <= 57 { 2234 + goto tr52 2235 + } 2236 + case data[p] > 90: 2237 + if 97 <= data[p] && data[p] <= 122 { 2238 + goto tr52 2239 + } 2240 + default: 2241 + goto tr52 2242 + } 2243 + goto tr86 2244 + tr56: 2245 + //line NONE:1 2246 + te = p + 1 2247 + 2248 + //line machine.rl:71 2249 + act = 29 2250 + goto st55 2251 + st55: 2252 + if p++; p == pe { 2253 + goto _test_eof55 2254 + } 2255 + st_case_55: 2256 + //line machine.go:2092 2257 + switch data[p] { 2258 + case 39: 2259 + goto st42 2260 + case 43: 2261 + goto st13 2262 + case 46: 2263 + goto st13 2264 + case 47: 2265 + goto st5 2266 + case 58: 2267 + goto st14 2268 + case 95: 2269 + goto tr54 2270 + case 108: 2271 + goto tr96 2272 + } 2273 + switch { 2274 + case data[p] < 65: 2275 + if 45 <= data[p] && data[p] <= 57 { 2276 + goto tr52 2277 + } 2278 + case data[p] > 90: 2279 + if 97 <= data[p] && data[p] <= 122 { 2280 + goto tr52 2281 + } 2282 + default: 2283 + goto tr52 2284 + } 2285 + goto tr86 2286 + tr96: 2287 + //line NONE:1 2288 + te = p + 1 2289 + 2290 + //line machine.rl:71 2291 + act = 29 2292 + goto st56 2293 + st56: 2294 + if p++; p == pe { 2295 + goto _test_eof56 2296 + } 2297 + st_case_56: 2298 + //line machine.go:2134 2299 + switch data[p] { 2300 + case 39: 2301 + goto st42 2302 + case 43: 2303 + goto st13 2304 + case 46: 2305 + goto st13 2306 + case 47: 2307 + goto st5 2308 + case 58: 2309 + goto st14 2310 + case 95: 2311 + goto tr54 2312 + case 115: 2313 + goto tr97 2314 + } 2315 + switch { 2316 + case data[p] < 65: 2317 + if 45 <= data[p] && data[p] <= 57 { 2318 + goto tr52 2319 + } 2320 + case data[p] > 90: 2321 + if 97 <= data[p] && data[p] <= 122 { 2322 + goto tr52 2323 + } 2324 + default: 2325 + goto tr52 2326 + } 2327 + goto tr86 2328 + tr97: 2329 + //line NONE:1 2330 + te = p + 1 2331 + 2332 + //line machine.rl:71 2333 + act = 29 2334 + goto st57 2335 + st57: 2336 + if p++; p == pe { 2337 + goto _test_eof57 2338 + } 2339 + st_case_57: 2340 + //line machine.go:2176 2341 + switch data[p] { 2342 + case 39: 2343 + goto st42 2344 + case 43: 2345 + goto st13 2346 + case 46: 2347 + goto st13 2348 + case 47: 2349 + goto st5 2350 + case 58: 2351 + goto st14 2352 + case 95: 2353 + goto tr54 2354 + case 101: 2355 + goto tr98 2356 + } 2357 + switch { 2358 + case data[p] < 65: 2359 + if 45 <= data[p] && data[p] <= 57 { 2360 + goto tr52 2361 + } 2362 + case data[p] > 90: 2363 + if 97 <= data[p] && data[p] <= 122 { 2364 + goto tr52 2365 + } 2366 + default: 2367 + goto tr52 2368 + } 2369 + goto tr86 2370 + tr57: 2371 + //line NONE:1 2372 + te = p + 1 2373 + 2374 + //line machine.rl:71 2375 + act = 29 2376 + goto st58 2377 + st58: 2378 + if p++; p == pe { 2379 + goto _test_eof58 2380 + } 2381 + st_case_58: 2382 + //line machine.go:2218 2383 + switch data[p] { 2384 + case 39: 2385 + goto st42 2386 + case 43: 2387 + goto st13 2388 + case 46: 2389 + goto st13 2390 + case 47: 2391 + goto st5 2392 + case 58: 2393 + goto st14 2394 + case 95: 2395 + goto tr54 2396 + case 102: 2397 + goto tr99 2398 + case 110: 2399 + goto tr100 2400 + } 2401 + switch { 2402 + case data[p] < 65: 2403 + if 45 <= data[p] && data[p] <= 57 { 2404 + goto tr52 2405 + } 2406 + case data[p] > 90: 2407 + if 97 <= data[p] && data[p] <= 122 { 2408 + goto tr52 2409 + } 2410 + default: 2411 + goto tr52 2412 + } 2413 + goto tr86 2414 + tr100: 2415 + //line NONE:1 2416 + te = p + 1 2417 + 2418 + //line machine.rl:53 2419 + act = 12 2420 + goto st59 2421 + st59: 2422 + if p++; p == pe { 2423 + goto _test_eof59 2424 + } 2425 + st_case_59: 2426 + //line machine.go:2262 2427 + switch data[p] { 2428 + case 39: 2429 + goto st42 2430 + case 43: 2431 + goto st13 2432 + case 46: 2433 + goto st13 2434 + case 47: 2435 + goto st5 2436 + case 58: 2437 + goto st14 2438 + case 95: 2439 + goto tr54 2440 + case 104: 2441 + goto tr102 2442 + } 2443 + switch { 2444 + case data[p] < 65: 2445 + if 45 <= data[p] && data[p] <= 57 { 2446 + goto tr52 2447 + } 2448 + case data[p] > 90: 2449 + if 97 <= data[p] && data[p] <= 122 { 2450 + goto tr52 2451 + } 2452 + default: 2453 + goto tr52 2454 + } 2455 + goto tr101 2456 + tr102: 2457 + //line NONE:1 2458 + te = p + 1 2459 + 2460 + //line machine.rl:71 2461 + act = 29 2462 + goto st60 2463 + st60: 2464 + if p++; p == pe { 2465 + goto _test_eof60 2466 + } 2467 + st_case_60: 2468 + //line machine.go:2304 2469 + switch data[p] { 2470 + case 39: 2471 + goto st42 2472 + case 43: 2473 + goto st13 2474 + case 46: 2475 + goto st13 2476 + case 47: 2477 + goto st5 2478 + case 58: 2479 + goto st14 2480 + case 95: 2481 + goto tr54 2482 + case 101: 2483 + goto tr103 2484 + } 2485 + switch { 2486 + case data[p] < 65: 2487 + if 45 <= data[p] && data[p] <= 57 { 2488 + goto tr52 2489 + } 2490 + case data[p] > 90: 2491 + if 97 <= data[p] && data[p] <= 122 { 2492 + goto tr52 2493 + } 2494 + default: 2495 + goto tr52 2496 + } 2497 + goto tr86 2498 + tr103: 2499 + //line NONE:1 2500 + te = p + 1 2501 + 2502 + //line machine.rl:71 2503 + act = 29 2504 + goto st61 2505 + st61: 2506 + if p++; p == pe { 2507 + goto _test_eof61 2508 + } 2509 + st_case_61: 2510 + //line machine.go:2346 2511 + switch data[p] { 2512 + case 39: 2513 + goto st42 2514 + case 43: 2515 + goto st13 2516 + case 46: 2517 + goto st13 2518 + case 47: 2519 + goto st5 2520 + case 58: 2521 + goto st14 2522 + case 95: 2523 + goto tr54 2524 + case 114: 2525 + goto tr104 2526 + } 2527 + switch { 2528 + case data[p] < 65: 2529 + if 45 <= data[p] && data[p] <= 57 { 2530 + goto tr52 2531 + } 2532 + case data[p] > 90: 2533 + if 97 <= data[p] && data[p] <= 122 { 2534 + goto tr52 2535 + } 2536 + default: 2537 + goto tr52 2538 + } 2539 + goto tr86 2540 + tr104: 2541 + //line NONE:1 2542 + te = p + 1 2543 + 2544 + //line machine.rl:71 2545 + act = 29 2546 + goto st62 2547 + st62: 2548 + if p++; p == pe { 2549 + goto _test_eof62 2550 + } 2551 + st_case_62: 2552 + //line machine.go:2388 2553 + switch data[p] { 2554 + case 39: 2555 + goto st42 2556 + case 43: 2557 + goto st13 2558 + case 46: 2559 + goto st13 2560 + case 47: 2561 + goto st5 2562 + case 58: 2563 + goto st14 2564 + case 95: 2565 + goto tr54 2566 + case 105: 2567 + goto tr105 2568 + } 2569 + switch { 2570 + case data[p] < 65: 2571 + if 45 <= data[p] && data[p] <= 57 { 2572 + goto tr52 2573 + } 2574 + case data[p] > 90: 2575 + if 97 <= data[p] && data[p] <= 122 { 2576 + goto tr52 2577 + } 2578 + default: 2579 + goto tr52 2580 + } 2581 + goto tr86 2582 + tr105: 2583 + //line NONE:1 2584 + te = p + 1 2585 + 2586 + //line machine.rl:71 2587 + act = 29 2588 + goto st63 2589 + st63: 2590 + if p++; p == pe { 2591 + goto _test_eof63 2592 + } 2593 + st_case_63: 2594 + //line machine.go:2430 2595 + switch data[p] { 2596 + case 39: 2597 + goto st42 2598 + case 43: 2599 + goto st13 2600 + case 46: 2601 + goto st13 2602 + case 47: 2603 + goto st5 2604 + case 58: 2605 + goto st14 2606 + case 95: 2607 + goto tr54 2608 + case 116: 2609 + goto tr106 2610 + } 2611 + switch { 2612 + case data[p] < 65: 2613 + if 45 <= data[p] && data[p] <= 57 { 2614 + goto tr52 2615 + } 2616 + case data[p] > 90: 2617 + if 97 <= data[p] && data[p] <= 122 { 2618 + goto tr52 2619 + } 2620 + default: 2621 + goto tr52 2622 + } 2623 + goto tr86 2624 + tr58: 2625 + //line NONE:1 2626 + te = p + 1 2627 + 2628 + //line machine.rl:71 2629 + act = 29 2630 + goto st64 2631 + st64: 2632 + if p++; p == pe { 2633 + goto _test_eof64 2634 + } 2635 + st_case_64: 2636 + //line machine.go:2472 2637 + switch data[p] { 2638 + case 39: 2639 + goto st42 2640 + case 43: 2641 + goto st13 2642 + case 46: 2643 + goto st13 2644 + case 47: 2645 + goto st5 2646 + case 58: 2647 + goto st14 2648 + case 95: 2649 + goto tr54 2650 + case 101: 2651 + goto tr107 2652 + } 2653 + switch { 2654 + case data[p] < 65: 2655 + if 45 <= data[p] && data[p] <= 57 { 2656 + goto tr52 2657 + } 2658 + case data[p] > 90: 2659 + if 97 <= data[p] && data[p] <= 122 { 2660 + goto tr52 2661 + } 2662 + default: 2663 + goto tr52 2664 + } 2665 + goto tr86 2666 + tr107: 2667 + //line NONE:1 2668 + te = p + 1 2669 + 2670 + //line machine.rl:71 2671 + act = 29 2672 + goto st65 2673 + st65: 2674 + if p++; p == pe { 2675 + goto _test_eof65 2676 + } 2677 + st_case_65: 2678 + //line machine.go:2514 2679 + switch data[p] { 2680 + case 39: 2681 + goto st42 2682 + case 43: 2683 + goto st13 2684 + case 46: 2685 + goto st13 2686 + case 47: 2687 + goto st5 2688 + case 58: 2689 + goto st14 2690 + case 95: 2691 + goto tr54 2692 + case 116: 2693 + goto tr108 2694 + } 2695 + switch { 2696 + case data[p] < 65: 2697 + if 45 <= data[p] && data[p] <= 57 { 2698 + goto tr52 2699 + } 2700 + case data[p] > 90: 2701 + if 97 <= data[p] && data[p] <= 122 { 2702 + goto tr52 2703 + } 2704 + default: 2705 + goto tr52 2706 + } 2707 + goto tr86 2708 + tr59: 2709 + //line NONE:1 2710 + te = p + 1 2711 + 2712 + //line machine.rl:71 2713 + act = 29 2714 + goto st66 2715 + st66: 2716 + if p++; p == pe { 2717 + goto _test_eof66 2718 + } 2719 + st_case_66: 2720 + //line machine.go:2556 2721 + switch data[p] { 2722 + case 39: 2723 + goto st42 2724 + case 43: 2725 + goto st13 2726 + case 46: 2727 + goto st13 2728 + case 47: 2729 + goto st5 2730 + case 58: 2731 + goto st14 2732 + case 95: 2733 + goto tr54 2734 + case 114: 2735 + goto tr109 2736 + } 2737 + switch { 2738 + case data[p] < 65: 2739 + if 45 <= data[p] && data[p] <= 57 { 2740 + goto tr52 2741 + } 2742 + case data[p] > 90: 2743 + if 97 <= data[p] && data[p] <= 122 { 2744 + goto tr52 2745 + } 2746 + default: 2747 + goto tr52 2748 + } 2749 + goto tr86 2750 + tr60: 2751 + //line NONE:1 2752 + te = p + 1 2753 + 2754 + //line machine.rl:71 2755 + act = 29 2756 + goto st67 2757 + st67: 2758 + if p++; p == pe { 2759 + goto _test_eof67 2760 + } 2761 + st_case_67: 2762 + //line machine.go:2598 2763 + switch data[p] { 2764 + case 39: 2765 + goto st42 2766 + case 43: 2767 + goto st13 2768 + case 46: 2769 + goto st13 2770 + case 47: 2771 + goto st5 2772 + case 58: 2773 + goto st14 2774 + case 95: 2775 + goto tr54 2776 + case 101: 2777 + goto tr110 2778 + } 2779 + switch { 2780 + case data[p] < 65: 2781 + if 45 <= data[p] && data[p] <= 57 { 2782 + goto tr52 2783 + } 2784 + case data[p] > 90: 2785 + if 97 <= data[p] && data[p] <= 122 { 2786 + goto tr52 2787 + } 2788 + default: 2789 + goto tr52 2790 + } 2791 + goto tr86 2792 + tr110: 2793 + //line NONE:1 2794 + te = p + 1 2795 + 2796 + //line machine.rl:71 2797 + act = 29 2798 + goto st68 2799 + st68: 2800 + if p++; p == pe { 2801 + goto _test_eof68 2802 + } 2803 + st_case_68: 2804 + //line machine.go:2640 2805 + switch data[p] { 2806 + case 39: 2807 + goto st42 2808 + case 43: 2809 + goto st13 2810 + case 46: 2811 + goto st13 2812 + case 47: 2813 + goto st5 2814 + case 58: 2815 + goto st14 2816 + case 95: 2817 + goto tr54 2818 + case 99: 2819 + goto tr111 2820 + } 2821 + switch { 2822 + case data[p] < 65: 2823 + if 45 <= data[p] && data[p] <= 57 { 2824 + goto tr52 2825 + } 2826 + case data[p] > 90: 2827 + if 97 <= data[p] && data[p] <= 122 { 2828 + goto tr52 2829 + } 2830 + default: 2831 + goto tr52 2832 + } 2833 + goto tr86 2834 + tr61: 2835 + //line NONE:1 2836 + te = p + 1 2837 + 2838 + //line machine.rl:71 2839 + act = 29 2840 + goto st69 2841 + st69: 2842 + if p++; p == pe { 2843 + goto _test_eof69 2844 + } 2845 + st_case_69: 2846 + //line machine.go:2682 2847 + switch data[p] { 2848 + case 39: 2849 + goto st42 2850 + case 43: 2851 + goto st13 2852 + case 46: 2853 + goto st13 2854 + case 47: 2855 + goto st5 2856 + case 58: 2857 + goto st14 2858 + case 95: 2859 + goto tr54 2860 + case 104: 2861 + goto tr112 2862 + } 2863 + switch { 2864 + case data[p] < 65: 2865 + if 45 <= data[p] && data[p] <= 57 { 2866 + goto tr52 2867 + } 2868 + case data[p] > 90: 2869 + if 97 <= data[p] && data[p] <= 122 { 2870 + goto tr52 2871 + } 2872 + default: 2873 + goto tr52 2874 + } 2875 + goto tr86 2876 + tr112: 2877 + //line NONE:1 2878 + te = p + 1 2879 + 2880 + //line machine.rl:71 2881 + act = 29 2882 + goto st70 2883 + st70: 2884 + if p++; p == pe { 2885 + goto _test_eof70 2886 + } 2887 + st_case_70: 2888 + //line machine.go:2724 2889 + switch data[p] { 2890 + case 39: 2891 + goto st42 2892 + case 43: 2893 + goto st13 2894 + case 46: 2895 + goto st13 2896 + case 47: 2897 + goto st5 2898 + case 58: 2899 + goto st14 2900 + case 95: 2901 + goto tr54 2902 + case 101: 2903 + goto tr113 2904 + } 2905 + switch { 2906 + case data[p] < 65: 2907 + if 45 <= data[p] && data[p] <= 57 { 2908 + goto tr52 2909 + } 2910 + case data[p] > 90: 2911 + if 97 <= data[p] && data[p] <= 122 { 2912 + goto tr52 2913 + } 2914 + default: 2915 + goto tr52 2916 + } 2917 + goto tr86 2918 + tr113: 2919 + //line NONE:1 2920 + te = p + 1 2921 + 2922 + //line machine.rl:71 2923 + act = 29 2924 + goto st71 2925 + st71: 2926 + if p++; p == pe { 2927 + goto _test_eof71 2928 + } 2929 + st_case_71: 2930 + //line machine.go:2766 2931 + switch data[p] { 2932 + case 39: 2933 + goto st42 2934 + case 43: 2935 + goto st13 2936 + case 46: 2937 + goto st13 2938 + case 47: 2939 + goto st5 2940 + case 58: 2941 + goto st14 2942 + case 95: 2943 + goto tr54 2944 + case 110: 2945 + goto tr114 2946 + } 2947 + switch { 2948 + case data[p] < 65: 2949 + if 45 <= data[p] && data[p] <= 57 { 2950 + goto tr52 2951 + } 2952 + case data[p] > 90: 2953 + if 97 <= data[p] && data[p] <= 122 { 2954 + goto tr52 2955 + } 2956 + default: 2957 + goto tr52 2958 + } 2959 + goto tr86 2960 + tr62: 2961 + //line NONE:1 2962 + te = p + 1 2963 + 2964 + //line machine.rl:71 2965 + act = 29 2966 + goto st72 2967 + st72: 2968 + if p++; p == pe { 2969 + goto _test_eof72 2970 + } 2971 + st_case_72: 2972 + //line machine.go:2808 2973 + switch data[p] { 2974 + case 39: 2975 + goto st42 2976 + case 43: 2977 + goto st13 2978 + case 46: 2979 + goto st13 2980 + case 47: 2981 + goto st5 2982 + case 58: 2983 + goto st14 2984 + case 95: 2985 + goto tr54 2986 + case 105: 2987 + goto tr115 2988 + } 2989 + switch { 2990 + case data[p] < 65: 2991 + if 45 <= data[p] && data[p] <= 57 { 2992 + goto tr52 2993 + } 2994 + case data[p] > 90: 2995 + if 97 <= data[p] && data[p] <= 122 { 2996 + goto tr52 2997 + } 2998 + default: 2999 + goto tr52 3000 + } 3001 + goto tr86 3002 + tr115: 3003 + //line NONE:1 3004 + te = p + 1 3005 + 3006 + //line machine.rl:71 3007 + act = 29 3008 + goto st73 3009 + st73: 3010 + if p++; p == pe { 3011 + goto _test_eof73 3012 + } 3013 + st_case_73: 3014 + //line machine.go:2850 3015 + switch data[p] { 3016 + case 39: 3017 + goto st42 3018 + case 43: 3019 + goto st13 3020 + case 46: 3021 + goto st13 3022 + case 47: 3023 + goto st5 3024 + case 58: 3025 + goto st14 3026 + case 95: 3027 + goto tr54 3028 + case 116: 3029 + goto tr116 3030 + } 3031 + switch { 3032 + case data[p] < 65: 3033 + if 45 <= data[p] && data[p] <= 57 { 3034 + goto tr52 3035 + } 3036 + case data[p] > 90: 3037 + if 97 <= data[p] && data[p] <= 122 { 3038 + goto tr52 3039 + } 3040 + default: 3041 + goto tr52 3042 + } 3043 + goto tr86 3044 + tr116: 3045 + //line NONE:1 3046 + te = p + 1 3047 + 3048 + //line machine.rl:71 3049 + act = 29 3050 + goto st74 3051 + st74: 3052 + if p++; p == pe { 3053 + goto _test_eof74 3054 + } 3055 + st_case_74: 3056 + //line machine.go:2892 3057 + switch data[p] { 3058 + case 39: 3059 + goto st42 3060 + case 43: 3061 + goto st13 3062 + case 46: 3063 + goto st13 3064 + case 47: 3065 + goto st5 3066 + case 58: 3067 + goto st14 3068 + case 95: 3069 + goto tr54 3070 + case 104: 3071 + goto tr117 3072 + } 3073 + switch { 3074 + case data[p] < 65: 3075 + if 45 <= data[p] && data[p] <= 57 { 3076 + goto tr52 3077 + } 3078 + case data[p] > 90: 3079 + if 97 <= data[p] && data[p] <= 122 { 3080 + goto tr52 3081 + } 3082 + default: 3083 + goto tr52 3084 + } 3085 + goto tr86 3086 + st75: 3087 + if p++; p == pe { 3088 + goto _test_eof75 3089 + } 3090 + st_case_75: 3091 + if data[p] == 124 { 3092 + goto tr118 3093 + } 3094 + goto tr66 3095 + tr65: 3096 + //line NONE:1 3097 + te = p + 1 3098 + 3099 + goto st76 3100 + st76: 3101 + if p++; p == pe { 3102 + goto _test_eof76 3103 + } 3104 + st_case_76: 3105 + //line machine.go:2941 3106 + if data[p] == 47 { 3107 + goto st15 3108 + } 3109 + goto tr66 3110 + st15: 3111 + if p++; p == pe { 3112 + goto _test_eof15 3113 + } 3114 + st_case_15: 3115 + switch data[p] { 3116 + case 43: 3117 + goto st77 3118 + case 95: 3119 + goto st77 3120 + } 3121 + switch { 3122 + case data[p] < 48: 3123 + if 45 <= data[p] && data[p] <= 46 { 3124 + goto st77 3125 + } 3126 + case data[p] > 57: 3127 + switch { 3128 + case data[p] > 90: 3129 + if 97 <= data[p] && data[p] <= 122 { 3130 + goto st77 3131 + } 3132 + case data[p] >= 65: 3133 + goto st77 3134 + } 3135 + default: 3136 + goto st77 3137 + } 3138 + goto tr0 3139 + st77: 3140 + if p++; p == pe { 3141 + goto _test_eof77 3142 + } 3143 + st_case_77: 3144 + switch data[p] { 3145 + case 43: 3146 + goto st77 3147 + case 47: 3148 + goto st78 3149 + case 95: 3150 + goto st77 3151 + } 3152 + switch { 3153 + case data[p] < 65: 3154 + if 45 <= data[p] && data[p] <= 57 { 3155 + goto st77 3156 + } 3157 + case data[p] > 90: 3158 + if 97 <= data[p] && data[p] <= 122 { 3159 + goto st77 3160 + } 3161 + default: 3162 + goto st77 3163 + } 3164 + goto tr120 3165 + st78: 3166 + if p++; p == pe { 3167 + goto _test_eof78 3168 + } 3169 + st_case_78: 3170 + switch data[p] { 3171 + case 43: 3172 + goto st77 3173 + case 95: 3174 + goto st77 3175 + } 3176 + switch { 3177 + case data[p] < 48: 3178 + if 45 <= data[p] && data[p] <= 46 { 3179 + goto st77 3180 + } 3181 + case data[p] > 57: 3182 + switch { 3183 + case data[p] > 90: 3184 + if 97 <= data[p] && data[p] <= 122 { 3185 + goto st77 3186 + } 3187 + case data[p] >= 65: 3188 + goto st77 3189 + } 3190 + default: 3191 + goto st77 3192 + } 3193 + goto tr120 3194 + tr22: 3195 + //line machine.rl:32 3196 + p = (te) - 1 3197 + { 3198 + tok(text) 3199 + addLines() 3200 + } 3201 + goto st79 3202 + tr24: 3203 + //line NONE:1 3204 + switch act { 3205 + case 0: 3206 + { 3207 + { 3208 + goto st0 3209 + } 3210 + } 3211 + case 3: 3212 + { 3213 + p = (te) - 1 3214 + tok(text) 3215 + addLines() 3216 + } 3217 + } 3218 + 3219 + goto st79 3220 + tr122: 3221 + //line machine.rl:30 3222 + te = p + 1 3223 + { 3224 + if !tokleave('"') { 3225 + return 3226 + } 3227 + { 3228 + top-- 3229 + cs = stack[top] 3230 + goto _again 3231 + } 3232 + } 3233 + goto st79 3234 + tr125: 3235 + //line machine.rl:32 3236 + te = p 3237 + p-- 3238 + { 3239 + tok(text) 3240 + addLines() 3241 + } 3242 + goto st79 3243 + tr127: 3244 + //line machine.rl:33 3245 + te = p 3246 + p-- 3247 + { 3248 + tok(text) 3249 + } 3250 + goto st79 3251 + tr128: 3252 + //line machine.rl:31 3253 + te = p + 1 3254 + { 3255 + tokenter(interp, '}') 3256 + { 3257 + if nostack() { 3258 + return 3259 + } 3260 + { 3261 + stack[top] = 79 3262 + top++ 3263 + goto st22 3264 + } 3265 + } 3266 + } 3267 + goto st79 3268 + st79: 3269 + //line NONE:1 3270 + ts = 0 3271 + 3272 + //line NONE:1 3273 + act = 0 3274 + 3275 + if p++; p == pe { 3276 + goto _test_eof79 3277 + } 3278 + st_case_79: 3279 + //line NONE:1 3280 + ts = p 3281 + 3282 + //line machine.go:3082 3283 + switch data[p] { 3284 + case 34: 3285 + goto tr122 3286 + case 36: 3287 + goto st81 3288 + case 92: 3289 + goto st17 3290 + } 3291 + goto tr23 3292 + tr23: 3293 + //line NONE:1 3294 + te = p + 1 3295 + 3296 + //line machine.rl:32 3297 + act = 3 3298 + goto st80 3299 + st80: 3300 + if p++; p == pe { 3301 + goto _test_eof80 3302 + } 3303 + st_case_80: 3304 + //line machine.go:3104 3305 + switch data[p] { 3306 + case 34: 3307 + goto tr125 3308 + case 36: 3309 + goto st16 3310 + case 92: 3311 + goto st17 3312 + } 3313 + goto tr23 3314 + st16: 3315 + if p++; p == pe { 3316 + goto _test_eof16 3317 + } 3318 + st_case_16: 3319 + switch data[p] { 3320 + case 34: 3321 + goto tr22 3322 + case 123: 3323 + goto tr22 3324 + } 3325 + goto tr23 3326 + st17: 3327 + if p++; p == pe { 3328 + goto _test_eof17 3329 + } 3330 + st_case_17: 3331 + goto tr23 3332 + st81: 3333 + if p++; p == pe { 3334 + goto _test_eof81 3335 + } 3336 + st_case_81: 3337 + switch data[p] { 3338 + case 34: 3339 + goto tr127 3340 + case 123: 3341 + goto tr128 3342 + } 3343 + goto tr23 3344 + tr25: 3345 + //line machine.rl:42 3346 + p = (te) - 1 3347 + { 3348 + tok(text) 3349 + addLines() 3350 + } 3351 + goto st82 3352 + tr29: 3353 + //line NONE:1 3354 + switch act { 3355 + case 5: 3356 + { 3357 + p = (te) - 1 3358 + if !tokleave(ii) { 3359 + return 3360 + } 3361 + { 3362 + top-- 3363 + cs = stack[top] 3364 + goto _again 3365 + } 3366 + } 3367 + case 7: 3368 + { 3369 + p = (te) - 1 3370 + tok(text) 3371 + addLines() 3372 + } 3373 + } 3374 + 3375 + goto st82 3376 + tr131: 3377 + //line machine.rl:42 3378 + te = p 3379 + p-- 3380 + { 3381 + tok(text) 3382 + addLines() 3383 + } 3384 + goto st82 3385 + tr134: 3386 + //line machine.rl:43 3387 + te = p 3388 + p-- 3389 + { 3390 + tok(text) 3391 + } 3392 + goto st82 3393 + tr135: 3394 + //line machine.rl:41 3395 + te = p + 1 3396 + { 3397 + tokenter(interp, '}') 3398 + { 3399 + if nostack() { 3400 + return 3401 + } 3402 + { 3403 + stack[top] = 82 3404 + top++ 3405 + goto st22 3406 + } 3407 + } 3408 + } 3409 + goto st82 3410 + tr137: 3411 + //line machine.rl:40 3412 + te = p 3413 + p-- 3414 + { 3415 + if !tokleave(ii) { 3416 + return 3417 + } 3418 + { 3419 + top-- 3420 + cs = stack[top] 3421 + goto _again 3422 + } 3423 + } 3424 + goto st82 3425 + st82: 3426 + //line NONE:1 3427 + ts = 0 3428 + 3429 + if p++; p == pe { 3430 + goto _test_eof82 3431 + } 3432 + st_case_82: 3433 + //line NONE:1 3434 + ts = p 3435 + 3436 + //line machine.go:3195 3437 + switch data[p] { 3438 + case 36: 3439 + goto st84 3440 + case 39: 3441 + goto st85 3442 + } 3443 + goto tr26 3444 + tr26: 3445 + //line NONE:1 3446 + te = p + 1 3447 + 3448 + //line machine.rl:42 3449 + act = 7 3450 + goto st83 3451 + st83: 3452 + if p++; p == pe { 3453 + goto _test_eof83 3454 + } 3455 + st_case_83: 3456 + //line machine.go:3215 3457 + switch data[p] { 3458 + case 36: 3459 + goto st18 3460 + case 39: 3461 + goto st19 3462 + } 3463 + goto tr26 3464 + st18: 3465 + if p++; p == pe { 3466 + goto _test_eof18 3467 + } 3468 + st_case_18: 3469 + switch data[p] { 3470 + case 39: 3471 + goto tr25 3472 + case 123: 3473 + goto tr25 3474 + } 3475 + goto tr26 3476 + st19: 3477 + if p++; p == pe { 3478 + goto _test_eof19 3479 + } 3480 + st_case_19: 3481 + switch data[p] { 3482 + case 36: 3483 + goto tr25 3484 + case 39: 3485 + goto st20 3486 + } 3487 + goto tr26 3488 + st20: 3489 + if p++; p == pe { 3490 + goto _test_eof20 3491 + } 3492 + st_case_20: 3493 + switch data[p] { 3494 + case 36: 3495 + goto tr26 3496 + case 39: 3497 + goto tr26 3498 + case 92: 3499 + goto st21 3500 + } 3501 + goto tr25 3502 + st21: 3503 + if p++; p == pe { 3504 + goto _test_eof21 3505 + } 3506 + st_case_21: 3507 + goto tr26 3508 + st84: 3509 + if p++; p == pe { 3510 + goto _test_eof84 3511 + } 3512 + st_case_84: 3513 + switch data[p] { 3514 + case 39: 3515 + goto tr134 3516 + case 123: 3517 + goto tr135 3518 + } 3519 + goto tr26 3520 + st85: 3521 + if p++; p == pe { 3522 + goto _test_eof85 3523 + } 3524 + st_case_85: 3525 + switch data[p] { 3526 + case 36: 3527 + goto tr134 3528 + case 39: 3529 + goto tr136 3530 + } 3531 + goto tr26 3532 + tr136: 3533 + //line NONE:1 3534 + te = p + 1 3535 + 3536 + //line machine.rl:40 3537 + act = 5 3538 + goto st86 3539 + st86: 3540 + if p++; p == pe { 3541 + goto _test_eof86 3542 + } 3543 + st_case_86: 3544 + //line machine.go:3303 3545 + switch data[p] { 3546 + case 36: 3547 + goto tr26 3548 + case 39: 3549 + goto tr26 3550 + case 92: 3551 + goto st21 3552 + } 3553 + goto tr137 3554 + st_case_0: 3555 + st0: 3556 + cs = 0 3557 + goto _out 3558 + st_out: 3559 + _test_eof22: 3560 + cs = 22 3561 + goto _test_eof 3562 + _test_eof23: 3563 + cs = 23 3564 + goto _test_eof 3565 + _test_eof1: 3566 + cs = 1 3567 + goto _test_eof 3568 + _test_eof24: 3569 + cs = 24 3570 + goto _test_eof 3571 + _test_eof2: 3572 + cs = 2 3573 + goto _test_eof 3574 + _test_eof3: 3575 + cs = 3 3576 + goto _test_eof 3577 + _test_eof25: 3578 + cs = 25 3579 + goto _test_eof 3580 + _test_eof26: 3581 + cs = 26 3582 + goto _test_eof 3583 + _test_eof27: 3584 + cs = 27 3585 + goto _test_eof 3586 + _test_eof28: 3587 + cs = 28 3588 + goto _test_eof 3589 + _test_eof29: 3590 + cs = 29 3591 + goto _test_eof 3592 + _test_eof30: 3593 + cs = 30 3594 + goto _test_eof 3595 + _test_eof31: 3596 + cs = 31 3597 + goto _test_eof 3598 + _test_eof32: 3599 + cs = 32 3600 + goto _test_eof 3601 + _test_eof33: 3602 + cs = 33 3603 + goto _test_eof 3604 + _test_eof4: 3605 + cs = 4 3606 + goto _test_eof 3607 + _test_eof5: 3608 + cs = 5 3609 + goto _test_eof 3610 + _test_eof34: 3611 + cs = 34 3612 + goto _test_eof 3613 + _test_eof35: 3614 + cs = 35 3615 + goto _test_eof 3616 + _test_eof36: 3617 + cs = 36 3618 + goto _test_eof 3619 + _test_eof37: 3620 + cs = 37 3621 + goto _test_eof 3622 + _test_eof6: 3623 + cs = 6 3624 + goto _test_eof 3625 + _test_eof38: 3626 + cs = 38 3627 + goto _test_eof 3628 + _test_eof7: 3629 + cs = 7 3630 + goto _test_eof 3631 + _test_eof8: 3632 + cs = 8 3633 + goto _test_eof 3634 + _test_eof39: 3635 + cs = 39 3636 + goto _test_eof 3637 + _test_eof40: 3638 + cs = 40 3639 + goto _test_eof 3640 + _test_eof9: 3641 + cs = 9 3642 + goto _test_eof 3643 + _test_eof10: 3644 + cs = 10 3645 + goto _test_eof 3646 + _test_eof41: 3647 + cs = 41 3648 + goto _test_eof 3649 + _test_eof42: 3650 + cs = 42 3651 + goto _test_eof 3652 + _test_eof43: 3653 + cs = 43 3654 + goto _test_eof 3655 + _test_eof44: 3656 + cs = 44 3657 + goto _test_eof 3658 + _test_eof45: 3659 + cs = 45 3660 + goto _test_eof 3661 + _test_eof11: 3662 + cs = 11 3663 + goto _test_eof 3664 + _test_eof12: 3665 + cs = 12 3666 + goto _test_eof 3667 + _test_eof46: 3668 + cs = 46 3669 + goto _test_eof 3670 + _test_eof47: 3671 + cs = 47 3672 + goto _test_eof 3673 + _test_eof48: 3674 + cs = 48 3675 + goto _test_eof 3676 + _test_eof13: 3677 + cs = 13 3678 + goto _test_eof 3679 + _test_eof14: 3680 + cs = 14 3681 + goto _test_eof 3682 + _test_eof49: 3683 + cs = 49 3684 + goto _test_eof 3685 + _test_eof50: 3686 + cs = 50 3687 + goto _test_eof 3688 + _test_eof51: 3689 + cs = 51 3690 + goto _test_eof 3691 + _test_eof52: 3692 + cs = 52 3693 + goto _test_eof 3694 + _test_eof53: 3695 + cs = 53 3696 + goto _test_eof 3697 + _test_eof54: 3698 + cs = 54 3699 + goto _test_eof 3700 + _test_eof55: 3701 + cs = 55 3702 + goto _test_eof 3703 + _test_eof56: 3704 + cs = 56 3705 + goto _test_eof 3706 + _test_eof57: 3707 + cs = 57 3708 + goto _test_eof 3709 + _test_eof58: 3710 + cs = 58 3711 + goto _test_eof 3712 + _test_eof59: 3713 + cs = 59 3714 + goto _test_eof 3715 + _test_eof60: 3716 + cs = 60 3717 + goto _test_eof 3718 + _test_eof61: 3719 + cs = 61 3720 + goto _test_eof 3721 + _test_eof62: 3722 + cs = 62 3723 + goto _test_eof 3724 + _test_eof63: 3725 + cs = 63 3726 + goto _test_eof 3727 + _test_eof64: 3728 + cs = 64 3729 + goto _test_eof 3730 + _test_eof65: 3731 + cs = 65 3732 + goto _test_eof 3733 + _test_eof66: 3734 + cs = 66 3735 + goto _test_eof 3736 + _test_eof67: 3737 + cs = 67 3738 + goto _test_eof 3739 + _test_eof68: 3740 + cs = 68 3741 + goto _test_eof 3742 + _test_eof69: 3743 + cs = 69 3744 + goto _test_eof 3745 + _test_eof70: 3746 + cs = 70 3747 + goto _test_eof 3748 + _test_eof71: 3749 + cs = 71 3750 + goto _test_eof 3751 + _test_eof72: 3752 + cs = 72 3753 + goto _test_eof 3754 + _test_eof73: 3755 + cs = 73 3756 + goto _test_eof 3757 + _test_eof74: 3758 + cs = 74 3759 + goto _test_eof 3760 + _test_eof75: 3761 + cs = 75 3762 + goto _test_eof 3763 + _test_eof76: 3764 + cs = 76 3765 + goto _test_eof 3766 + _test_eof15: 3767 + cs = 15 3768 + goto _test_eof 3769 + _test_eof77: 3770 + cs = 77 3771 + goto _test_eof 3772 + _test_eof78: 3773 + cs = 78 3774 + goto _test_eof 3775 + _test_eof79: 3776 + cs = 79 3777 + goto _test_eof 3778 + _test_eof80: 3779 + cs = 80 3780 + goto _test_eof 3781 + _test_eof16: 3782 + cs = 16 3783 + goto _test_eof 3784 + _test_eof17: 3785 + cs = 17 3786 + goto _test_eof 3787 + _test_eof81: 3788 + cs = 81 3789 + goto _test_eof 3790 + _test_eof82: 3791 + cs = 82 3792 + goto _test_eof 3793 + _test_eof83: 3794 + cs = 83 3795 + goto _test_eof 3796 + _test_eof18: 3797 + cs = 18 3798 + goto _test_eof 3799 + _test_eof19: 3800 + cs = 19 3801 + goto _test_eof 3802 + _test_eof20: 3803 + cs = 20 3804 + goto _test_eof 3805 + _test_eof21: 3806 + cs = 21 3807 + goto _test_eof 3808 + _test_eof84: 3809 + cs = 84 3810 + goto _test_eof 3811 + _test_eof85: 3812 + cs = 85 3813 + goto _test_eof 3814 + _test_eof86: 3815 + cs = 86 3816 + goto _test_eof 3817 + 3818 + _test_eof: 3819 + { 3820 + } 3821 + if p == eof { 3822 + switch cs { 3823 + case 23: 3824 + goto tr66 3825 + case 1: 3826 + goto tr0 3827 + case 24: 3828 + goto tr68 3829 + case 2: 3830 + goto tr2 3831 + case 3: 3832 + goto tr2 3833 + case 25: 3834 + goto tr68 3835 + case 26: 3836 + goto tr70 3837 + case 27: 3838 + goto tr66 3839 + case 28: 3840 + goto tr72 3841 + case 29: 3842 + goto tr66 3843 + case 30: 3844 + goto tr66 3845 + case 31: 3846 + goto tr66 3847 + case 32: 3848 + goto tr66 3849 + case 33: 3850 + goto tr5 3851 + case 4: 3852 + goto tr5 3853 + case 5: 3854 + goto tr5 3855 + case 34: 3856 + goto tr77 3857 + case 35: 3858 + goto tr77 3859 + case 36: 3860 + goto tr66 3861 + case 37: 3862 + goto tr66 3863 + case 6: 3864 + goto tr0 3865 + case 38: 3866 + goto tr68 3867 + case 7: 3868 + goto tr2 3869 + case 8: 3870 + goto tr2 3871 + case 39: 3872 + goto tr68 3873 + case 40: 3874 + goto tr66 3875 + case 9: 3876 + goto tr0 3877 + case 10: 3878 + goto tr0 3879 + case 41: 3880 + goto tr84 3881 + case 42: 3882 + goto tr86 3883 + case 43: 3884 + goto tr86 3885 + case 44: 3886 + goto tr84 3887 + case 45: 3888 + goto tr66 3889 + case 11: 3890 + goto tr0 3891 + case 12: 3892 + goto tr0 3893 + case 46: 3894 + goto tr66 3895 + case 47: 3896 + goto tr66 3897 + case 48: 3898 + goto tr5 3899 + case 13: 3900 + goto tr5 3901 + case 14: 3902 + goto tr5 3903 + case 49: 3904 + goto tr90 3905 + case 50: 3906 + goto tr86 3907 + case 51: 3908 + goto tr86 3909 + case 52: 3910 + goto tr86 3911 + case 53: 3912 + goto tr86 3913 + case 54: 3914 + goto tr86 3915 + case 55: 3916 + goto tr86 3917 + case 56: 3918 + goto tr86 3919 + case 57: 3920 + goto tr86 3921 + case 58: 3922 + goto tr86 3923 + case 59: 3924 + goto tr101 3925 + case 60: 3926 + goto tr86 3927 + case 61: 3928 + goto tr86 3929 + case 62: 3930 + goto tr86 3931 + case 63: 3932 + goto tr86 3933 + case 64: 3934 + goto tr86 3935 + case 65: 3936 + goto tr86 3937 + case 66: 3938 + goto tr86 3939 + case 67: 3940 + goto tr86 3941 + case 68: 3942 + goto tr86 3943 + case 69: 3944 + goto tr86 3945 + case 70: 3946 + goto tr86 3947 + case 71: 3948 + goto tr86 3949 + case 72: 3950 + goto tr86 3951 + case 73: 3952 + goto tr86 3953 + case 74: 3954 + goto tr86 3955 + case 75: 3956 + goto tr66 3957 + case 76: 3958 + goto tr66 3959 + case 15: 3960 + goto tr0 3961 + case 77: 3962 + goto tr120 3963 + case 78: 3964 + goto tr120 3965 + case 80: 3966 + goto tr125 3967 + case 16: 3968 + goto tr22 3969 + case 17: 3970 + goto tr24 3971 + case 81: 3972 + goto tr127 3973 + case 83: 3974 + goto tr131 3975 + case 18: 3976 + goto tr25 3977 + case 19: 3978 + goto tr25 3979 + case 20: 3980 + goto tr25 3981 + case 21: 3982 + goto tr29 3983 + case 84: 3984 + goto tr134 3985 + case 85: 3986 + goto tr134 3987 + case 86: 3988 + goto tr137 3989 + } 3990 + } 3991 + 3992 + _out: 3993 + { 3994 + } 3995 + } 3996 + 3997 + //line machine.rl:170 3998 + 3999 + if p != eof { 4000 + err = r.Errorf("precedes the token that failed to lex") 4001 + } else if len(backrefs) != 0 { 4002 + iprev, _ := backrefs.Pop() 4003 + prev := r.Tokens[iprev] 4004 + err = fmt.Errorf("%s%s is not terminated", r.At(prev.Pos), symString(prev.Sym)) 4005 + } 4006 + return 4007 + }
+179
pkg/parser/machine.rl
···
··· 1 + // compile-command: "ragel -Z -G2 machine.rl" 2 + 3 + package parser 4 + 5 + import "fmt" 6 + 7 + const maxstack = 64 8 + 9 + %%{ 10 + 11 + machine expr; 12 + 13 + 14 + prepush { if nostack() { return }; } 15 + 16 + Space = [ \t\r\n]+; 17 + Comment1 = "#" [^\r\n]*; 18 + Comment2 = "/*" any* :>> "*/"; 19 + URI = [a-zA-Z] [a-zA-Z0-9.+\-]* ":" [a-zA-Z0-9%/?:@&=+$,_.!~*'\-]+; 20 + Path = [a-zA-Z0-9._+\-]* ([/] [a-zA-Z0-9._+\-]+)+ [/]?; 21 + HPath = "~" ([/] [a-zA-Z0-9._+\-]+)+ [/]?; 22 + SPath = "<" [a-zA-Z0-9._+\-]+ ([/] [a-zA-Z0-9._+\-]+)* ">"; 23 + ID = [a-zA-Z0-9_] [a-zA-Z0-9_'\-]*; 24 + Float = (([1-9] [0-9]* [.] [0-9]*) | (0? [.] [0-9]+)) ([Ee] [+\-]? [0-9]+)?; 25 + Int = [0-9]+; 26 + 27 + 28 + qstring := |* 29 + 30 + ["] => { if !tokleave('"') { return }; fret; }; 31 + "${" => { tokenter(interp, '}'); fcall expr; }; 32 + ( [^$"\\] | /[$][^{"]/ | /\\./ )+ => { tok(text); addLines() }; 33 + "$" => { tok(text) }; 34 + 35 + *|; 36 + 37 + 38 + istring := |* 39 + 40 + "''" => { if !tokleave(ii) { return }; fret; }; 41 + "${" => { tokenter(interp, '}'); fcall expr; }; 42 + ( [^'$] | "'''" | "''$" | /''\\./ | /'[^'$]/ | /[$][^{']/ )+ => { tok(text); addLines() }; 43 + ['$] => { tok(text) }; 44 + 45 + *|; 46 + 47 + 48 + expr := |* 49 + 50 + "assert" => { tok(assert_) }; 51 + "else" => { tok(else_) }; 52 + "if" => { tok(if_) }; 53 + "in" => { tok(in) }; 54 + "inherit" => { tok(inherit) }; 55 + "let" => { tok(let) }; 56 + "or" => { tok(or_) }; 57 + "rec" => { tok(rec) }; 58 + "then" => { tok(then) }; 59 + "with" => { tok(with) }; 60 + 61 + [ \t\r]+; 62 + "\n" => { r.File.AddLine(ts) }; 63 + Comment1 => { tokcomment(comment) }; 64 + Comment2 => { tokcomment(comment); addLines() }; 65 + URI => { tok(uri) }; 66 + Path => { tok(path) }; 67 + HPath => { tok(path) }; 68 + SPath => { tok(path) }; 69 + Float => { tok(float) }; 70 + Int => { tok(int_) }; 71 + ID => { tok(id) }; 72 + 73 + "..." => { tok(ellipsis) }; 74 + "->" => { tok(impl) }; 75 + "||" => { tok(or) }; 76 + "&&" => { tok(and) }; 77 + "==" => { tok(eq) }; 78 + "!=" => { tok(neq) }; 79 + "<=" => { tok(leq) }; 80 + ">=" => { tok(geq) }; 81 + "//" => { tok(update) }; 82 + "++" => { tok(concat) }; 83 + 84 + ["] => { tokenter('"', '"'); fcall qstring; }; 85 + "''" => { tokenter(ii, ii); fcall istring; }; 86 + 87 + "${" => { tokenter(interp, '}'); fcall expr; }; 88 + "(" => { tokenter('(', ')'); fcall expr; }; 89 + "[" => { tokenter('[', ']'); fcall expr; }; 90 + "{" => { tokenter('{', '}'); fcall expr; }; 91 + [}\])] => { if !tokleave(int(data[ts])) { return }; fret; }; 92 + 93 + [@:] => { if !tokarg() { return }; }; 94 + 95 + any => { tok(int(data[ts])) }; 96 + 97 + *|; 98 + 99 + }%% 100 + 101 + %% write data; 102 + 103 + func lexData(data []byte, r *LexResult) (err error) { 104 + var cs, act, ts, te, top int 105 + var stack [maxstack]int 106 + p, pe := 0, len(data) 107 + eof := pe 108 + %% write init; 109 + _, _, _, _, _ = expr_first_final, expr_error, expr_en_qstring, expr_en_istring, expr_en_expr 110 + if r.File == nil { 111 + r.File = fileset.AddFile("(string)", -1, len(data)) 112 + } 113 + if r.Data == nil { 114 + r.Data = data 115 + } else { 116 + r.Data = append(r.Data, data...) 117 + } 118 + nostack := func() bool { 119 + if top != maxstack { 120 + return false 121 + } 122 + err = r.Errorf("exceeds recursion limit") 123 + return true 124 + } 125 + tok := func(sym int) { r.Tokens = append(r.Tokens, lexerToken{Sym: sym, Pos: ts, End: te}) } 126 + tokcomment := func(sym int) { r.Comments = append(r.Comments, lexerToken{Sym: sym, Pos: ts, End: te}) } 127 + var backrefs Backrefs 128 + tokenter := func(sym, fin int) { backrefs.Push(len(r.Tokens), fin); tok(sym); } 129 + tokleave := func(sym int) bool { 130 + tok(sym) 131 + if top == 0 || len(backrefs) == 0 { 132 + err = r.Errorf("does not close anything") 133 + return false 134 + } 135 + iprev, prevsym := backrefs.Pop() 136 + if prevsym != sym { 137 + err = r.Errorf("does not close %v", r.Tokens[iprev]) 138 + return false 139 + } 140 + r.Tokens[len(r.Tokens)-1].Prev = iprev 141 + return true 142 + } 143 + tokarg := func() bool { 144 + tok(int(data[ts])) 145 + if len(r.Tokens) == 1 { 146 + err = r.Errorf("does not follow anything") 147 + return false 148 + } 149 + prev := &r.Tokens[len(r.Tokens)-2] 150 + switch prev.Sym { 151 + case id: 152 + prev.Sym = argID 153 + case '}': 154 + r.Tokens[prev.Prev].Sym = argBracket 155 + default: 156 + err = r.Errorf("does not follow an argument of a function") 157 + return false 158 + } 159 + return true 160 + } 161 + addLines := func() { 162 + for i := ts; i < te; i++ { 163 + if data[i] == '\n' { 164 + r.File.AddLine(i) 165 + } 166 + } 167 + } 168 + 169 + %% write exec; 170 + 171 + if p != eof { 172 + err = r.Errorf("precedes the token that failed to lex") 173 + } else if len(backrefs) != 0 { 174 + iprev, _ := backrefs.Pop() 175 + prev := r.Tokens[iprev] 176 + err = fmt.Errorf("%s%s is not terminated", r.At(prev.Pos), symString(prev.Sym)) 177 + } 178 + return 179 + }
+218
pkg/parser/nix.y
···
··· 1 + %{ 2 + package parser 3 + %} 4 + 5 + %union { 6 + token int 7 + node *Node 8 + } 9 + 10 + %type <node> 11 + Expression Interp String ID Atom Select Apply Op InterpID AttrPath List Binds InheritList Function ArgSet Arg 12 + 13 + %token <token> 14 + assert_ if_ then else_ let in with or_ rec inherit ellipsis interp space comment ii 15 + uri path float int_ id text argID argBracket 16 + ':' '@' ',' ';' '"' '.' '(' ')' '[' ']' '{' '}' '=' 17 + 18 + %right <token> impl 19 + %left <token> or 20 + %left <token> and 21 + %nonassoc <token> eq neq 22 + %left <token> '<' '>' leq geq 23 + %right <token> update 24 + %nonassoc <token> '!' 25 + %left <token> '+' '-' 26 + %left <token> '*' '/' 27 + %right <token> concat 28 + %nonassoc <token> '?' 29 + %nonassoc <token> negate 30 + 31 + %% 32 + 33 + Main 34 + : Expression 35 + { p.Result = $1 } 36 + ; 37 + 38 + Expression 39 + : Op 40 + | assert_ Expression ';' Expression 41 + { $$ = p.NewNode(AssertNode, $1, $3).N2($2, $4) } 42 + | if_ Expression then Expression else_ Expression 43 + { $$ = p.NewNode(IfNode, $1, $3, $5).N3($2, $4, $6) } 44 + | let Binds in Expression 45 + { $$ = p.NewNode(LetNode, $1, $3).N2($2, $4) } 46 + | with Expression ';' Expression 47 + { $$ = p.NewNode(WithNode, $1, $3).N2($2, $4) } 48 + | Function 49 + ; 50 + 51 + Interp 52 + : interp Expression '}' 53 + { $$ = p.NewNode(InterpNode, $1, $3).N1($2) } 54 + ; 55 + 56 + String 57 + : 58 + { $$ = p.NewNode(StringNode) } 59 + | String text 60 + { $$ = $1.N1(p.NewNode(TextNode, $2)) } 61 + | String Interp 62 + { $$ = $1.N1($2) } 63 + ; 64 + 65 + ID 66 + : id 67 + { $$ = p.NewNode(IDNode, $1) } 68 + ; 69 + 70 + Atom 71 + : uri 72 + { $$ = p.NewNode(URINode, $1) } 73 + | path 74 + { $$ = p.NewNode(PathNode, $1) } 75 + | float 76 + { $$ = p.NewNode(FloatNode, $1) } 77 + | int_ 78 + { $$ = p.NewNode(IntNode, $1) } 79 + | ID 80 + | '"' String '"' 81 + { $$ = $2.T2($1, $3) } 82 + | ii String ii 83 + { $$ = $2.T2($1, $3).SetType(IStringNode) } 84 + | '(' Expression ')' 85 + { $$ = p.NewNode(ParensNode, $1, $3).N1($2) } 86 + | '[' List ']' 87 + { $$ = $2.T2($1, $3) } 88 + | '{' Binds '}' 89 + { $$ = $2.T2($1, $3).SetType(SetNode) } 90 + | rec '{' Binds '}' 91 + { $$ = $3.T3($1, $2, $4).SetType(RecSetNode) } 92 + ; 93 + 94 + Select 95 + : Atom 96 + | Atom '.' AttrPath 97 + { $$ = p.NewNode(SelectNode, $2).N2($1, $3) } 98 + | Atom '.' AttrPath or_ Select 99 + { $$ = p.NewNode(SelectOrNode, $2, $4).N3($1, $3, $5) } 100 + ; 101 + 102 + Apply 103 + : Select 104 + | Apply Select 105 + { $$ = p.NewNode(ApplyNode).N2($1, $2) } 106 + ; 107 + 108 + Op 109 + : Apply 110 + | '-' Op %prec negate 111 + { $$ = p.Op(negate, $1).N1($2) } 112 + | Op '?' AttrPath 113 + { $$ = p.Op('?', $2).N2($1, $3) } 114 + | Op concat Op 115 + { $$ = p.Op(concat, $2).N2($1, $3) } 116 + | Op '/' Op 117 + { $$ = p.Op('/', $2).N2($1, $3) } 118 + | Op '*' Op 119 + { $$ = p.Op('*', $2).N2($1, $3) } 120 + | Op '-' Op 121 + { $$ = p.Op('-', $2).N2($1, $3) } 122 + | Op '+' Op 123 + { $$ = p.Op('+', $2).N2($1, $3) } 124 + | '!' Op 125 + { $$ = p.Op('!', $1).N1($2) } 126 + | Op update Op 127 + { $$ = p.Op(update, $2).N2($1, $3) } 128 + | Op geq Op 129 + { $$ = p.Op(geq, $2).N2($1, $3) } 130 + | Op leq Op 131 + { $$ = p.Op(leq, $2).N2($1, $3) } 132 + | Op '>' Op 133 + { $$ = p.Op('>', $2).N2($1, $3) } 134 + | Op '<' Op 135 + { $$ = p.Op('<', $2).N2($1, $3) } 136 + | Op neq Op 137 + { $$ = p.Op(neq, $2).N2($1, $3) } 138 + | Op eq Op 139 + { $$ = p.Op(eq, $2).N2($1, $3) } 140 + | Op and Op 141 + { $$ = p.Op(and, $2).N2($1, $3) } 142 + | Op or Op 143 + { $$ = p.Op(or, $2).N2($1, $3) } 144 + | Op impl Op 145 + { $$ = p.Op(impl, $2).N2($1, $3) } 146 + ; 147 + 148 + InterpID 149 + : ID 150 + | or_ 151 + { $$ = p.NewNode(IDNode, $1) } 152 + | Interp 153 + | '"' String '"' 154 + { $$ = $2.T2($1, $3) } 155 + ; 156 + 157 + AttrPath 158 + : InterpID 159 + { $$ = p.NewNode(AttrPathNode).N1($1) } 160 + | AttrPath '.' InterpID 161 + { $$ = $1.T1($2).N1($3) } 162 + ; 163 + 164 + List 165 + : 166 + { $$ = p.NewNode(ListNode) } 167 + | List Select 168 + { $$ = $1.N1($2) } 169 + ; 170 + 171 + Binds 172 + : 173 + { $$ = p.NewNode(BindsNode) } 174 + | Binds AttrPath '=' Expression ';' 175 + { $$ = $1.N1(p.NewNode(BindNode, $3, $5).N2($2, $4)) } 176 + | Binds inherit InheritList ';' 177 + { $$ = $1.N1(p.NewNode(InheritNode, $2, $4).N1($3)) } 178 + | Binds inherit '(' Expression ')' InheritList ';' 179 + { $$ = $1.N1(p.NewNode(InheritFromNode, $2, $3, $5, $7).N2($4, $6)) } 180 + ; 181 + 182 + InheritList 183 + : 184 + { $$ = p.NewNode(InheritListNode) } 185 + | InheritList InterpID 186 + { $$ = $1.N1($2) } 187 + ; 188 + 189 + 190 + Function 191 + : argID ':' Expression 192 + { $$ = p.NewNode(FunctionNode, $2).N2(p.NewNode(IDNode, $1), $3) } 193 + | argBracket ArgSet '}' ':' Expression 194 + { $$ = p.NewNode(FunctionNode, $4).N2($2.T2($1, $3), $5) } 195 + | argID '@' argBracket ArgSet '}' ':' Expression 196 + { $$ = p.NewNode(FunctionNode, $2, $6).N3(p.NewNode(IDNode, $1), $4.T2($3, $5), $7) } 197 + | argBracket ArgSet '}' '@' argID ':' Expression 198 + { $$ = p.NewNode(FunctionNode, $4, $6).N3(p.NewNode(IDNode, $5), $2.T2($1, $3), $7) } 199 + ; 200 + 201 + ArgSet 202 + : 203 + { $$ = p.NewNode(ArgSetNode) } 204 + | Arg 205 + { $$ = p.NewNode(ArgSetNode).N1($1) } 206 + | ellipsis 207 + { $$ = p.NewNode(ArgSetNode).N1(p.NewNode(ArgNode, $1)) } 208 + | Arg ',' ArgSet 209 + { $$ = $3.N1($1.T1($2)) } 210 + ; 211 + 212 + Arg 213 + : ID 214 + { $$ = p.NewNode(ArgNode).N1($1) } 215 + | ID '?' Expression 216 + { $$ = p.NewNode(ArgNode, $2).N2($1, $3) } 217 + ; 218 +
+95
pkg/parser/nodetype.go
···
··· 1 + package parser 2 + 3 + type NodeType uint16 4 + 5 + const ( 6 + ApplyNode NodeType = iota 7 + ArgNode 8 + ArgSetNode 9 + AssertNode 10 + AttrPathNode 11 + BindNode 12 + BindsNode 13 + FloatNode 14 + FunctionNode 15 + IDNode 16 + IStringNode 17 + IfNode 18 + InheritFromNode 19 + InheritListNode 20 + InheritNode 21 + IntNode 22 + InterpNode 23 + LetNode 24 + ListNode 25 + ParensNode 26 + PathNode 27 + RecSetNode 28 + SelectNode 29 + SelectOrNode 30 + SetNode 31 + StringNode 32 + TextNode 33 + URINode 34 + WithNode 35 + 36 + OpNode 37 + ) 38 + 39 + var nodeName = map[NodeType]string{ 40 + ApplyNode: "apply", 41 + ArgNode: "arg", 42 + ArgSetNode: "argset", 43 + AssertNode: "assert", 44 + AttrPathNode: "attrpath", 45 + BindNode: "bind", 46 + BindsNode: "binds", 47 + FloatNode: "float", 48 + FunctionNode: "function", 49 + IDNode: "id", 50 + IStringNode: "istring", 51 + IfNode: "if", 52 + InheritFromNode: "inheritfrom", 53 + InheritListNode: "inheritlist", 54 + InheritNode: "inherit", 55 + IntNode: "int", 56 + InterpNode: "interp", 57 + LetNode: "let", 58 + ListNode: "list", 59 + ParensNode: "parens", 60 + PathNode: "path", 61 + RecSetNode: "recset", 62 + SelectNode: "select", 63 + SelectOrNode: "selector", 64 + SetNode: "set", 65 + StringNode: "string", 66 + TextNode: "text", 67 + URINode: "uri", 68 + WithNode: "with", 69 + 70 + OpNode + negate: "-", 71 + OpNode + '?': "?", 72 + OpNode + concat: "++", 73 + OpNode + '/': "/", 74 + OpNode + '*': "*", 75 + OpNode + '-': "-", 76 + OpNode + '+': "+", 77 + OpNode + '!': "!", 78 + OpNode + update: "//", 79 + OpNode + geq: ">=", 80 + OpNode + leq: "<=", 81 + OpNode + '>': ">", 82 + OpNode + '<': "<", 83 + OpNode + neq: "!=", 84 + OpNode + eq: "==", 85 + OpNode + and: "&&", 86 + OpNode + or: "||", 87 + OpNode + impl: "->", 88 + } 89 + 90 + func (nt NodeType) String() string { 91 + if s, ok := nodeName[nt]; ok { 92 + return s 93 + } 94 + panic("unknown node type") 95 + }
+127
pkg/parser/parser.go
···
··· 1 + package parser 2 + 3 + //go:generate goyacc nix.y 4 + //go:generate sed "/yyS :=/a\\\tp := yylex.(*Parser)" -i y.go 5 + 6 + import ( 7 + "fmt" 8 + "strings" 9 + ) 10 + 11 + type Node struct { 12 + Type NodeType 13 + Tokens []int 14 + Nodes []*Node 15 + 16 + preallocatedNodes [2]*Node 17 + } 18 + 19 + const nodesBlock = 1024 20 + 21 + type Parser struct { 22 + *LexResult 23 + prev int 24 + last int 25 + errors []string 26 + 27 + nodes []Node 28 + nextNode int 29 + 30 + Result *Node 31 + } 32 + 33 + func newParser(lr *LexResult) *Parser { 34 + return &Parser{LexResult: lr, prev: -1, last: len(lr.Tokens) - 1} 35 + } 36 + 37 + func (p *Parser) Lex(lval *yySymType) int { 38 + if p.prev == p.last { 39 + return 0 40 + } 41 + p.prev++ 42 + lval.token = p.prev 43 + return p.Tokens[p.prev].Sym 44 + } 45 + 46 + func (p *Parser) Error(s string) { 47 + s = p.Tokens[p.prev].String() + ": " + s 48 + p.errors = append(p.errors, s) 49 + } 50 + 51 + func (p *Parser) NewNode(t NodeType, tokens ...int) *Node { 52 + if p.nextNode == len(p.nodes) { 53 + p.nodes = make([]Node, nodesBlock) 54 + p.nextNode = 0 55 + } 56 + n := &p.nodes[p.nextNode] 57 + p.nextNode++ 58 + n.Type = t 59 + n.Tokens = tokens 60 + n.Nodes = n.preallocatedNodes[:0] 61 + return n 62 + } 63 + 64 + func (p *Parser) Op(t NodeType, tokens ...int) *Node { return p.NewNode(OpNode+t, tokens...) } 65 + 66 + func (n *Node) SetType(t NodeType) *Node { n.Type = t; return n } 67 + 68 + func (n *Node) T(tokens ...int) *Node { n.Tokens = append(n.Tokens, tokens...); return n } 69 + func (n *Node) T1(t0 int) *Node { n.Tokens = append(n.Tokens, t0); return n } 70 + func (n *Node) T2(t0, t1 int) *Node { n.Tokens = append(n.Tokens, t0, t1); return n } 71 + func (n *Node) T3(t0, t1, t2 int) *Node { n.Tokens = append(n.Tokens, t0, t1, t2); return n } 72 + 73 + func (n *Node) N(nodes ...*Node) *Node { n.Nodes = append(n.Nodes, nodes...); return n } 74 + func (n *Node) N1(n0 *Node) *Node { n.Nodes = append(n.Nodes, n0); return n } 75 + func (n *Node) N2(n0, n1 *Node) *Node { n.Nodes = append(n.Nodes, n0, n1); return n } 76 + func (n *Node) N3(n0, n1, n2 *Node) *Node { n.Nodes = append(n.Nodes, n0, n1, n2); return n } 77 + 78 + func (p *Parser) LispResult() string { 79 + return p.Result.lispFormat(p) 80 + } 81 + 82 + func (n *Node) lispFormat(p *Parser) string { 83 + s := n.Type.String() 84 + if s == "" { 85 + panic("unknown node type") 86 + } 87 + for _, child := range n.Nodes { 88 + s += " " + child.lispFormat(p) 89 + } 90 + switch n.Type { 91 + case URINode, PathNode, FloatNode, IntNode: 92 + s += " " + p.TokenString(n.Tokens[0]) 93 + case IDNode: 94 + s += " |" + p.TokenString(n.Tokens[0]) + "|" 95 + case TextNode: 96 + s += ` "` + p.TokenString(n.Tokens[0]) + `"` 97 + } 98 + return "(" + s + ")" 99 + } 100 + 101 + func parse(lr *LexResult) (p *Parser, err error) { 102 + p = newParser(lr) 103 + yyErrorVerbose = true 104 + yyParse(p) 105 + if len(p.errors) == 0 { 106 + return 107 + } 108 + path := p.File.Name() 109 + err = fmt.Errorf("%s: %s", path, strings.Join(p.errors, "; ")) 110 + return 111 + } 112 + 113 + func ParseFile(path string) (p *Parser, err error) { 114 + lr, err := lexFile(path) 115 + if err != nil { 116 + return nil, err 117 + } 118 + return parse(lr) 119 + } 120 + 121 + func ParseString(s string) (p *Parser, err error) { 122 + lr, err := lex([]byte(s), "") 123 + if err != nil { 124 + return nil, err 125 + } 126 + return parse(lr) 127 + }
+1001
pkg/parser/y.go
···
··· 1 + // Code generated by goyacc nix.y. DO NOT EDIT. 2 + 3 + //line nix.y:2 4 + package parser 5 + 6 + import __yyfmt__ "fmt" 7 + 8 + //line nix.y:2 9 + 10 + //line nix.y:5 11 + type yySymType struct { 12 + yys int 13 + token int 14 + node *Node 15 + } 16 + 17 + const assert_ = 57346 18 + const if_ = 57347 19 + const then = 57348 20 + const else_ = 57349 21 + const let = 57350 22 + const in = 57351 23 + const with = 57352 24 + const or_ = 57353 25 + const rec = 57354 26 + const inherit = 57355 27 + const ellipsis = 57356 28 + const interp = 57357 29 + const space = 57358 30 + const comment = 57359 31 + const ii = 57360 32 + const uri = 57361 33 + const path = 57362 34 + const float = 57363 35 + const int_ = 57364 36 + const id = 57365 37 + const text = 57366 38 + const argID = 57367 39 + const argBracket = 57368 40 + const impl = 57369 41 + const or = 57370 42 + const and = 57371 43 + const eq = 57372 44 + const neq = 57373 45 + const leq = 57374 46 + const geq = 57375 47 + const update = 57376 48 + const concat = 57377 49 + const negate = 57378 50 + 51 + var yyToknames = [...]string{ 52 + "$end", 53 + "error", 54 + "$unk", 55 + "assert_", 56 + "if_", 57 + "then", 58 + "else_", 59 + "let", 60 + "in", 61 + "with", 62 + "or_", 63 + "rec", 64 + "inherit", 65 + "ellipsis", 66 + "interp", 67 + "space", 68 + "comment", 69 + "ii", 70 + "uri", 71 + "path", 72 + "float", 73 + "int_", 74 + "id", 75 + "text", 76 + "argID", 77 + "argBracket", 78 + "':'", 79 + "'@'", 80 + "','", 81 + "';'", 82 + "'\"'", 83 + "'.'", 84 + "'('", 85 + "')'", 86 + "'['", 87 + "']'", 88 + "'{'", 89 + "'}'", 90 + "'='", 91 + "impl", 92 + "or", 93 + "and", 94 + "eq", 95 + "neq", 96 + "'<'", 97 + "'>'", 98 + "leq", 99 + "geq", 100 + "update", 101 + "'!'", 102 + "'+'", 103 + "'-'", 104 + "'*'", 105 + "'/'", 106 + "concat", 107 + "'?'", 108 + "negate", 109 + } 110 + 111 + var yyStatenames = [...]string{} 112 + 113 + const yyEofCode = 1 114 + const yyErrCode = 2 115 + const yyInitialStackSize = 16 116 + 117 + //line yacctab:1 118 + var yyExca = [...]int8{ 119 + -1, 1, 120 + 1, -1, 121 + -2, 0, 122 + -1, 81, 123 + 43, 0, 124 + 44, 0, 125 + -2, 43, 126 + -1, 82, 127 + 43, 0, 128 + 44, 0, 129 + -2, 44, 130 + } 131 + 132 + const yyPrivate = 57344 133 + 134 + const yyLast = 354 135 + 136 + var yyAct = [...]uint8{ 137 + 2, 14, 20, 65, 114, 44, 45, 53, 47, 29, 138 + 28, 48, 96, 68, 132, 34, 56, 33, 32, 31, 139 + 30, 29, 28, 126, 60, 31, 30, 29, 28, 46, 140 + 58, 66, 43, 42, 41, 40, 39, 38, 37, 36, 141 + 35, 34, 94, 33, 32, 31, 30, 29, 28, 66, 142 + 89, 107, 92, 59, 63, 62, 138, 102, 113, 115, 143 + 66, 137, 107, 104, 57, 66, 91, 86, 95, 122, 144 + 140, 109, 99, 99, 38, 37, 36, 35, 34, 64, 145 + 33, 32, 31, 30, 29, 28, 139, 110, 111, 112, 146 + 107, 93, 116, 106, 134, 67, 56, 121, 56, 70, 147 + 108, 117, 127, 120, 70, 87, 1, 27, 97, 66, 148 + 66, 124, 55, 98, 128, 69, 131, 66, 130, 133, 149 + 125, 27, 99, 54, 135, 8, 70, 61, 136, 33, 150 + 32, 31, 30, 29, 28, 98, 118, 119, 9, 15, 151 + 142, 143, 100, 141, 66, 130, 4, 5, 51, 52, 152 + 6, 0, 7, 0, 26, 0, 0, 0, 0, 0, 153 + 22, 16, 17, 18, 19, 27, 67, 12, 13, 0, 154 + 70, 70, 0, 21, 101, 23, 0, 24, 27, 25, 155 + 98, 0, 0, 0, 0, 144, 69, 0, 0, 0, 156 + 0, 0, 11, 0, 10, 41, 40, 39, 38, 37, 157 + 36, 35, 34, 0, 33, 32, 31, 30, 29, 28, 158 + 40, 39, 38, 37, 36, 35, 34, 0, 33, 32, 159 + 31, 30, 29, 28, 26, 0, 0, 0, 0, 0, 160 + 22, 16, 17, 18, 19, 27, 67, 0, 90, 3, 161 + 70, 0, 0, 21, 0, 23, 0, 24, 27, 25, 162 + 49, 50, 0, 0, 0, 0, 69, 0, 0, 0, 163 + 0, 0, 11, 123, 10, 0, 0, 0, 0, 71, 164 + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 165 + 82, 83, 84, 85, 26, 0, 0, 0, 0, 0, 166 + 22, 16, 17, 18, 19, 27, 0, 0, 0, 0, 167 + 0, 0, 0, 21, 26, 23, 0, 24, 103, 25, 168 + 22, 16, 17, 18, 19, 27, 67, 0, 90, 0, 169 + 70, 0, 67, 21, 0, 23, 70, 24, 27, 25, 170 + 0, 88, 0, 67, 27, 90, 69, 70, 0, 0, 171 + 0, 129, 69, 105, 0, 27, 0, 0, 0, 0, 172 + 0, 0, 0, 69, 173 + } 174 + 175 + var yyPact = [...]int16{ 176 + 142, -1000, -1000, -8, 142, 142, -1000, 142, -1000, 292, 177 + 212, 212, 121, 98, -1000, 32, -1000, -1000, -1000, -1000, 178 + -1000, -1000, -1000, 142, -1000, -1000, 17, -1000, 84, 212, 179 + 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 180 + 212, 212, 212, 212, 37, 99, 322, 36, -1000, -1000, 181 + 78, 142, 65, 4, 39, -1000, -44, 84, 111, 156, 182 + 23, 272, 305, -1000, 30, -1000, -1000, -1000, -1000, -1000, 183 + 142, -46, -46, -46, -28, -28, -34, -34, -34, -34, 184 + -34, 29, 29, 167, 153, -8, 142, 142, 142, 19, 185 + 26, 142, -1000, 98, 109, 98, 142, 58, -1000, -1000, 186 + -1000, -1000, -1000, -1000, -1000, -1000, 225, 84, 89, -15, 187 + -1000, 95, -1000, 142, 311, 142, -1000, -24, 142, 69, 188 + -1000, -1000, 292, -1000, -1000, -1000, -1000, 142, 31, -1000, 189 + -1000, 22, 59, -1000, 43, -1000, -1000, -1000, -1000, 142, 190 + 142, 155, -1000, -1000, -1000, 191 + } 192 + 193 + var yyPgo = [...]uint8{ 194 + 0, 0, 13, 30, 2, 139, 1, 138, 239, 3, 195 + 50, 127, 29, 4, 125, 7, 123, 106, 196 + } 197 + 198 + var yyR1 = [...]int8{ 199 + 0, 17, 1, 1, 1, 1, 1, 1, 2, 3, 200 + 3, 3, 4, 5, 5, 5, 5, 5, 5, 5, 201 + 5, 5, 5, 5, 6, 6, 6, 7, 7, 8, 202 + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 203 + 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 204 + 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 205 + 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 206 + 16, 16, 207 + } 208 + 209 + var yyR2 = [...]int8{ 210 + 0, 1, 1, 4, 6, 4, 4, 1, 3, 0, 211 + 2, 2, 1, 1, 1, 1, 1, 1, 3, 3, 212 + 3, 3, 3, 4, 1, 3, 5, 1, 2, 1, 213 + 2, 3, 3, 3, 3, 3, 3, 2, 3, 3, 214 + 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 215 + 1, 3, 1, 3, 0, 2, 0, 5, 4, 7, 216 + 0, 2, 3, 5, 7, 7, 0, 1, 1, 3, 217 + 1, 3, 218 + } 219 + 220 + var yyChk = [...]int16{ 221 + -1000, -17, -1, -8, 4, 5, 8, 10, -14, -7, 222 + 52, 50, 25, 26, -6, -5, 19, 20, 21, 22, 223 + -4, 31, 18, 33, 35, 37, 12, 23, 56, 55, 224 + 54, 53, 52, 51, 49, 48, 47, 46, 45, 44, 225 + 43, 42, 41, 40, -1, -1, -12, -1, -6, -8, 226 + -8, 27, 28, -15, -16, 14, -4, 32, -3, -3, 227 + -1, -11, -12, 37, -10, -9, -4, 11, -2, 31, 228 + 15, -8, -8, -8, -8, -8, -8, -8, -8, -8, 229 + -8, -8, -8, -8, -8, -8, 30, 6, 9, -10, 230 + 13, 30, -1, 26, 38, 29, 56, -10, 24, -2, 231 + 31, 18, 34, 36, -6, 38, -12, 32, -3, -1, 232 + -1, -1, -1, 39, -13, 33, -1, -15, 27, 28, 233 + -15, -1, 11, 38, -9, 31, 38, 7, -1, 30, 234 + -9, -1, 38, -1, 25, -6, -1, 30, 34, 27, 235 + 27, -13, -1, -1, 30, 236 + } 237 + 238 + var yyDef = [...]int8{ 239 + 0, -2, 1, 2, 0, 0, 56, 0, 7, 29, 240 + 0, 0, 0, 66, 27, 24, 13, 14, 15, 16, 241 + 17, 9, 9, 0, 54, 56, 0, 12, 0, 0, 242 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 243 + 0, 0, 0, 0, 0, 0, 0, 0, 28, 30, 244 + 37, 0, 0, 0, 67, 68, 70, 0, 0, 0, 245 + 0, 0, 0, 56, 31, 52, 48, 49, 50, 9, 246 + 0, 32, 33, 34, 35, 36, 38, 39, 40, 41, 247 + 42, -2, -2, 45, 46, 47, 0, 0, 0, 0, 248 + 60, 0, 62, 66, 0, 66, 0, 25, 10, 11, 249 + 18, 19, 20, 21, 55, 22, 0, 0, 0, 0, 250 + 3, 0, 5, 0, 0, 0, 6, 0, 0, 0, 251 + 69, 71, 0, 23, 53, 51, 8, 0, 0, 58, 252 + 61, 0, 0, 63, 0, 26, 4, 57, 60, 0, 253 + 0, 0, 64, 65, 59, 254 + } 255 + 256 + var yyTok1 = [...]int8{ 257 + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 258 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 259 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 260 + 3, 3, 3, 50, 31, 3, 3, 3, 3, 3, 261 + 33, 34, 53, 51, 29, 52, 32, 54, 3, 3, 262 + 3, 3, 3, 3, 3, 3, 3, 3, 27, 30, 263 + 45, 39, 46, 56, 28, 3, 3, 3, 3, 3, 264 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 265 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 266 + 3, 35, 3, 36, 3, 3, 3, 3, 3, 3, 267 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 268 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 269 + 3, 3, 3, 37, 3, 38, 270 + } 271 + 272 + var yyTok2 = [...]int8{ 273 + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 274 + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 275 + 22, 23, 24, 25, 26, 40, 41, 42, 43, 44, 276 + 47, 48, 49, 55, 57, 277 + } 278 + 279 + var yyTok3 = [...]int8{ 280 + 0, 281 + } 282 + 283 + var yyErrorMessages = [...]struct { 284 + state int 285 + token int 286 + msg string 287 + }{} 288 + 289 + //line yaccpar:1 290 + 291 + /* parser for yacc output */ 292 + 293 + var ( 294 + yyDebug = 0 295 + yyErrorVerbose = false 296 + ) 297 + 298 + type yyLexer interface { 299 + Lex(lval *yySymType) int 300 + Error(s string) 301 + } 302 + 303 + type yyParser interface { 304 + Parse(yyLexer) int 305 + Lookahead() int 306 + } 307 + 308 + type yyParserImpl struct { 309 + lval yySymType 310 + stack [yyInitialStackSize]yySymType 311 + char int 312 + } 313 + 314 + func (p *yyParserImpl) Lookahead() int { 315 + return p.char 316 + } 317 + 318 + func yyNewParser() yyParser { 319 + return &yyParserImpl{} 320 + } 321 + 322 + const yyFlag = -1000 323 + 324 + func yyTokname(c int) string { 325 + if c >= 1 && c-1 < len(yyToknames) { 326 + if yyToknames[c-1] != "" { 327 + return yyToknames[c-1] 328 + } 329 + } 330 + return __yyfmt__.Sprintf("tok-%v", c) 331 + } 332 + 333 + func yyStatname(s int) string { 334 + if s >= 0 && s < len(yyStatenames) { 335 + if yyStatenames[s] != "" { 336 + return yyStatenames[s] 337 + } 338 + } 339 + return __yyfmt__.Sprintf("state-%v", s) 340 + } 341 + 342 + func yyErrorMessage(state, lookAhead int) string { 343 + const TOKSTART = 4 344 + 345 + if !yyErrorVerbose { 346 + return "syntax error" 347 + } 348 + 349 + for _, e := range yyErrorMessages { 350 + if e.state == state && e.token == lookAhead { 351 + return "syntax error: " + e.msg 352 + } 353 + } 354 + 355 + res := "syntax error: unexpected " + yyTokname(lookAhead) 356 + 357 + // To match Bison, suggest at most four expected tokens. 358 + expected := make([]int, 0, 4) 359 + 360 + // Look for shiftable tokens. 361 + base := int(yyPact[state]) 362 + for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { 363 + if n := base + tok; n >= 0 && n < yyLast && int(yyChk[int(yyAct[n])]) == tok { 364 + if len(expected) == cap(expected) { 365 + return res 366 + } 367 + expected = append(expected, tok) 368 + } 369 + } 370 + 371 + if yyDef[state] == -2 { 372 + i := 0 373 + for yyExca[i] != -1 || int(yyExca[i+1]) != state { 374 + i += 2 375 + } 376 + 377 + // Look for tokens that we accept or reduce. 378 + for i += 2; yyExca[i] >= 0; i += 2 { 379 + tok := int(yyExca[i]) 380 + if tok < TOKSTART || yyExca[i+1] == 0 { 381 + continue 382 + } 383 + if len(expected) == cap(expected) { 384 + return res 385 + } 386 + expected = append(expected, tok) 387 + } 388 + 389 + // If the default action is to accept or reduce, give up. 390 + if yyExca[i+1] != 0 { 391 + return res 392 + } 393 + } 394 + 395 + for i, tok := range expected { 396 + if i == 0 { 397 + res += ", expecting " 398 + } else { 399 + res += " or " 400 + } 401 + res += yyTokname(tok) 402 + } 403 + return res 404 + } 405 + 406 + func yylex1(lex yyLexer, lval *yySymType) (char, token int) { 407 + token = 0 408 + char = lex.Lex(lval) 409 + if char <= 0 { 410 + token = int(yyTok1[0]) 411 + goto out 412 + } 413 + if char < len(yyTok1) { 414 + token = int(yyTok1[char]) 415 + goto out 416 + } 417 + if char >= yyPrivate { 418 + if char < yyPrivate+len(yyTok2) { 419 + token = int(yyTok2[char-yyPrivate]) 420 + goto out 421 + } 422 + } 423 + for i := 0; i < len(yyTok3); i += 2 { 424 + token = int(yyTok3[i+0]) 425 + if token == char { 426 + token = int(yyTok3[i+1]) 427 + goto out 428 + } 429 + } 430 + 431 + out: 432 + if token == 0 { 433 + token = int(yyTok2[1]) /* unknown char */ 434 + } 435 + if yyDebug >= 3 { 436 + __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) 437 + } 438 + return char, token 439 + } 440 + 441 + func yyParse(yylex yyLexer) int { 442 + return yyNewParser().Parse(yylex) 443 + } 444 + 445 + func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { 446 + var yyn int 447 + var yyVAL yySymType 448 + var yyDollar []yySymType 449 + _ = yyDollar // silence set and not used 450 + yyS := yyrcvr.stack[:] 451 + p := yylex.(*Parser) 452 + 453 + Nerrs := 0 /* number of errors */ 454 + Errflag := 0 /* error recovery flag */ 455 + yystate := 0 456 + yyrcvr.char = -1 457 + yytoken := -1 // yyrcvr.char translated into internal numbering 458 + defer func() { 459 + // Make sure we report no lookahead when not parsing. 460 + yystate = -1 461 + yyrcvr.char = -1 462 + yytoken = -1 463 + }() 464 + yyp := -1 465 + goto yystack 466 + 467 + ret0: 468 + return 0 469 + 470 + ret1: 471 + return 1 472 + 473 + yystack: 474 + /* put a state and value onto the stack */ 475 + if yyDebug >= 4 { 476 + __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) 477 + } 478 + 479 + yyp++ 480 + if yyp >= len(yyS) { 481 + nyys := make([]yySymType, len(yyS)*2) 482 + copy(nyys, yyS) 483 + yyS = nyys 484 + } 485 + yyS[yyp] = yyVAL 486 + yyS[yyp].yys = yystate 487 + 488 + yynewstate: 489 + yyn = int(yyPact[yystate]) 490 + if yyn <= yyFlag { 491 + goto yydefault /* simple state */ 492 + } 493 + if yyrcvr.char < 0 { 494 + yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) 495 + } 496 + yyn += yytoken 497 + if yyn < 0 || yyn >= yyLast { 498 + goto yydefault 499 + } 500 + yyn = int(yyAct[yyn]) 501 + if int(yyChk[yyn]) == yytoken { /* valid shift */ 502 + yyrcvr.char = -1 503 + yytoken = -1 504 + yyVAL = yyrcvr.lval 505 + yystate = yyn 506 + if Errflag > 0 { 507 + Errflag-- 508 + } 509 + goto yystack 510 + } 511 + 512 + yydefault: 513 + /* default state action */ 514 + yyn = int(yyDef[yystate]) 515 + if yyn == -2 { 516 + if yyrcvr.char < 0 { 517 + yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) 518 + } 519 + 520 + /* look through exception table */ 521 + xi := 0 522 + for { 523 + if yyExca[xi+0] == -1 && int(yyExca[xi+1]) == yystate { 524 + break 525 + } 526 + xi += 2 527 + } 528 + for xi += 2; ; xi += 2 { 529 + yyn = int(yyExca[xi+0]) 530 + if yyn < 0 || yyn == yytoken { 531 + break 532 + } 533 + } 534 + yyn = int(yyExca[xi+1]) 535 + if yyn < 0 { 536 + goto ret0 537 + } 538 + } 539 + if yyn == 0 { 540 + /* error ... attempt to resume parsing */ 541 + switch Errflag { 542 + case 0: /* brand new error */ 543 + yylex.Error(yyErrorMessage(yystate, yytoken)) 544 + Nerrs++ 545 + if yyDebug >= 1 { 546 + __yyfmt__.Printf("%s", yyStatname(yystate)) 547 + __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) 548 + } 549 + fallthrough 550 + 551 + case 1, 2: /* incompletely recovered error ... try again */ 552 + Errflag = 3 553 + 554 + /* find a state where "error" is a legal shift action */ 555 + for yyp >= 0 { 556 + yyn = int(yyPact[yyS[yyp].yys]) + yyErrCode 557 + if yyn >= 0 && yyn < yyLast { 558 + yystate = int(yyAct[yyn]) /* simulate a shift of "error" */ 559 + if int(yyChk[yystate]) == yyErrCode { 560 + goto yystack 561 + } 562 + } 563 + 564 + /* the current p has no shift on "error", pop stack */ 565 + if yyDebug >= 2 { 566 + __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) 567 + } 568 + yyp-- 569 + } 570 + /* there is no state on the stack with an error shift ... abort */ 571 + goto ret1 572 + 573 + case 3: /* no shift yet; clobber input char */ 574 + if yyDebug >= 2 { 575 + __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) 576 + } 577 + if yytoken == yyEofCode { 578 + goto ret1 579 + } 580 + yyrcvr.char = -1 581 + yytoken = -1 582 + goto yynewstate /* try again in the same state */ 583 + } 584 + } 585 + 586 + /* reduction by production yyn */ 587 + if yyDebug >= 2 { 588 + __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) 589 + } 590 + 591 + yynt := yyn 592 + yypt := yyp 593 + _ = yypt // guard against "declared and not used" 594 + 595 + yyp -= int(yyR2[yyn]) 596 + // yyp is now the index of $0. Perform the default action. Iff the 597 + // reduced production is ε, $1 is possibly out of range. 598 + if yyp+1 >= len(yyS) { 599 + nyys := make([]yySymType, len(yyS)*2) 600 + copy(nyys, yyS) 601 + yyS = nyys 602 + } 603 + yyVAL = yyS[yyp+1] 604 + 605 + /* consult goto table to find next state */ 606 + yyn = int(yyR1[yyn]) 607 + yyg := int(yyPgo[yyn]) 608 + yyj := yyg + yyS[yyp].yys + 1 609 + 610 + if yyj >= yyLast { 611 + yystate = int(yyAct[yyg]) 612 + } else { 613 + yystate = int(yyAct[yyj]) 614 + if int(yyChk[yystate]) != -yyn { 615 + yystate = int(yyAct[yyg]) 616 + } 617 + } 618 + // dummy call; replaced with literal code 619 + switch yynt { 620 + 621 + case 1: 622 + yyDollar = yyS[yypt-1 : yypt+1] 623 + //line nix.y:35 624 + { 625 + p.Result = yyDollar[1].node 626 + } 627 + case 3: 628 + yyDollar = yyS[yypt-4 : yypt+1] 629 + //line nix.y:41 630 + { 631 + yyVAL.node = p.NewNode(AssertNode, yyDollar[1].token, yyDollar[3].token).N2(yyDollar[2].node, yyDollar[4].node) 632 + } 633 + case 4: 634 + yyDollar = yyS[yypt-6 : yypt+1] 635 + //line nix.y:43 636 + { 637 + yyVAL.node = p.NewNode(IfNode, yyDollar[1].token, yyDollar[3].token, yyDollar[5].token).N3(yyDollar[2].node, yyDollar[4].node, yyDollar[6].node) 638 + } 639 + case 5: 640 + yyDollar = yyS[yypt-4 : yypt+1] 641 + //line nix.y:45 642 + { 643 + yyVAL.node = p.NewNode(LetNode, yyDollar[1].token, yyDollar[3].token).N2(yyDollar[2].node, yyDollar[4].node) 644 + } 645 + case 6: 646 + yyDollar = yyS[yypt-4 : yypt+1] 647 + //line nix.y:47 648 + { 649 + yyVAL.node = p.NewNode(WithNode, yyDollar[1].token, yyDollar[3].token).N2(yyDollar[2].node, yyDollar[4].node) 650 + } 651 + case 8: 652 + yyDollar = yyS[yypt-3 : yypt+1] 653 + //line nix.y:53 654 + { 655 + yyVAL.node = p.NewNode(InterpNode, yyDollar[1].token, yyDollar[3].token).N1(yyDollar[2].node) 656 + } 657 + case 9: 658 + yyDollar = yyS[yypt-0 : yypt+1] 659 + //line nix.y:58 660 + { 661 + yyVAL.node = p.NewNode(StringNode) 662 + } 663 + case 10: 664 + yyDollar = yyS[yypt-2 : yypt+1] 665 + //line nix.y:60 666 + { 667 + yyVAL.node = yyDollar[1].node.N1(p.NewNode(TextNode, yyDollar[2].token)) 668 + } 669 + case 11: 670 + yyDollar = yyS[yypt-2 : yypt+1] 671 + //line nix.y:62 672 + { 673 + yyVAL.node = yyDollar[1].node.N1(yyDollar[2].node) 674 + } 675 + case 12: 676 + yyDollar = yyS[yypt-1 : yypt+1] 677 + //line nix.y:67 678 + { 679 + yyVAL.node = p.NewNode(IDNode, yyDollar[1].token) 680 + } 681 + case 13: 682 + yyDollar = yyS[yypt-1 : yypt+1] 683 + //line nix.y:72 684 + { 685 + yyVAL.node = p.NewNode(URINode, yyDollar[1].token) 686 + } 687 + case 14: 688 + yyDollar = yyS[yypt-1 : yypt+1] 689 + //line nix.y:74 690 + { 691 + yyVAL.node = p.NewNode(PathNode, yyDollar[1].token) 692 + } 693 + case 15: 694 + yyDollar = yyS[yypt-1 : yypt+1] 695 + //line nix.y:76 696 + { 697 + yyVAL.node = p.NewNode(FloatNode, yyDollar[1].token) 698 + } 699 + case 16: 700 + yyDollar = yyS[yypt-1 : yypt+1] 701 + //line nix.y:78 702 + { 703 + yyVAL.node = p.NewNode(IntNode, yyDollar[1].token) 704 + } 705 + case 18: 706 + yyDollar = yyS[yypt-3 : yypt+1] 707 + //line nix.y:81 708 + { 709 + yyVAL.node = yyDollar[2].node.T2(yyDollar[1].token, yyDollar[3].token) 710 + } 711 + case 19: 712 + yyDollar = yyS[yypt-3 : yypt+1] 713 + //line nix.y:83 714 + { 715 + yyVAL.node = yyDollar[2].node.T2(yyDollar[1].token, yyDollar[3].token).SetType(IStringNode) 716 + } 717 + case 20: 718 + yyDollar = yyS[yypt-3 : yypt+1] 719 + //line nix.y:85 720 + { 721 + yyVAL.node = p.NewNode(ParensNode, yyDollar[1].token, yyDollar[3].token).N1(yyDollar[2].node) 722 + } 723 + case 21: 724 + yyDollar = yyS[yypt-3 : yypt+1] 725 + //line nix.y:87 726 + { 727 + yyVAL.node = yyDollar[2].node.T2(yyDollar[1].token, yyDollar[3].token) 728 + } 729 + case 22: 730 + yyDollar = yyS[yypt-3 : yypt+1] 731 + //line nix.y:89 732 + { 733 + yyVAL.node = yyDollar[2].node.T2(yyDollar[1].token, yyDollar[3].token).SetType(SetNode) 734 + } 735 + case 23: 736 + yyDollar = yyS[yypt-4 : yypt+1] 737 + //line nix.y:91 738 + { 739 + yyVAL.node = yyDollar[3].node.T3(yyDollar[1].token, yyDollar[2].token, yyDollar[4].token).SetType(RecSetNode) 740 + } 741 + case 25: 742 + yyDollar = yyS[yypt-3 : yypt+1] 743 + //line nix.y:97 744 + { 745 + yyVAL.node = p.NewNode(SelectNode, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 746 + } 747 + case 26: 748 + yyDollar = yyS[yypt-5 : yypt+1] 749 + //line nix.y:99 750 + { 751 + yyVAL.node = p.NewNode(SelectOrNode, yyDollar[2].token, yyDollar[4].token).N3(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node) 752 + } 753 + case 28: 754 + yyDollar = yyS[yypt-2 : yypt+1] 755 + //line nix.y:105 756 + { 757 + yyVAL.node = p.NewNode(ApplyNode).N2(yyDollar[1].node, yyDollar[2].node) 758 + } 759 + case 30: 760 + yyDollar = yyS[yypt-2 : yypt+1] 761 + //line nix.y:111 762 + { 763 + yyVAL.node = p.Op(negate, yyDollar[1].token).N1(yyDollar[2].node) 764 + } 765 + case 31: 766 + yyDollar = yyS[yypt-3 : yypt+1] 767 + //line nix.y:113 768 + { 769 + yyVAL.node = p.Op('?', yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 770 + } 771 + case 32: 772 + yyDollar = yyS[yypt-3 : yypt+1] 773 + //line nix.y:115 774 + { 775 + yyVAL.node = p.Op(concat, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 776 + } 777 + case 33: 778 + yyDollar = yyS[yypt-3 : yypt+1] 779 + //line nix.y:117 780 + { 781 + yyVAL.node = p.Op('/', yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 782 + } 783 + case 34: 784 + yyDollar = yyS[yypt-3 : yypt+1] 785 + //line nix.y:119 786 + { 787 + yyVAL.node = p.Op('*', yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 788 + } 789 + case 35: 790 + yyDollar = yyS[yypt-3 : yypt+1] 791 + //line nix.y:121 792 + { 793 + yyVAL.node = p.Op('-', yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 794 + } 795 + case 36: 796 + yyDollar = yyS[yypt-3 : yypt+1] 797 + //line nix.y:123 798 + { 799 + yyVAL.node = p.Op('+', yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 800 + } 801 + case 37: 802 + yyDollar = yyS[yypt-2 : yypt+1] 803 + //line nix.y:125 804 + { 805 + yyVAL.node = p.Op('!', yyDollar[1].token).N1(yyDollar[2].node) 806 + } 807 + case 38: 808 + yyDollar = yyS[yypt-3 : yypt+1] 809 + //line nix.y:127 810 + { 811 + yyVAL.node = p.Op(update, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 812 + } 813 + case 39: 814 + yyDollar = yyS[yypt-3 : yypt+1] 815 + //line nix.y:129 816 + { 817 + yyVAL.node = p.Op(geq, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 818 + } 819 + case 40: 820 + yyDollar = yyS[yypt-3 : yypt+1] 821 + //line nix.y:131 822 + { 823 + yyVAL.node = p.Op(leq, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 824 + } 825 + case 41: 826 + yyDollar = yyS[yypt-3 : yypt+1] 827 + //line nix.y:133 828 + { 829 + yyVAL.node = p.Op('>', yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 830 + } 831 + case 42: 832 + yyDollar = yyS[yypt-3 : yypt+1] 833 + //line nix.y:135 834 + { 835 + yyVAL.node = p.Op('<', yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 836 + } 837 + case 43: 838 + yyDollar = yyS[yypt-3 : yypt+1] 839 + //line nix.y:137 840 + { 841 + yyVAL.node = p.Op(neq, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 842 + } 843 + case 44: 844 + yyDollar = yyS[yypt-3 : yypt+1] 845 + //line nix.y:139 846 + { 847 + yyVAL.node = p.Op(eq, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 848 + } 849 + case 45: 850 + yyDollar = yyS[yypt-3 : yypt+1] 851 + //line nix.y:141 852 + { 853 + yyVAL.node = p.Op(and, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 854 + } 855 + case 46: 856 + yyDollar = yyS[yypt-3 : yypt+1] 857 + //line nix.y:143 858 + { 859 + yyVAL.node = p.Op(or, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 860 + } 861 + case 47: 862 + yyDollar = yyS[yypt-3 : yypt+1] 863 + //line nix.y:145 864 + { 865 + yyVAL.node = p.Op(impl, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 866 + } 867 + case 49: 868 + yyDollar = yyS[yypt-1 : yypt+1] 869 + //line nix.y:151 870 + { 871 + yyVAL.node = p.NewNode(IDNode, yyDollar[1].token) 872 + } 873 + case 51: 874 + yyDollar = yyS[yypt-3 : yypt+1] 875 + //line nix.y:154 876 + { 877 + yyVAL.node = yyDollar[2].node.T2(yyDollar[1].token, yyDollar[3].token) 878 + } 879 + case 52: 880 + yyDollar = yyS[yypt-1 : yypt+1] 881 + //line nix.y:159 882 + { 883 + yyVAL.node = p.NewNode(AttrPathNode).N1(yyDollar[1].node) 884 + } 885 + case 53: 886 + yyDollar = yyS[yypt-3 : yypt+1] 887 + //line nix.y:161 888 + { 889 + yyVAL.node = yyDollar[1].node.T1(yyDollar[2].token).N1(yyDollar[3].node) 890 + } 891 + case 54: 892 + yyDollar = yyS[yypt-0 : yypt+1] 893 + //line nix.y:166 894 + { 895 + yyVAL.node = p.NewNode(ListNode) 896 + } 897 + case 55: 898 + yyDollar = yyS[yypt-2 : yypt+1] 899 + //line nix.y:168 900 + { 901 + yyVAL.node = yyDollar[1].node.N1(yyDollar[2].node) 902 + } 903 + case 56: 904 + yyDollar = yyS[yypt-0 : yypt+1] 905 + //line nix.y:173 906 + { 907 + yyVAL.node = p.NewNode(BindsNode) 908 + } 909 + case 57: 910 + yyDollar = yyS[yypt-5 : yypt+1] 911 + //line nix.y:175 912 + { 913 + yyVAL.node = yyDollar[1].node.N1(p.NewNode(BindNode, yyDollar[3].token, yyDollar[5].token).N2(yyDollar[2].node, yyDollar[4].node)) 914 + } 915 + case 58: 916 + yyDollar = yyS[yypt-4 : yypt+1] 917 + //line nix.y:177 918 + { 919 + yyVAL.node = yyDollar[1].node.N1(p.NewNode(InheritNode, yyDollar[2].token, yyDollar[4].token).N1(yyDollar[3].node)) 920 + } 921 + case 59: 922 + yyDollar = yyS[yypt-7 : yypt+1] 923 + //line nix.y:179 924 + { 925 + yyVAL.node = yyDollar[1].node.N1(p.NewNode(InheritFromNode, yyDollar[2].token, yyDollar[3].token, yyDollar[5].token, yyDollar[7].token).N2(yyDollar[4].node, yyDollar[6].node)) 926 + } 927 + case 60: 928 + yyDollar = yyS[yypt-0 : yypt+1] 929 + //line nix.y:184 930 + { 931 + yyVAL.node = p.NewNode(InheritListNode) 932 + } 933 + case 61: 934 + yyDollar = yyS[yypt-2 : yypt+1] 935 + //line nix.y:186 936 + { 937 + yyVAL.node = yyDollar[1].node.N1(yyDollar[2].node) 938 + } 939 + case 62: 940 + yyDollar = yyS[yypt-3 : yypt+1] 941 + //line nix.y:192 942 + { 943 + yyVAL.node = p.NewNode(FunctionNode, yyDollar[2].token).N2(p.NewNode(IDNode, yyDollar[1].token), yyDollar[3].node) 944 + } 945 + case 63: 946 + yyDollar = yyS[yypt-5 : yypt+1] 947 + //line nix.y:194 948 + { 949 + yyVAL.node = p.NewNode(FunctionNode, yyDollar[4].token).N2(yyDollar[2].node.T2(yyDollar[1].token, yyDollar[3].token), yyDollar[5].node) 950 + } 951 + case 64: 952 + yyDollar = yyS[yypt-7 : yypt+1] 953 + //line nix.y:196 954 + { 955 + yyVAL.node = p.NewNode(FunctionNode, yyDollar[2].token, yyDollar[6].token).N3(p.NewNode(IDNode, yyDollar[1].token), yyDollar[4].node.T2(yyDollar[3].token, yyDollar[5].token), yyDollar[7].node) 956 + } 957 + case 65: 958 + yyDollar = yyS[yypt-7 : yypt+1] 959 + //line nix.y:198 960 + { 961 + yyVAL.node = p.NewNode(FunctionNode, yyDollar[4].token, yyDollar[6].token).N3(p.NewNode(IDNode, yyDollar[5].token), yyDollar[2].node.T2(yyDollar[1].token, yyDollar[3].token), yyDollar[7].node) 962 + } 963 + case 66: 964 + yyDollar = yyS[yypt-0 : yypt+1] 965 + //line nix.y:203 966 + { 967 + yyVAL.node = p.NewNode(ArgSetNode) 968 + } 969 + case 67: 970 + yyDollar = yyS[yypt-1 : yypt+1] 971 + //line nix.y:205 972 + { 973 + yyVAL.node = p.NewNode(ArgSetNode).N1(yyDollar[1].node) 974 + } 975 + case 68: 976 + yyDollar = yyS[yypt-1 : yypt+1] 977 + //line nix.y:207 978 + { 979 + yyVAL.node = p.NewNode(ArgSetNode).N1(p.NewNode(ArgNode, yyDollar[1].token)) 980 + } 981 + case 69: 982 + yyDollar = yyS[yypt-3 : yypt+1] 983 + //line nix.y:209 984 + { 985 + yyVAL.node = yyDollar[3].node.N1(yyDollar[1].node.T1(yyDollar[2].token)) 986 + } 987 + case 70: 988 + yyDollar = yyS[yypt-1 : yypt+1] 989 + //line nix.y:214 990 + { 991 + yyVAL.node = p.NewNode(ArgNode).N1(yyDollar[1].node) 992 + } 993 + case 71: 994 + yyDollar = yyS[yypt-3 : yypt+1] 995 + //line nix.y:216 996 + { 997 + yyVAL.node = p.NewNode(ArgNode, yyDollar[2].token).N2(yyDollar[1].node, yyDollar[3].node) 998 + } 999 + } 1000 + goto yystack /* stack new state and value */ 1001 + }
+2308
pkg/parser/y.output
···
··· 1 + 2 + state 0 3 + $accept: .Main $end 4 + 5 + assert_ shift 4 6 + if_ shift 5 7 + let shift 6 8 + with shift 7 9 + rec shift 26 10 + ii shift 22 11 + uri shift 16 12 + path shift 17 13 + float shift 18 14 + int_ shift 19 15 + id shift 27 16 + argID shift 12 17 + argBracket shift 13 18 + '"' shift 21 19 + '(' shift 23 20 + '[' shift 24 21 + '{' shift 25 22 + '!' shift 11 23 + '-' shift 10 24 + . error 25 + 26 + Expression goto 2 27 + ID goto 20 28 + Atom goto 15 29 + Select goto 14 30 + Apply goto 9 31 + Op goto 3 32 + Function goto 8 33 + Main goto 1 34 + 35 + state 1 36 + $accept: Main.$end 37 + 38 + $end accept 39 + . error 40 + 41 + 42 + state 2 43 + Main: Expression. (1) 44 + 45 + . reduce 1 (src line 33) 46 + 47 + 48 + state 3 49 + Expression: Op. (2) 50 + Op: Op.'?' AttrPath 51 + Op: Op.concat Op 52 + Op: Op.'/' Op 53 + Op: Op.'*' Op 54 + Op: Op.'-' Op 55 + Op: Op.'+' Op 56 + Op: Op.update Op 57 + Op: Op.geq Op 58 + Op: Op.leq Op 59 + Op: Op.'>' Op 60 + Op: Op.'<' Op 61 + Op: Op.neq Op 62 + Op: Op.eq Op 63 + Op: Op.and Op 64 + Op: Op.or Op 65 + Op: Op.impl Op 66 + 67 + impl shift 43 68 + or shift 42 69 + and shift 41 70 + eq shift 40 71 + neq shift 39 72 + '<' shift 38 73 + '>' shift 37 74 + leq shift 36 75 + geq shift 35 76 + update shift 34 77 + '+' shift 33 78 + '-' shift 32 79 + '*' shift 31 80 + '/' shift 30 81 + concat shift 29 82 + '?' shift 28 83 + . reduce 2 (src line 38) 84 + 85 + 86 + state 4 87 + Expression: assert_.Expression ';' Expression 88 + 89 + assert_ shift 4 90 + if_ shift 5 91 + let shift 6 92 + with shift 7 93 + rec shift 26 94 + ii shift 22 95 + uri shift 16 96 + path shift 17 97 + float shift 18 98 + int_ shift 19 99 + id shift 27 100 + argID shift 12 101 + argBracket shift 13 102 + '"' shift 21 103 + '(' shift 23 104 + '[' shift 24 105 + '{' shift 25 106 + '!' shift 11 107 + '-' shift 10 108 + . error 109 + 110 + Expression goto 44 111 + ID goto 20 112 + Atom goto 15 113 + Select goto 14 114 + Apply goto 9 115 + Op goto 3 116 + Function goto 8 117 + 118 + state 5 119 + Expression: if_.Expression then Expression else_ Expression 120 + 121 + assert_ shift 4 122 + if_ shift 5 123 + let shift 6 124 + with shift 7 125 + rec shift 26 126 + ii shift 22 127 + uri shift 16 128 + path shift 17 129 + float shift 18 130 + int_ shift 19 131 + id shift 27 132 + argID shift 12 133 + argBracket shift 13 134 + '"' shift 21 135 + '(' shift 23 136 + '[' shift 24 137 + '{' shift 25 138 + '!' shift 11 139 + '-' shift 10 140 + . error 141 + 142 + Expression goto 45 143 + ID goto 20 144 + Atom goto 15 145 + Select goto 14 146 + Apply goto 9 147 + Op goto 3 148 + Function goto 8 149 + 150 + state 6 151 + Expression: let.Binds in Expression 152 + Binds: . (56) 153 + 154 + . reduce 56 (src line 171) 155 + 156 + Binds goto 46 157 + 158 + state 7 159 + Expression: with.Expression ';' Expression 160 + 161 + assert_ shift 4 162 + if_ shift 5 163 + let shift 6 164 + with shift 7 165 + rec shift 26 166 + ii shift 22 167 + uri shift 16 168 + path shift 17 169 + float shift 18 170 + int_ shift 19 171 + id shift 27 172 + argID shift 12 173 + argBracket shift 13 174 + '"' shift 21 175 + '(' shift 23 176 + '[' shift 24 177 + '{' shift 25 178 + '!' shift 11 179 + '-' shift 10 180 + . error 181 + 182 + Expression goto 47 183 + ID goto 20 184 + Atom goto 15 185 + Select goto 14 186 + Apply goto 9 187 + Op goto 3 188 + Function goto 8 189 + 190 + state 8 191 + Expression: Function. (7) 192 + 193 + . reduce 7 (src line 48) 194 + 195 + 196 + state 9 197 + Apply: Apply.Select 198 + Op: Apply. (29) 199 + 200 + rec shift 26 201 + ii shift 22 202 + uri shift 16 203 + path shift 17 204 + float shift 18 205 + int_ shift 19 206 + id shift 27 207 + '"' shift 21 208 + '(' shift 23 209 + '[' shift 24 210 + '{' shift 25 211 + . reduce 29 (src line 108) 212 + 213 + ID goto 20 214 + Atom goto 15 215 + Select goto 48 216 + 217 + state 10 218 + Op: '-'.Op 219 + 220 + rec shift 26 221 + ii shift 22 222 + uri shift 16 223 + path shift 17 224 + float shift 18 225 + int_ shift 19 226 + id shift 27 227 + '"' shift 21 228 + '(' shift 23 229 + '[' shift 24 230 + '{' shift 25 231 + '!' shift 11 232 + '-' shift 10 233 + . error 234 + 235 + ID goto 20 236 + Atom goto 15 237 + Select goto 14 238 + Apply goto 9 239 + Op goto 49 240 + 241 + state 11 242 + Op: '!'.Op 243 + 244 + rec shift 26 245 + ii shift 22 246 + uri shift 16 247 + path shift 17 248 + float shift 18 249 + int_ shift 19 250 + id shift 27 251 + '"' shift 21 252 + '(' shift 23 253 + '[' shift 24 254 + '{' shift 25 255 + '!' shift 11 256 + '-' shift 10 257 + . error 258 + 259 + ID goto 20 260 + Atom goto 15 261 + Select goto 14 262 + Apply goto 9 263 + Op goto 50 264 + 265 + state 12 266 + Function: argID.':' Expression 267 + Function: argID.'@' argBracket ArgSet '}' ':' Expression 268 + 269 + ':' shift 51 270 + '@' shift 52 271 + . error 272 + 273 + 274 + state 13 275 + Function: argBracket.ArgSet '}' ':' Expression 276 + Function: argBracket.ArgSet '}' '@' argID ':' Expression 277 + ArgSet: . (66) 278 + 279 + ellipsis shift 55 280 + id shift 27 281 + . reduce 66 (src line 201) 282 + 283 + ID goto 56 284 + ArgSet goto 53 285 + Arg goto 54 286 + 287 + state 14 288 + Apply: Select. (27) 289 + 290 + . reduce 27 (src line 102) 291 + 292 + 293 + state 15 294 + Select: Atom. (24) 295 + Select: Atom.'.' AttrPath 296 + Select: Atom.'.' AttrPath or_ Select 297 + 298 + '.' shift 57 299 + . reduce 24 (src line 94) 300 + 301 + 302 + state 16 303 + Atom: uri. (13) 304 + 305 + . reduce 13 (src line 70) 306 + 307 + 308 + state 17 309 + Atom: path. (14) 310 + 311 + . reduce 14 (src line 73) 312 + 313 + 314 + state 18 315 + Atom: float. (15) 316 + 317 + . reduce 15 (src line 75) 318 + 319 + 320 + state 19 321 + Atom: int_. (16) 322 + 323 + . reduce 16 (src line 77) 324 + 325 + 326 + state 20 327 + Atom: ID. (17) 328 + 329 + . reduce 17 (src line 79) 330 + 331 + 332 + state 21 333 + Atom: '\"'.String '\"' 334 + String: . (9) 335 + 336 + . reduce 9 (src line 56) 337 + 338 + String goto 58 339 + 340 + state 22 341 + Atom: ii.String ii 342 + String: . (9) 343 + 344 + . reduce 9 (src line 56) 345 + 346 + String goto 59 347 + 348 + state 23 349 + Atom: '('.Expression ')' 350 + 351 + assert_ shift 4 352 + if_ shift 5 353 + let shift 6 354 + with shift 7 355 + rec shift 26 356 + ii shift 22 357 + uri shift 16 358 + path shift 17 359 + float shift 18 360 + int_ shift 19 361 + id shift 27 362 + argID shift 12 363 + argBracket shift 13 364 + '"' shift 21 365 + '(' shift 23 366 + '[' shift 24 367 + '{' shift 25 368 + '!' shift 11 369 + '-' shift 10 370 + . error 371 + 372 + Expression goto 60 373 + ID goto 20 374 + Atom goto 15 375 + Select goto 14 376 + Apply goto 9 377 + Op goto 3 378 + Function goto 8 379 + 380 + state 24 381 + Atom: '['.List ']' 382 + List: . (54) 383 + 384 + . reduce 54 (src line 164) 385 + 386 + List goto 61 387 + 388 + state 25 389 + Atom: '{'.Binds '}' 390 + Binds: . (56) 391 + 392 + . reduce 56 (src line 171) 393 + 394 + Binds goto 62 395 + 396 + state 26 397 + Atom: rec.'{' Binds '}' 398 + 399 + '{' shift 63 400 + . error 401 + 402 + 403 + state 27 404 + ID: id. (12) 405 + 406 + . reduce 12 (src line 65) 407 + 408 + 409 + state 28 410 + Op: Op '?'.AttrPath 411 + 412 + or_ shift 67 413 + interp shift 70 414 + id shift 27 415 + '"' shift 69 416 + . error 417 + 418 + Interp goto 68 419 + ID goto 66 420 + InterpID goto 65 421 + AttrPath goto 64 422 + 423 + state 29 424 + Op: Op concat.Op 425 + 426 + rec shift 26 427 + ii shift 22 428 + uri shift 16 429 + path shift 17 430 + float shift 18 431 + int_ shift 19 432 + id shift 27 433 + '"' shift 21 434 + '(' shift 23 435 + '[' shift 24 436 + '{' shift 25 437 + '!' shift 11 438 + '-' shift 10 439 + . error 440 + 441 + ID goto 20 442 + Atom goto 15 443 + Select goto 14 444 + Apply goto 9 445 + Op goto 71 446 + 447 + state 30 448 + Op: Op '/'.Op 449 + 450 + rec shift 26 451 + ii shift 22 452 + uri shift 16 453 + path shift 17 454 + float shift 18 455 + int_ shift 19 456 + id shift 27 457 + '"' shift 21 458 + '(' shift 23 459 + '[' shift 24 460 + '{' shift 25 461 + '!' shift 11 462 + '-' shift 10 463 + . error 464 + 465 + ID goto 20 466 + Atom goto 15 467 + Select goto 14 468 + Apply goto 9 469 + Op goto 72 470 + 471 + state 31 472 + Op: Op '*'.Op 473 + 474 + rec shift 26 475 + ii shift 22 476 + uri shift 16 477 + path shift 17 478 + float shift 18 479 + int_ shift 19 480 + id shift 27 481 + '"' shift 21 482 + '(' shift 23 483 + '[' shift 24 484 + '{' shift 25 485 + '!' shift 11 486 + '-' shift 10 487 + . error 488 + 489 + ID goto 20 490 + Atom goto 15 491 + Select goto 14 492 + Apply goto 9 493 + Op goto 73 494 + 495 + state 32 496 + Op: Op '-'.Op 497 + 498 + rec shift 26 499 + ii shift 22 500 + uri shift 16 501 + path shift 17 502 + float shift 18 503 + int_ shift 19 504 + id shift 27 505 + '"' shift 21 506 + '(' shift 23 507 + '[' shift 24 508 + '{' shift 25 509 + '!' shift 11 510 + '-' shift 10 511 + . error 512 + 513 + ID goto 20 514 + Atom goto 15 515 + Select goto 14 516 + Apply goto 9 517 + Op goto 74 518 + 519 + state 33 520 + Op: Op '+'.Op 521 + 522 + rec shift 26 523 + ii shift 22 524 + uri shift 16 525 + path shift 17 526 + float shift 18 527 + int_ shift 19 528 + id shift 27 529 + '"' shift 21 530 + '(' shift 23 531 + '[' shift 24 532 + '{' shift 25 533 + '!' shift 11 534 + '-' shift 10 535 + . error 536 + 537 + ID goto 20 538 + Atom goto 15 539 + Select goto 14 540 + Apply goto 9 541 + Op goto 75 542 + 543 + state 34 544 + Op: Op update.Op 545 + 546 + rec shift 26 547 + ii shift 22 548 + uri shift 16 549 + path shift 17 550 + float shift 18 551 + int_ shift 19 552 + id shift 27 553 + '"' shift 21 554 + '(' shift 23 555 + '[' shift 24 556 + '{' shift 25 557 + '!' shift 11 558 + '-' shift 10 559 + . error 560 + 561 + ID goto 20 562 + Atom goto 15 563 + Select goto 14 564 + Apply goto 9 565 + Op goto 76 566 + 567 + state 35 568 + Op: Op geq.Op 569 + 570 + rec shift 26 571 + ii shift 22 572 + uri shift 16 573 + path shift 17 574 + float shift 18 575 + int_ shift 19 576 + id shift 27 577 + '"' shift 21 578 + '(' shift 23 579 + '[' shift 24 580 + '{' shift 25 581 + '!' shift 11 582 + '-' shift 10 583 + . error 584 + 585 + ID goto 20 586 + Atom goto 15 587 + Select goto 14 588 + Apply goto 9 589 + Op goto 77 590 + 591 + state 36 592 + Op: Op leq.Op 593 + 594 + rec shift 26 595 + ii shift 22 596 + uri shift 16 597 + path shift 17 598 + float shift 18 599 + int_ shift 19 600 + id shift 27 601 + '"' shift 21 602 + '(' shift 23 603 + '[' shift 24 604 + '{' shift 25 605 + '!' shift 11 606 + '-' shift 10 607 + . error 608 + 609 + ID goto 20 610 + Atom goto 15 611 + Select goto 14 612 + Apply goto 9 613 + Op goto 78 614 + 615 + state 37 616 + Op: Op '>'.Op 617 + 618 + rec shift 26 619 + ii shift 22 620 + uri shift 16 621 + path shift 17 622 + float shift 18 623 + int_ shift 19 624 + id shift 27 625 + '"' shift 21 626 + '(' shift 23 627 + '[' shift 24 628 + '{' shift 25 629 + '!' shift 11 630 + '-' shift 10 631 + . error 632 + 633 + ID goto 20 634 + Atom goto 15 635 + Select goto 14 636 + Apply goto 9 637 + Op goto 79 638 + 639 + state 38 640 + Op: Op '<'.Op 641 + 642 + rec shift 26 643 + ii shift 22 644 + uri shift 16 645 + path shift 17 646 + float shift 18 647 + int_ shift 19 648 + id shift 27 649 + '"' shift 21 650 + '(' shift 23 651 + '[' shift 24 652 + '{' shift 25 653 + '!' shift 11 654 + '-' shift 10 655 + . error 656 + 657 + ID goto 20 658 + Atom goto 15 659 + Select goto 14 660 + Apply goto 9 661 + Op goto 80 662 + 663 + state 39 664 + Op: Op neq.Op 665 + 666 + rec shift 26 667 + ii shift 22 668 + uri shift 16 669 + path shift 17 670 + float shift 18 671 + int_ shift 19 672 + id shift 27 673 + '"' shift 21 674 + '(' shift 23 675 + '[' shift 24 676 + '{' shift 25 677 + '!' shift 11 678 + '-' shift 10 679 + . error 680 + 681 + ID goto 20 682 + Atom goto 15 683 + Select goto 14 684 + Apply goto 9 685 + Op goto 81 686 + 687 + state 40 688 + Op: Op eq.Op 689 + 690 + rec shift 26 691 + ii shift 22 692 + uri shift 16 693 + path shift 17 694 + float shift 18 695 + int_ shift 19 696 + id shift 27 697 + '"' shift 21 698 + '(' shift 23 699 + '[' shift 24 700 + '{' shift 25 701 + '!' shift 11 702 + '-' shift 10 703 + . error 704 + 705 + ID goto 20 706 + Atom goto 15 707 + Select goto 14 708 + Apply goto 9 709 + Op goto 82 710 + 711 + state 41 712 + Op: Op and.Op 713 + 714 + rec shift 26 715 + ii shift 22 716 + uri shift 16 717 + path shift 17 718 + float shift 18 719 + int_ shift 19 720 + id shift 27 721 + '"' shift 21 722 + '(' shift 23 723 + '[' shift 24 724 + '{' shift 25 725 + '!' shift 11 726 + '-' shift 10 727 + . error 728 + 729 + ID goto 20 730 + Atom goto 15 731 + Select goto 14 732 + Apply goto 9 733 + Op goto 83 734 + 735 + state 42 736 + Op: Op or.Op 737 + 738 + rec shift 26 739 + ii shift 22 740 + uri shift 16 741 + path shift 17 742 + float shift 18 743 + int_ shift 19 744 + id shift 27 745 + '"' shift 21 746 + '(' shift 23 747 + '[' shift 24 748 + '{' shift 25 749 + '!' shift 11 750 + '-' shift 10 751 + . error 752 + 753 + ID goto 20 754 + Atom goto 15 755 + Select goto 14 756 + Apply goto 9 757 + Op goto 84 758 + 759 + state 43 760 + Op: Op impl.Op 761 + 762 + rec shift 26 763 + ii shift 22 764 + uri shift 16 765 + path shift 17 766 + float shift 18 767 + int_ shift 19 768 + id shift 27 769 + '"' shift 21 770 + '(' shift 23 771 + '[' shift 24 772 + '{' shift 25 773 + '!' shift 11 774 + '-' shift 10 775 + . error 776 + 777 + ID goto 20 778 + Atom goto 15 779 + Select goto 14 780 + Apply goto 9 781 + Op goto 85 782 + 783 + state 44 784 + Expression: assert_ Expression.';' Expression 785 + 786 + ';' shift 86 787 + . error 788 + 789 + 790 + state 45 791 + Expression: if_ Expression.then Expression else_ Expression 792 + 793 + then shift 87 794 + . error 795 + 796 + 797 + state 46 798 + Expression: let Binds.in Expression 799 + Binds: Binds.AttrPath '=' Expression ';' 800 + Binds: Binds.inherit InheritList ';' 801 + Binds: Binds.inherit '(' Expression ')' InheritList ';' 802 + 803 + in shift 88 804 + or_ shift 67 805 + inherit shift 90 806 + interp shift 70 807 + id shift 27 808 + '"' shift 69 809 + . error 810 + 811 + Interp goto 68 812 + ID goto 66 813 + InterpID goto 65 814 + AttrPath goto 89 815 + 816 + state 47 817 + Expression: with Expression.';' Expression 818 + 819 + ';' shift 91 820 + . error 821 + 822 + 823 + state 48 824 + Apply: Apply Select. (28) 825 + 826 + . reduce 28 (src line 104) 827 + 828 + 829 + state 49 830 + Op: '-' Op. (30) 831 + Op: Op.'?' AttrPath 832 + Op: Op.concat Op 833 + Op: Op.'/' Op 834 + Op: Op.'*' Op 835 + Op: Op.'-' Op 836 + Op: Op.'+' Op 837 + Op: Op.update Op 838 + Op: Op.geq Op 839 + Op: Op.leq Op 840 + Op: Op.'>' Op 841 + Op: Op.'<' Op 842 + Op: Op.neq Op 843 + Op: Op.eq Op 844 + Op: Op.and Op 845 + Op: Op.or Op 846 + Op: Op.impl Op 847 + 848 + . reduce 30 (src line 110) 849 + 850 + 851 + state 50 852 + Op: Op.'?' AttrPath 853 + Op: Op.concat Op 854 + Op: Op.'/' Op 855 + Op: Op.'*' Op 856 + Op: Op.'-' Op 857 + Op: Op.'+' Op 858 + Op: '!' Op. (37) 859 + Op: Op.update Op 860 + Op: Op.geq Op 861 + Op: Op.leq Op 862 + Op: Op.'>' Op 863 + Op: Op.'<' Op 864 + Op: Op.neq Op 865 + Op: Op.eq Op 866 + Op: Op.and Op 867 + Op: Op.or Op 868 + Op: Op.impl Op 869 + 870 + '+' shift 33 871 + '-' shift 32 872 + '*' shift 31 873 + '/' shift 30 874 + concat shift 29 875 + '?' shift 28 876 + . reduce 37 (src line 124) 877 + 878 + 879 + state 51 880 + Function: argID ':'.Expression 881 + 882 + assert_ shift 4 883 + if_ shift 5 884 + let shift 6 885 + with shift 7 886 + rec shift 26 887 + ii shift 22 888 + uri shift 16 889 + path shift 17 890 + float shift 18 891 + int_ shift 19 892 + id shift 27 893 + argID shift 12 894 + argBracket shift 13 895 + '"' shift 21 896 + '(' shift 23 897 + '[' shift 24 898 + '{' shift 25 899 + '!' shift 11 900 + '-' shift 10 901 + . error 902 + 903 + Expression goto 92 904 + ID goto 20 905 + Atom goto 15 906 + Select goto 14 907 + Apply goto 9 908 + Op goto 3 909 + Function goto 8 910 + 911 + state 52 912 + Function: argID '@'.argBracket ArgSet '}' ':' Expression 913 + 914 + argBracket shift 93 915 + . error 916 + 917 + 918 + state 53 919 + Function: argBracket ArgSet.'}' ':' Expression 920 + Function: argBracket ArgSet.'}' '@' argID ':' Expression 921 + 922 + '}' shift 94 923 + . error 924 + 925 + 926 + state 54 927 + ArgSet: Arg. (67) 928 + ArgSet: Arg.',' ArgSet 929 + 930 + ',' shift 95 931 + . reduce 67 (src line 204) 932 + 933 + 934 + state 55 935 + ArgSet: ellipsis. (68) 936 + 937 + . reduce 68 (src line 206) 938 + 939 + 940 + state 56 941 + Arg: ID. (70) 942 + Arg: ID.'?' Expression 943 + 944 + '?' shift 96 945 + . reduce 70 (src line 212) 946 + 947 + 948 + state 57 949 + Select: Atom '.'.AttrPath 950 + Select: Atom '.'.AttrPath or_ Select 951 + 952 + or_ shift 67 953 + interp shift 70 954 + id shift 27 955 + '"' shift 69 956 + . error 957 + 958 + Interp goto 68 959 + ID goto 66 960 + InterpID goto 65 961 + AttrPath goto 97 962 + 963 + state 58 964 + String: String.text 965 + String: String.Interp 966 + Atom: '\"' String.'\"' 967 + 968 + interp shift 70 969 + text shift 98 970 + '"' shift 100 971 + . error 972 + 973 + Interp goto 99 974 + 975 + state 59 976 + String: String.text 977 + String: String.Interp 978 + Atom: ii String.ii 979 + 980 + interp shift 70 981 + ii shift 101 982 + text shift 98 983 + . error 984 + 985 + Interp goto 99 986 + 987 + state 60 988 + Atom: '(' Expression.')' 989 + 990 + ')' shift 102 991 + . error 992 + 993 + 994 + state 61 995 + Atom: '[' List.']' 996 + List: List.Select 997 + 998 + rec shift 26 999 + ii shift 22 1000 + uri shift 16 1001 + path shift 17 1002 + float shift 18 1003 + int_ shift 19 1004 + id shift 27 1005 + '"' shift 21 1006 + '(' shift 23 1007 + '[' shift 24 1008 + ']' shift 103 1009 + '{' shift 25 1010 + . error 1011 + 1012 + ID goto 20 1013 + Atom goto 15 1014 + Select goto 104 1015 + 1016 + state 62 1017 + Atom: '{' Binds.'}' 1018 + Binds: Binds.AttrPath '=' Expression ';' 1019 + Binds: Binds.inherit InheritList ';' 1020 + Binds: Binds.inherit '(' Expression ')' InheritList ';' 1021 + 1022 + or_ shift 67 1023 + inherit shift 90 1024 + interp shift 70 1025 + id shift 27 1026 + '"' shift 69 1027 + '}' shift 105 1028 + . error 1029 + 1030 + Interp goto 68 1031 + ID goto 66 1032 + InterpID goto 65 1033 + AttrPath goto 89 1034 + 1035 + state 63 1036 + Atom: rec '{'.Binds '}' 1037 + Binds: . (56) 1038 + 1039 + . reduce 56 (src line 171) 1040 + 1041 + Binds goto 106 1042 + 1043 + state 64 1044 + Op: Op '?' AttrPath. (31) 1045 + AttrPath: AttrPath.'.' InterpID 1046 + 1047 + '.' shift 107 1048 + . reduce 31 (src line 112) 1049 + 1050 + 1051 + state 65 1052 + AttrPath: InterpID. (52) 1053 + 1054 + . reduce 52 (src line 157) 1055 + 1056 + 1057 + state 66 1058 + InterpID: ID. (48) 1059 + 1060 + . reduce 48 (src line 148) 1061 + 1062 + 1063 + state 67 1064 + InterpID: or_. (49) 1065 + 1066 + . reduce 49 (src line 150) 1067 + 1068 + 1069 + state 68 1070 + InterpID: Interp. (50) 1071 + 1072 + . reduce 50 (src line 152) 1073 + 1074 + 1075 + state 69 1076 + InterpID: '\"'.String '\"' 1077 + String: . (9) 1078 + 1079 + . reduce 9 (src line 56) 1080 + 1081 + String goto 108 1082 + 1083 + state 70 1084 + Interp: interp.Expression '}' 1085 + 1086 + assert_ shift 4 1087 + if_ shift 5 1088 + let shift 6 1089 + with shift 7 1090 + rec shift 26 1091 + ii shift 22 1092 + uri shift 16 1093 + path shift 17 1094 + float shift 18 1095 + int_ shift 19 1096 + id shift 27 1097 + argID shift 12 1098 + argBracket shift 13 1099 + '"' shift 21 1100 + '(' shift 23 1101 + '[' shift 24 1102 + '{' shift 25 1103 + '!' shift 11 1104 + '-' shift 10 1105 + . error 1106 + 1107 + Expression goto 109 1108 + ID goto 20 1109 + Atom goto 15 1110 + Select goto 14 1111 + Apply goto 9 1112 + Op goto 3 1113 + Function goto 8 1114 + 1115 + state 71 1116 + Op: Op.'?' AttrPath 1117 + Op: Op.concat Op 1118 + Op: Op concat Op. (32) 1119 + Op: Op.'/' Op 1120 + Op: Op.'*' Op 1121 + Op: Op.'-' Op 1122 + Op: Op.'+' Op 1123 + Op: Op.update Op 1124 + Op: Op.geq Op 1125 + Op: Op.leq Op 1126 + Op: Op.'>' Op 1127 + Op: Op.'<' Op 1128 + Op: Op.neq Op 1129 + Op: Op.eq Op 1130 + Op: Op.and Op 1131 + Op: Op.or Op 1132 + Op: Op.impl Op 1133 + 1134 + concat shift 29 1135 + '?' shift 28 1136 + . reduce 32 (src line 114) 1137 + 1138 + 1139 + state 72 1140 + Op: Op.'?' AttrPath 1141 + Op: Op.concat Op 1142 + Op: Op.'/' Op 1143 + Op: Op '/' Op. (33) 1144 + Op: Op.'*' Op 1145 + Op: Op.'-' Op 1146 + Op: Op.'+' Op 1147 + Op: Op.update Op 1148 + Op: Op.geq Op 1149 + Op: Op.leq Op 1150 + Op: Op.'>' Op 1151 + Op: Op.'<' Op 1152 + Op: Op.neq Op 1153 + Op: Op.eq Op 1154 + Op: Op.and Op 1155 + Op: Op.or Op 1156 + Op: Op.impl Op 1157 + 1158 + concat shift 29 1159 + '?' shift 28 1160 + . reduce 33 (src line 116) 1161 + 1162 + 1163 + state 73 1164 + Op: Op.'?' AttrPath 1165 + Op: Op.concat Op 1166 + Op: Op.'/' Op 1167 + Op: Op.'*' Op 1168 + Op: Op '*' Op. (34) 1169 + Op: Op.'-' Op 1170 + Op: Op.'+' Op 1171 + Op: Op.update Op 1172 + Op: Op.geq Op 1173 + Op: Op.leq Op 1174 + Op: Op.'>' Op 1175 + Op: Op.'<' Op 1176 + Op: Op.neq Op 1177 + Op: Op.eq Op 1178 + Op: Op.and Op 1179 + Op: Op.or Op 1180 + Op: Op.impl Op 1181 + 1182 + concat shift 29 1183 + '?' shift 28 1184 + . reduce 34 (src line 118) 1185 + 1186 + 1187 + state 74 1188 + Op: Op.'?' AttrPath 1189 + Op: Op.concat Op 1190 + Op: Op.'/' Op 1191 + Op: Op.'*' Op 1192 + Op: Op.'-' Op 1193 + Op: Op '-' Op. (35) 1194 + Op: Op.'+' Op 1195 + Op: Op.update Op 1196 + Op: Op.geq Op 1197 + Op: Op.leq Op 1198 + Op: Op.'>' Op 1199 + Op: Op.'<' Op 1200 + Op: Op.neq Op 1201 + Op: Op.eq Op 1202 + Op: Op.and Op 1203 + Op: Op.or Op 1204 + Op: Op.impl Op 1205 + 1206 + '*' shift 31 1207 + '/' shift 30 1208 + concat shift 29 1209 + '?' shift 28 1210 + . reduce 35 (src line 120) 1211 + 1212 + 1213 + state 75 1214 + Op: Op.'?' AttrPath 1215 + Op: Op.concat Op 1216 + Op: Op.'/' Op 1217 + Op: Op.'*' Op 1218 + Op: Op.'-' Op 1219 + Op: Op.'+' Op 1220 + Op: Op '+' Op. (36) 1221 + Op: Op.update Op 1222 + Op: Op.geq Op 1223 + Op: Op.leq Op 1224 + Op: Op.'>' Op 1225 + Op: Op.'<' Op 1226 + Op: Op.neq Op 1227 + Op: Op.eq Op 1228 + Op: Op.and Op 1229 + Op: Op.or Op 1230 + Op: Op.impl Op 1231 + 1232 + '*' shift 31 1233 + '/' shift 30 1234 + concat shift 29 1235 + '?' shift 28 1236 + . reduce 36 (src line 122) 1237 + 1238 + 1239 + state 76 1240 + Op: Op.'?' AttrPath 1241 + Op: Op.concat Op 1242 + Op: Op.'/' Op 1243 + Op: Op.'*' Op 1244 + Op: Op.'-' Op 1245 + Op: Op.'+' Op 1246 + Op: Op.update Op 1247 + Op: Op update Op. (38) 1248 + Op: Op.geq Op 1249 + Op: Op.leq Op 1250 + Op: Op.'>' Op 1251 + Op: Op.'<' Op 1252 + Op: Op.neq Op 1253 + Op: Op.eq Op 1254 + Op: Op.and Op 1255 + Op: Op.or Op 1256 + Op: Op.impl Op 1257 + 1258 + update shift 34 1259 + '+' shift 33 1260 + '-' shift 32 1261 + '*' shift 31 1262 + '/' shift 30 1263 + concat shift 29 1264 + '?' shift 28 1265 + . reduce 38 (src line 126) 1266 + 1267 + 1268 + state 77 1269 + Op: Op.'?' AttrPath 1270 + Op: Op.concat Op 1271 + Op: Op.'/' Op 1272 + Op: Op.'*' Op 1273 + Op: Op.'-' Op 1274 + Op: Op.'+' Op 1275 + Op: Op.update Op 1276 + Op: Op.geq Op 1277 + Op: Op geq Op. (39) 1278 + Op: Op.leq Op 1279 + Op: Op.'>' Op 1280 + Op: Op.'<' Op 1281 + Op: Op.neq Op 1282 + Op: Op.eq Op 1283 + Op: Op.and Op 1284 + Op: Op.or Op 1285 + Op: Op.impl Op 1286 + 1287 + update shift 34 1288 + '+' shift 33 1289 + '-' shift 32 1290 + '*' shift 31 1291 + '/' shift 30 1292 + concat shift 29 1293 + '?' shift 28 1294 + . reduce 39 (src line 128) 1295 + 1296 + 1297 + state 78 1298 + Op: Op.'?' AttrPath 1299 + Op: Op.concat Op 1300 + Op: Op.'/' Op 1301 + Op: Op.'*' Op 1302 + Op: Op.'-' Op 1303 + Op: Op.'+' Op 1304 + Op: Op.update Op 1305 + Op: Op.geq Op 1306 + Op: Op.leq Op 1307 + Op: Op leq Op. (40) 1308 + Op: Op.'>' Op 1309 + Op: Op.'<' Op 1310 + Op: Op.neq Op 1311 + Op: Op.eq Op 1312 + Op: Op.and Op 1313 + Op: Op.or Op 1314 + Op: Op.impl Op 1315 + 1316 + update shift 34 1317 + '+' shift 33 1318 + '-' shift 32 1319 + '*' shift 31 1320 + '/' shift 30 1321 + concat shift 29 1322 + '?' shift 28 1323 + . reduce 40 (src line 130) 1324 + 1325 + 1326 + state 79 1327 + Op: Op.'?' AttrPath 1328 + Op: Op.concat Op 1329 + Op: Op.'/' Op 1330 + Op: Op.'*' Op 1331 + Op: Op.'-' Op 1332 + Op: Op.'+' Op 1333 + Op: Op.update Op 1334 + Op: Op.geq Op 1335 + Op: Op.leq Op 1336 + Op: Op.'>' Op 1337 + Op: Op '>' Op. (41) 1338 + Op: Op.'<' Op 1339 + Op: Op.neq Op 1340 + Op: Op.eq Op 1341 + Op: Op.and Op 1342 + Op: Op.or Op 1343 + Op: Op.impl Op 1344 + 1345 + update shift 34 1346 + '+' shift 33 1347 + '-' shift 32 1348 + '*' shift 31 1349 + '/' shift 30 1350 + concat shift 29 1351 + '?' shift 28 1352 + . reduce 41 (src line 132) 1353 + 1354 + 1355 + state 80 1356 + Op: Op.'?' AttrPath 1357 + Op: Op.concat Op 1358 + Op: Op.'/' Op 1359 + Op: Op.'*' Op 1360 + Op: Op.'-' Op 1361 + Op: Op.'+' Op 1362 + Op: Op.update Op 1363 + Op: Op.geq Op 1364 + Op: Op.leq Op 1365 + Op: Op.'>' Op 1366 + Op: Op.'<' Op 1367 + Op: Op '<' Op. (42) 1368 + Op: Op.neq Op 1369 + Op: Op.eq Op 1370 + Op: Op.and Op 1371 + Op: Op.or Op 1372 + Op: Op.impl Op 1373 + 1374 + update shift 34 1375 + '+' shift 33 1376 + '-' shift 32 1377 + '*' shift 31 1378 + '/' shift 30 1379 + concat shift 29 1380 + '?' shift 28 1381 + . reduce 42 (src line 134) 1382 + 1383 + 1384 + state 81 1385 + Op: Op.'?' AttrPath 1386 + Op: Op.concat Op 1387 + Op: Op.'/' Op 1388 + Op: Op.'*' Op 1389 + Op: Op.'-' Op 1390 + Op: Op.'+' Op 1391 + Op: Op.update Op 1392 + Op: Op.geq Op 1393 + Op: Op.leq Op 1394 + Op: Op.'>' Op 1395 + Op: Op.'<' Op 1396 + Op: Op.neq Op 1397 + Op: Op neq Op. (43) 1398 + Op: Op.eq Op 1399 + Op: Op.and Op 1400 + Op: Op.or Op 1401 + Op: Op.impl Op 1402 + 1403 + eq error 1404 + neq error 1405 + '<' shift 38 1406 + '>' shift 37 1407 + leq shift 36 1408 + geq shift 35 1409 + update shift 34 1410 + '+' shift 33 1411 + '-' shift 32 1412 + '*' shift 31 1413 + '/' shift 30 1414 + concat shift 29 1415 + '?' shift 28 1416 + . reduce 43 (src line 136) 1417 + 1418 + 1419 + state 82 1420 + Op: Op.'?' AttrPath 1421 + Op: Op.concat Op 1422 + Op: Op.'/' Op 1423 + Op: Op.'*' Op 1424 + Op: Op.'-' Op 1425 + Op: Op.'+' Op 1426 + Op: Op.update Op 1427 + Op: Op.geq Op 1428 + Op: Op.leq Op 1429 + Op: Op.'>' Op 1430 + Op: Op.'<' Op 1431 + Op: Op.neq Op 1432 + Op: Op.eq Op 1433 + Op: Op eq Op. (44) 1434 + Op: Op.and Op 1435 + Op: Op.or Op 1436 + Op: Op.impl Op 1437 + 1438 + eq error 1439 + neq error 1440 + '<' shift 38 1441 + '>' shift 37 1442 + leq shift 36 1443 + geq shift 35 1444 + update shift 34 1445 + '+' shift 33 1446 + '-' shift 32 1447 + '*' shift 31 1448 + '/' shift 30 1449 + concat shift 29 1450 + '?' shift 28 1451 + . reduce 44 (src line 138) 1452 + 1453 + 1454 + state 83 1455 + Op: Op.'?' AttrPath 1456 + Op: Op.concat Op 1457 + Op: Op.'/' Op 1458 + Op: Op.'*' Op 1459 + Op: Op.'-' Op 1460 + Op: Op.'+' Op 1461 + Op: Op.update Op 1462 + Op: Op.geq Op 1463 + Op: Op.leq Op 1464 + Op: Op.'>' Op 1465 + Op: Op.'<' Op 1466 + Op: Op.neq Op 1467 + Op: Op.eq Op 1468 + Op: Op.and Op 1469 + Op: Op and Op. (45) 1470 + Op: Op.or Op 1471 + Op: Op.impl Op 1472 + 1473 + eq shift 40 1474 + neq shift 39 1475 + '<' shift 38 1476 + '>' shift 37 1477 + leq shift 36 1478 + geq shift 35 1479 + update shift 34 1480 + '+' shift 33 1481 + '-' shift 32 1482 + '*' shift 31 1483 + '/' shift 30 1484 + concat shift 29 1485 + '?' shift 28 1486 + . reduce 45 (src line 140) 1487 + 1488 + 1489 + state 84 1490 + Op: Op.'?' AttrPath 1491 + Op: Op.concat Op 1492 + Op: Op.'/' Op 1493 + Op: Op.'*' Op 1494 + Op: Op.'-' Op 1495 + Op: Op.'+' Op 1496 + Op: Op.update Op 1497 + Op: Op.geq Op 1498 + Op: Op.leq Op 1499 + Op: Op.'>' Op 1500 + Op: Op.'<' Op 1501 + Op: Op.neq Op 1502 + Op: Op.eq Op 1503 + Op: Op.and Op 1504 + Op: Op.or Op 1505 + Op: Op or Op. (46) 1506 + Op: Op.impl Op 1507 + 1508 + and shift 41 1509 + eq shift 40 1510 + neq shift 39 1511 + '<' shift 38 1512 + '>' shift 37 1513 + leq shift 36 1514 + geq shift 35 1515 + update shift 34 1516 + '+' shift 33 1517 + '-' shift 32 1518 + '*' shift 31 1519 + '/' shift 30 1520 + concat shift 29 1521 + '?' shift 28 1522 + . reduce 46 (src line 142) 1523 + 1524 + 1525 + state 85 1526 + Op: Op.'?' AttrPath 1527 + Op: Op.concat Op 1528 + Op: Op.'/' Op 1529 + Op: Op.'*' Op 1530 + Op: Op.'-' Op 1531 + Op: Op.'+' Op 1532 + Op: Op.update Op 1533 + Op: Op.geq Op 1534 + Op: Op.leq Op 1535 + Op: Op.'>' Op 1536 + Op: Op.'<' Op 1537 + Op: Op.neq Op 1538 + Op: Op.eq Op 1539 + Op: Op.and Op 1540 + Op: Op.or Op 1541 + Op: Op.impl Op 1542 + Op: Op impl Op. (47) 1543 + 1544 + impl shift 43 1545 + or shift 42 1546 + and shift 41 1547 + eq shift 40 1548 + neq shift 39 1549 + '<' shift 38 1550 + '>' shift 37 1551 + leq shift 36 1552 + geq shift 35 1553 + update shift 34 1554 + '+' shift 33 1555 + '-' shift 32 1556 + '*' shift 31 1557 + '/' shift 30 1558 + concat shift 29 1559 + '?' shift 28 1560 + . reduce 47 (src line 144) 1561 + 1562 + 1563 + state 86 1564 + Expression: assert_ Expression ';'.Expression 1565 + 1566 + assert_ shift 4 1567 + if_ shift 5 1568 + let shift 6 1569 + with shift 7 1570 + rec shift 26 1571 + ii shift 22 1572 + uri shift 16 1573 + path shift 17 1574 + float shift 18 1575 + int_ shift 19 1576 + id shift 27 1577 + argID shift 12 1578 + argBracket shift 13 1579 + '"' shift 21 1580 + '(' shift 23 1581 + '[' shift 24 1582 + '{' shift 25 1583 + '!' shift 11 1584 + '-' shift 10 1585 + . error 1586 + 1587 + Expression goto 110 1588 + ID goto 20 1589 + Atom goto 15 1590 + Select goto 14 1591 + Apply goto 9 1592 + Op goto 3 1593 + Function goto 8 1594 + 1595 + state 87 1596 + Expression: if_ Expression then.Expression else_ Expression 1597 + 1598 + assert_ shift 4 1599 + if_ shift 5 1600 + let shift 6 1601 + with shift 7 1602 + rec shift 26 1603 + ii shift 22 1604 + uri shift 16 1605 + path shift 17 1606 + float shift 18 1607 + int_ shift 19 1608 + id shift 27 1609 + argID shift 12 1610 + argBracket shift 13 1611 + '"' shift 21 1612 + '(' shift 23 1613 + '[' shift 24 1614 + '{' shift 25 1615 + '!' shift 11 1616 + '-' shift 10 1617 + . error 1618 + 1619 + Expression goto 111 1620 + ID goto 20 1621 + Atom goto 15 1622 + Select goto 14 1623 + Apply goto 9 1624 + Op goto 3 1625 + Function goto 8 1626 + 1627 + state 88 1628 + Expression: let Binds in.Expression 1629 + 1630 + assert_ shift 4 1631 + if_ shift 5 1632 + let shift 6 1633 + with shift 7 1634 + rec shift 26 1635 + ii shift 22 1636 + uri shift 16 1637 + path shift 17 1638 + float shift 18 1639 + int_ shift 19 1640 + id shift 27 1641 + argID shift 12 1642 + argBracket shift 13 1643 + '"' shift 21 1644 + '(' shift 23 1645 + '[' shift 24 1646 + '{' shift 25 1647 + '!' shift 11 1648 + '-' shift 10 1649 + . error 1650 + 1651 + Expression goto 112 1652 + ID goto 20 1653 + Atom goto 15 1654 + Select goto 14 1655 + Apply goto 9 1656 + Op goto 3 1657 + Function goto 8 1658 + 1659 + state 89 1660 + AttrPath: AttrPath.'.' InterpID 1661 + Binds: Binds AttrPath.'=' Expression ';' 1662 + 1663 + '.' shift 107 1664 + '=' shift 113 1665 + . error 1666 + 1667 + 1668 + state 90 1669 + Binds: Binds inherit.InheritList ';' 1670 + Binds: Binds inherit.'(' Expression ')' InheritList ';' 1671 + InheritList: . (60) 1672 + 1673 + '(' shift 115 1674 + . reduce 60 (src line 182) 1675 + 1676 + InheritList goto 114 1677 + 1678 + state 91 1679 + Expression: with Expression ';'.Expression 1680 + 1681 + assert_ shift 4 1682 + if_ shift 5 1683 + let shift 6 1684 + with shift 7 1685 + rec shift 26 1686 + ii shift 22 1687 + uri shift 16 1688 + path shift 17 1689 + float shift 18 1690 + int_ shift 19 1691 + id shift 27 1692 + argID shift 12 1693 + argBracket shift 13 1694 + '"' shift 21 1695 + '(' shift 23 1696 + '[' shift 24 1697 + '{' shift 25 1698 + '!' shift 11 1699 + '-' shift 10 1700 + . error 1701 + 1702 + Expression goto 116 1703 + ID goto 20 1704 + Atom goto 15 1705 + Select goto 14 1706 + Apply goto 9 1707 + Op goto 3 1708 + Function goto 8 1709 + 1710 + state 92 1711 + Function: argID ':' Expression. (62) 1712 + 1713 + . reduce 62 (src line 190) 1714 + 1715 + 1716 + state 93 1717 + Function: argID '@' argBracket.ArgSet '}' ':' Expression 1718 + ArgSet: . (66) 1719 + 1720 + ellipsis shift 55 1721 + id shift 27 1722 + . reduce 66 (src line 201) 1723 + 1724 + ID goto 56 1725 + ArgSet goto 117 1726 + Arg goto 54 1727 + 1728 + state 94 1729 + Function: argBracket ArgSet '}'.':' Expression 1730 + Function: argBracket ArgSet '}'.'@' argID ':' Expression 1731 + 1732 + ':' shift 118 1733 + '@' shift 119 1734 + . error 1735 + 1736 + 1737 + state 95 1738 + ArgSet: Arg ','.ArgSet 1739 + ArgSet: . (66) 1740 + 1741 + ellipsis shift 55 1742 + id shift 27 1743 + . reduce 66 (src line 201) 1744 + 1745 + ID goto 56 1746 + ArgSet goto 120 1747 + Arg goto 54 1748 + 1749 + state 96 1750 + Arg: ID '?'.Expression 1751 + 1752 + assert_ shift 4 1753 + if_ shift 5 1754 + let shift 6 1755 + with shift 7 1756 + rec shift 26 1757 + ii shift 22 1758 + uri shift 16 1759 + path shift 17 1760 + float shift 18 1761 + int_ shift 19 1762 + id shift 27 1763 + argID shift 12 1764 + argBracket shift 13 1765 + '"' shift 21 1766 + '(' shift 23 1767 + '[' shift 24 1768 + '{' shift 25 1769 + '!' shift 11 1770 + '-' shift 10 1771 + . error 1772 + 1773 + Expression goto 121 1774 + ID goto 20 1775 + Atom goto 15 1776 + Select goto 14 1777 + Apply goto 9 1778 + Op goto 3 1779 + Function goto 8 1780 + 1781 + state 97 1782 + Select: Atom '.' AttrPath. (25) 1783 + Select: Atom '.' AttrPath.or_ Select 1784 + AttrPath: AttrPath.'.' InterpID 1785 + 1786 + or_ shift 122 1787 + '.' shift 107 1788 + . reduce 25 (src line 96) 1789 + 1790 + 1791 + state 98 1792 + String: String text. (10) 1793 + 1794 + . reduce 10 (src line 59) 1795 + 1796 + 1797 + state 99 1798 + String: String Interp. (11) 1799 + 1800 + . reduce 11 (src line 61) 1801 + 1802 + 1803 + state 100 1804 + Atom: '\"' String '\"'. (18) 1805 + 1806 + . reduce 18 (src line 80) 1807 + 1808 + 1809 + state 101 1810 + Atom: ii String ii. (19) 1811 + 1812 + . reduce 19 (src line 82) 1813 + 1814 + 1815 + state 102 1816 + Atom: '(' Expression ')'. (20) 1817 + 1818 + . reduce 20 (src line 84) 1819 + 1820 + 1821 + state 103 1822 + Atom: '[' List ']'. (21) 1823 + 1824 + . reduce 21 (src line 86) 1825 + 1826 + 1827 + state 104 1828 + List: List Select. (55) 1829 + 1830 + . reduce 55 (src line 167) 1831 + 1832 + 1833 + state 105 1834 + Atom: '{' Binds '}'. (22) 1835 + 1836 + . reduce 22 (src line 88) 1837 + 1838 + 1839 + state 106 1840 + Atom: rec '{' Binds.'}' 1841 + Binds: Binds.AttrPath '=' Expression ';' 1842 + Binds: Binds.inherit InheritList ';' 1843 + Binds: Binds.inherit '(' Expression ')' InheritList ';' 1844 + 1845 + or_ shift 67 1846 + inherit shift 90 1847 + interp shift 70 1848 + id shift 27 1849 + '"' shift 69 1850 + '}' shift 123 1851 + . error 1852 + 1853 + Interp goto 68 1854 + ID goto 66 1855 + InterpID goto 65 1856 + AttrPath goto 89 1857 + 1858 + state 107 1859 + AttrPath: AttrPath '.'.InterpID 1860 + 1861 + or_ shift 67 1862 + interp shift 70 1863 + id shift 27 1864 + '"' shift 69 1865 + . error 1866 + 1867 + Interp goto 68 1868 + ID goto 66 1869 + InterpID goto 124 1870 + 1871 + state 108 1872 + String: String.text 1873 + String: String.Interp 1874 + InterpID: '\"' String.'\"' 1875 + 1876 + interp shift 70 1877 + text shift 98 1878 + '"' shift 125 1879 + . error 1880 + 1881 + Interp goto 99 1882 + 1883 + state 109 1884 + Interp: interp Expression.'}' 1885 + 1886 + '}' shift 126 1887 + . error 1888 + 1889 + 1890 + state 110 1891 + Expression: assert_ Expression ';' Expression. (3) 1892 + 1893 + . reduce 3 (src line 40) 1894 + 1895 + 1896 + state 111 1897 + Expression: if_ Expression then Expression.else_ Expression 1898 + 1899 + else_ shift 127 1900 + . error 1901 + 1902 + 1903 + state 112 1904 + Expression: let Binds in Expression. (5) 1905 + 1906 + . reduce 5 (src line 44) 1907 + 1908 + 1909 + state 113 1910 + Binds: Binds AttrPath '='.Expression ';' 1911 + 1912 + assert_ shift 4 1913 + if_ shift 5 1914 + let shift 6 1915 + with shift 7 1916 + rec shift 26 1917 + ii shift 22 1918 + uri shift 16 1919 + path shift 17 1920 + float shift 18 1921 + int_ shift 19 1922 + id shift 27 1923 + argID shift 12 1924 + argBracket shift 13 1925 + '"' shift 21 1926 + '(' shift 23 1927 + '[' shift 24 1928 + '{' shift 25 1929 + '!' shift 11 1930 + '-' shift 10 1931 + . error 1932 + 1933 + Expression goto 128 1934 + ID goto 20 1935 + Atom goto 15 1936 + Select goto 14 1937 + Apply goto 9 1938 + Op goto 3 1939 + Function goto 8 1940 + 1941 + state 114 1942 + Binds: Binds inherit InheritList.';' 1943 + InheritList: InheritList.InterpID 1944 + 1945 + or_ shift 67 1946 + interp shift 70 1947 + id shift 27 1948 + ';' shift 129 1949 + '"' shift 69 1950 + . error 1951 + 1952 + Interp goto 68 1953 + ID goto 66 1954 + InterpID goto 130 1955 + 1956 + state 115 1957 + Binds: Binds inherit '('.Expression ')' InheritList ';' 1958 + 1959 + assert_ shift 4 1960 + if_ shift 5 1961 + let shift 6 1962 + with shift 7 1963 + rec shift 26 1964 + ii shift 22 1965 + uri shift 16 1966 + path shift 17 1967 + float shift 18 1968 + int_ shift 19 1969 + id shift 27 1970 + argID shift 12 1971 + argBracket shift 13 1972 + '"' shift 21 1973 + '(' shift 23 1974 + '[' shift 24 1975 + '{' shift 25 1976 + '!' shift 11 1977 + '-' shift 10 1978 + . error 1979 + 1980 + Expression goto 131 1981 + ID goto 20 1982 + Atom goto 15 1983 + Select goto 14 1984 + Apply goto 9 1985 + Op goto 3 1986 + Function goto 8 1987 + 1988 + state 116 1989 + Expression: with Expression ';' Expression. (6) 1990 + 1991 + . reduce 6 (src line 46) 1992 + 1993 + 1994 + state 117 1995 + Function: argID '@' argBracket ArgSet.'}' ':' Expression 1996 + 1997 + '}' shift 132 1998 + . error 1999 + 2000 + 2001 + state 118 2002 + Function: argBracket ArgSet '}' ':'.Expression 2003 + 2004 + assert_ shift 4 2005 + if_ shift 5 2006 + let shift 6 2007 + with shift 7 2008 + rec shift 26 2009 + ii shift 22 2010 + uri shift 16 2011 + path shift 17 2012 + float shift 18 2013 + int_ shift 19 2014 + id shift 27 2015 + argID shift 12 2016 + argBracket shift 13 2017 + '"' shift 21 2018 + '(' shift 23 2019 + '[' shift 24 2020 + '{' shift 25 2021 + '!' shift 11 2022 + '-' shift 10 2023 + . error 2024 + 2025 + Expression goto 133 2026 + ID goto 20 2027 + Atom goto 15 2028 + Select goto 14 2029 + Apply goto 9 2030 + Op goto 3 2031 + Function goto 8 2032 + 2033 + state 119 2034 + Function: argBracket ArgSet '}' '@'.argID ':' Expression 2035 + 2036 + argID shift 134 2037 + . error 2038 + 2039 + 2040 + state 120 2041 + ArgSet: Arg ',' ArgSet. (69) 2042 + 2043 + . reduce 69 (src line 208) 2044 + 2045 + 2046 + state 121 2047 + Arg: ID '?' Expression. (71) 2048 + 2049 + . reduce 71 (src line 215) 2050 + 2051 + 2052 + state 122 2053 + Select: Atom '.' AttrPath or_.Select 2054 + 2055 + rec shift 26 2056 + ii shift 22 2057 + uri shift 16 2058 + path shift 17 2059 + float shift 18 2060 + int_ shift 19 2061 + id shift 27 2062 + '"' shift 21 2063 + '(' shift 23 2064 + '[' shift 24 2065 + '{' shift 25 2066 + . error 2067 + 2068 + ID goto 20 2069 + Atom goto 15 2070 + Select goto 135 2071 + 2072 + state 123 2073 + Atom: rec '{' Binds '}'. (23) 2074 + 2075 + . reduce 23 (src line 90) 2076 + 2077 + 2078 + state 124 2079 + AttrPath: AttrPath '.' InterpID. (53) 2080 + 2081 + . reduce 53 (src line 160) 2082 + 2083 + 2084 + state 125 2085 + InterpID: '\"' String '\"'. (51) 2086 + 2087 + . reduce 51 (src line 153) 2088 + 2089 + 2090 + state 126 2091 + Interp: interp Expression '}'. (8) 2092 + 2093 + . reduce 8 (src line 51) 2094 + 2095 + 2096 + state 127 2097 + Expression: if_ Expression then Expression else_.Expression 2098 + 2099 + assert_ shift 4 2100 + if_ shift 5 2101 + let shift 6 2102 + with shift 7 2103 + rec shift 26 2104 + ii shift 22 2105 + uri shift 16 2106 + path shift 17 2107 + float shift 18 2108 + int_ shift 19 2109 + id shift 27 2110 + argID shift 12 2111 + argBracket shift 13 2112 + '"' shift 21 2113 + '(' shift 23 2114 + '[' shift 24 2115 + '{' shift 25 2116 + '!' shift 11 2117 + '-' shift 10 2118 + . error 2119 + 2120 + Expression goto 136 2121 + ID goto 20 2122 + Atom goto 15 2123 + Select goto 14 2124 + Apply goto 9 2125 + Op goto 3 2126 + Function goto 8 2127 + 2128 + state 128 2129 + Binds: Binds AttrPath '=' Expression.';' 2130 + 2131 + ';' shift 137 2132 + . error 2133 + 2134 + 2135 + state 129 2136 + Binds: Binds inherit InheritList ';'. (58) 2137 + 2138 + . reduce 58 (src line 176) 2139 + 2140 + 2141 + state 130 2142 + InheritList: InheritList InterpID. (61) 2143 + 2144 + . reduce 61 (src line 185) 2145 + 2146 + 2147 + state 131 2148 + Binds: Binds inherit '(' Expression.')' InheritList ';' 2149 + 2150 + ')' shift 138 2151 + . error 2152 + 2153 + 2154 + state 132 2155 + Function: argID '@' argBracket ArgSet '}'.':' Expression 2156 + 2157 + ':' shift 139 2158 + . error 2159 + 2160 + 2161 + state 133 2162 + Function: argBracket ArgSet '}' ':' Expression. (63) 2163 + 2164 + . reduce 63 (src line 193) 2165 + 2166 + 2167 + state 134 2168 + Function: argBracket ArgSet '}' '@' argID.':' Expression 2169 + 2170 + ':' shift 140 2171 + . error 2172 + 2173 + 2174 + state 135 2175 + Select: Atom '.' AttrPath or_ Select. (26) 2176 + 2177 + . reduce 26 (src line 98) 2178 + 2179 + 2180 + state 136 2181 + Expression: if_ Expression then Expression else_ Expression. (4) 2182 + 2183 + . reduce 4 (src line 42) 2184 + 2185 + 2186 + state 137 2187 + Binds: Binds AttrPath '=' Expression ';'. (57) 2188 + 2189 + . reduce 57 (src line 174) 2190 + 2191 + 2192 + state 138 2193 + Binds: Binds inherit '(' Expression ')'.InheritList ';' 2194 + InheritList: . (60) 2195 + 2196 + . reduce 60 (src line 182) 2197 + 2198 + InheritList goto 141 2199 + 2200 + state 139 2201 + Function: argID '@' argBracket ArgSet '}' ':'.Expression 2202 + 2203 + assert_ shift 4 2204 + if_ shift 5 2205 + let shift 6 2206 + with shift 7 2207 + rec shift 26 2208 + ii shift 22 2209 + uri shift 16 2210 + path shift 17 2211 + float shift 18 2212 + int_ shift 19 2213 + id shift 27 2214 + argID shift 12 2215 + argBracket shift 13 2216 + '"' shift 21 2217 + '(' shift 23 2218 + '[' shift 24 2219 + '{' shift 25 2220 + '!' shift 11 2221 + '-' shift 10 2222 + . error 2223 + 2224 + Expression goto 142 2225 + ID goto 20 2226 + Atom goto 15 2227 + Select goto 14 2228 + Apply goto 9 2229 + Op goto 3 2230 + Function goto 8 2231 + 2232 + state 140 2233 + Function: argBracket ArgSet '}' '@' argID ':'.Expression 2234 + 2235 + assert_ shift 4 2236 + if_ shift 5 2237 + let shift 6 2238 + with shift 7 2239 + rec shift 26 2240 + ii shift 22 2241 + uri shift 16 2242 + path shift 17 2243 + float shift 18 2244 + int_ shift 19 2245 + id shift 27 2246 + argID shift 12 2247 + argBracket shift 13 2248 + '"' shift 21 2249 + '(' shift 23 2250 + '[' shift 24 2251 + '{' shift 25 2252 + '!' shift 11 2253 + '-' shift 10 2254 + . error 2255 + 2256 + Expression goto 143 2257 + ID goto 20 2258 + Atom goto 15 2259 + Select goto 14 2260 + Apply goto 9 2261 + Op goto 3 2262 + Function goto 8 2263 + 2264 + state 141 2265 + Binds: Binds inherit '(' Expression ')' InheritList.';' 2266 + InheritList: InheritList.InterpID 2267 + 2268 + or_ shift 67 2269 + interp shift 70 2270 + id shift 27 2271 + ';' shift 144 2272 + '"' shift 69 2273 + . error 2274 + 2275 + Interp goto 68 2276 + ID goto 66 2277 + InterpID goto 130 2278 + 2279 + state 142 2280 + Function: argID '@' argBracket ArgSet '}' ':' Expression. (64) 2281 + 2282 + . reduce 64 (src line 195) 2283 + 2284 + 2285 + state 143 2286 + Function: argBracket ArgSet '}' '@' argID ':' Expression. (65) 2287 + 2288 + . reduce 65 (src line 197) 2289 + 2290 + 2291 + state 144 2292 + Binds: Binds inherit '(' Expression ')' InheritList ';'. (59) 2293 + 2294 + . reduce 59 (src line 178) 2295 + 2296 + 2297 + 57 terminals, 18 nonterminals 2298 + 72 grammar rules, 145/16000 states 2299 + 0 shift/reduce, 0 reduce/reduce conflicts reported 2300 + 67 working sets used 2301 + memory: parser 304/240000 2302 + 119 extra closures 2303 + 816 shift entries, 5 exceptions 2304 + 80 goto entries 2305 + 191 entries saved by goto default 2306 + Optimizer space used: output 354/240000 2307 + 354 table entries, 75 zero 2308 + maximum spread: 56, maximum offset: 141
+62
test-examples.sh
···
··· 1 + #!/bin/bash 2 + 3 + # Test all examples and verify outputs 4 + 5 + echo "Testing godnix compiler examples..." 6 + echo "===================================" 7 + echo 8 + 9 + cd "$(dirname "$0")" 10 + 11 + # Test 1: Simple integer 12 + echo "Test 1: Simple integer (42)" 13 + result=$(./godnix examples/simple.nix 2>/dev/null) 14 + if [ "$result" = "42" ]; then 15 + echo "✓ PASS" 16 + else 17 + echo "✗ FAIL: Expected 42, got $result" 18 + fi 19 + echo 20 + 21 + # Test 2: Addition 22 + echo "Test 2: Addition (2 + 3)" 23 + result=$(./godnix examples/add.nix 2>/dev/null) 24 + if [ "$result" = "5" ]; then 25 + echo "✓ PASS" 26 + else 27 + echo "✗ FAIL: Expected 5, got $result" 28 + fi 29 + echo 30 + 31 + # Test 3: Identity function 32 + echo "Test 3: Identity function ((x: x) 7)" 33 + result=$(./godnix examples/identity.nix 2>/dev/null) 34 + if [ "$result" = "7" ]; then 35 + echo "✓ PASS" 36 + else 37 + echo "✗ FAIL: Expected 7, got $result" 38 + fi 39 + echo 40 + 41 + # Test 4: Let binding 42 + echo "Test 4: Let binding (x=5, y=3, x+y)" 43 + result=$(./godnix examples/let.nix 2>/dev/null) 44 + if [ "$result" = "8" ]; then 45 + echo "✓ PASS" 46 + else 47 + echo "✗ FAIL: Expected 8, got $result" 48 + fi 49 + echo 50 + 51 + # Test 5: Lambda functions 52 + echo "Test 5: Lambda functions (add 4 6)" 53 + result=$(./godnix examples/lambda.nix 2>/dev/null) 54 + if [ "$result" = "10" ]; then 55 + echo "✓ PASS" 56 + else 57 + echo "✗ FAIL: Expected 10, got $result" 58 + fi 59 + echo 60 + 61 + echo "===================================" 62 + echo "All tests completed!"