| 1 | //Copyright 2013 Vastech SA (PTY) LTD |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/ |
| 16 | |
| 17 | import ( |
| 18 | // "fmt" |
| 19 | // "github.com/goccmack/gocc/internal/ast" |
| 20 | "testingscip-go gomod github.com/golang/go/src go1.24 testing/" |
| 21 | ) |
| 22 | |
| 23 | func TestItemPos1scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestItemPos1().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) { |
| 24 | src := `id : . {.};` |
| 25 | |
| 26 | g := parsescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/parse().(src, t) |
| 27 | prod := g.LexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/Grammar#LexPart..Productionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#Production().("id") |
| 28 | itempos := newItemPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/newItemPos().(prod.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.()) |
| 29 | if itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().() != 0 { |
| 30 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("itempos.level() == %d", itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().()) |
| 31 | } |
| 32 | if itempos.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pos().() != 0 { |
| 33 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("itempos.pos() == %d", itempos.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pos().()) |
| 34 | } |
| 35 | if itempos.ntNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#ntNode().() != prod.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.() { |
| 36 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("itempos.ntNode() == %T", itempos.ntNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#ntNode().()) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | func TestItemPosClone1scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestItemPosClone1().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) { |
| 41 | src := `id : . {.};` |
| 42 | |
| 43 | g := parsescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/parse().(src, t) |
| 44 | prod := g.LexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/Grammar#LexPart..Productionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#Production().("id") |
| 45 | itempos := newItemPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/newItemPos().(prod.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.()) |
| 46 | clone := itempos.clonescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#clone().() |
| 47 | if clone.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().() != itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().() { |
| 48 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("clone.level() == %d, itempos.level() == %d", clone.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().(), itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().()) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestItemPos2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestItemPos2().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) { |
| 53 | src := `id : . {.};` |
| 54 | |
| 55 | g := parsescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/parse().(src, t) |
| 56 | prod := g.LexPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/Grammar#LexPart..Productionscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPart#Production().("id") |
| 57 | itempos := newItemPosscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/newItemPos().(prod.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.()) |
| 58 | node := prod.LexPatternscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexProduction#LexPattern.().Alternativesscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexPattern#Alternatives.[0] |
| 59 | itempos.pushscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#push().(node, 0) |
| 60 | if itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().() != 1 { |
| 61 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("itempos.level() == %d", itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().()) |
| 62 | } |
| 63 | if itempos.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pos().() != 0 { |
| 64 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("itempos.pos() == %d", itempos.posscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#pos().()) |
| 65 | } |
| 66 | if itempos.ntNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#ntNode().() != node { |
| 67 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("itempos.ntNode() == %T", itempos.ntNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#ntNode().()) |
| 68 | } |
| 69 | if itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().() != 1 { |
| 70 | t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("itempos.level() == %d", itempos.levelscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/itemPos#level().()) |
| 71 | } |
| 72 | } |