github.com/ianlewis/go-gitignore@v0.1.1-0.20231110021210-4a0f15cbd56f/tokentype.go (about) 1 // Copyright 2016 Denormal Limited 2 // Copyright 2023 Google LLC 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 package gitignore 17 18 type TokenType int 19 20 const ( 21 ILLEGAL TokenType = iota 22 EOF 23 EOL 24 WHITESPACE 25 COMMENT 26 SEPARATOR 27 NEGATION 28 PATTERN 29 ANY 30 BAD 31 ) 32 33 // String returns a string representation of the Token type. 34 func (t TokenType) String() string { 35 switch t { 36 case ILLEGAL: 37 return "ILLEGAL" 38 case EOF: 39 return "EOF" 40 case EOL: 41 return "EOL" 42 case WHITESPACE: 43 return "WHITESPACE" 44 case COMMENT: 45 return "COMMENT" 46 case SEPARATOR: 47 return "SEPARATOR" 48 case NEGATION: 49 return "NEGATION" 50 case PATTERN: 51 return "PATTERN" 52 case ANY: 53 return "ANY" 54 default: 55 return "BAD TOKEN" 56 } 57 } // String()