Browse Source

add comments to scanner.go

pull/16/head
Brett Langdon 11 years ago
parent
commit
0ef2f4c855
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      scanner.go

+ 4
- 0
scanner.go View File

@ -35,6 +35,8 @@ func isInclude(str string) bool {
return strings.ToLower(str) == "include"
}
// Scanner struct used to hold data necessary for parsing tokens
// from the input reader
type Scanner struct {
curLine int
curCol int
@ -44,6 +46,7 @@ type Scanner struct {
reader *bufio.Reader
}
// NewScanner creates and initializes a new *Scanner from an io.Readerx
func NewScanner(reader io.Reader) *Scanner {
scanner := &Scanner{
reader: bufio.NewReader(reader),
@ -148,6 +151,7 @@ func (scanner *Scanner) skipWhitespace() {
}
}
// NextToken will read in the next valid token from the Scanner
func (scanner *Scanner) NextToken() token.Token {
if isWhitespace(scanner.curCh) {
scanner.skipWhitespace()


Loading…
Cancel
Save