github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2011/lex/snippets (about) 1 Evaluation: {{.Title}} 2 Constants and functions: {{printf "%g: %#3X" 1.2+2i 123}} 3 Control structures {{range $s.Text}} {{.}} {{end}} 4 5 // One iteration: 6 switch state { 7 case state1: 8 state = action1() 9 case state2: 10 state = action2() 11 case state3: 12 state = action3() 13 } 14 15 // run lexes the input by executing state functions 16 // until the state is nil. 17 func run() { 18 for state := startState; state != nil; { 19 state = state(lexer) 20 } 21 }