github.com/NeowayLabs/nash@v0.2.2-0.20200127205349-a227041ffd50/scanner/examples_test.go (about)

     1  package scanner_test
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/madlambda/nash/scanner"
     7  )
     8  
     9  func Example() {
    10  	lex := scanner.Lex("-input-", `echo "hello world"`)
    11  
    12  	for tok := range lex.Tokens {
    13  		fmt.Println(tok)
    14  	}
    15  
    16  	// Output:
    17  	// IDENT
    18  	// STRING
    19  	// ;
    20  	// EOF
    21  
    22  }