| 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 astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/ |
| 16 | |
| 17 | type SyntaxPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart# struct { |
| 18 | Headerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#Header. *FileHeaderscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/FileHeader# |
| 19 | ProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#ProdList. SyntaxProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProdList# |
| 20 | } |
| 21 | |
| 22 | func NewSyntaxPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/NewSyntaxPart().(header, prodList interface{}) (*SyntaxPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#, error) { |
| 23 | sp := &SyntaxPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#{} |
| 24 | if header != nil { |
| 25 | sp.Headerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#Header. = header.(*FileHeaderscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/FileHeader#) |
| 26 | } else { |
| 27 | sp.Headerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#Header. = new(FileHeaderscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/FileHeader#) |
| 28 | } |
| 29 | if prodList != nil { |
| 30 | sp.ProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#ProdList. = prodList.(SyntaxProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProdList#) |
| 31 | } |
| 32 | |
| 33 | return sp, nil |
| 34 | } |
| 35 | |
| 36 | func (this *SyntaxPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#) augmentscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#augment().() *SyntaxPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart# { |
| 37 | startProd := &SyntaxProdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProd#{ |
| 38 | Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProd#Id.: "S'", |
| 39 | Bodyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProd#Body.: &SyntaxBodyscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxBody#{ |
| 40 | Symbolsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxBody#Symbols.: []SyntaxSymbolscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxSymbol#{SyntaxProdIdscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProdId#(this.ProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#ProdList.[0].Idscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProd#Id.)}, |
| 41 | }, |
| 42 | } |
| 43 | newProdList := SyntaxProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxProdList#{startProd} |
| 44 | return &SyntaxPartscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#{ |
| 45 | Headerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#Header.: this.Headerscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#Header., |
| 46 | ProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#ProdList.: append(newProdList, this.ProdListscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/SyntaxPart#ProdList....), |
| 47 | } |
| 48 | } |