github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/syntax/tokens.go (about)

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package syntax
     6  
     7  type Token uint
     8  
     9  const (
    10  	_ token = iota
    11  )
    12  
    13  const (
    14  	// for BranchStmt
    15  	Break       = _Break
    16  	Continue    = _Continue
    17  	Fallthrough = _Fallthrough
    18  	Goto        = _Goto
    19  
    20  	// for CallStmt
    21  	Go    = _Go
    22  	Defer = _Defer
    23  )
    24  
    25  // Make sure we have at most 64 tokens so we can use them in a set.
    26  const _ uint64 = 1 << (tokenCount - 1)
    27  
    28  type LitKind uint8
    29  
    30  // TODO(gri) With the 'i' (imaginary) suffix now permitted on integer
    31  // and floating-point numbers, having a single ImagLit does
    32  // not represent the literal kind well anymore. Remove it?
    33  const (
    34  	IntLit LitKind = iota
    35  	FloatLit
    36  	ImagLit
    37  	RuneLit
    38  	StringLit
    39  )
    40  
    41  type Operator uint
    42  
    43  const (
    44  	_ Operator = iota
    45  
    46  	// Def is the : in :=
    47  	Def
    48  	Not
    49  	Recv
    50  	Tilde
    51  
    52  	// precOrOr
    53  	OrOr
    54  
    55  	// precAndAnd
    56  	AndAnd
    57  
    58  	// precCmp
    59  	Eql
    60  	Neq
    61  	Lss
    62  	Leq
    63  	Gtr
    64  	Geq
    65  
    66  	// precAdd
    67  	Add
    68  	Sub
    69  	Or
    70  	Xor
    71  
    72  	// precMul
    73  	Mul
    74  	Div
    75  	Rem
    76  	And
    77  	AndNot
    78  	Shl
    79  	Shr
    80  )
    81  
    82  // Operator precedences
    83  const (
    84  	_ = iota
    85  )