Commit 348e31f8 authored by Josh Holland's avatar Josh Holland Committed by Rob Pike

text/template: fix typo of errorf as error in comment.

R=r, minux.ma
CC=gobot, golang-dev
https://golang.org/cl/6506120
parent 063b0744
...@@ -38,7 +38,7 @@ type itemType int ...@@ -38,7 +38,7 @@ type itemType int
const ( const (
itemError itemType = iota // error occurred; value is text of error itemError itemType = iota // error occurred; value is text of error
itemBool // boolean constant itemBool // boolean constant
itemChar // printable ASCII character; grab bag for comma etc. itemChar // printable ASCII character; grab bag for comma etc
itemCharConstant // character constant itemCharConstant // character constant
itemComplex // complex constant (1+2i); imaginary is just a number itemComplex // complex constant (1+2i); imaginary is just a number
itemColonEquals // colon-equals (':=') introducing a declaration itemColonEquals // colon-equals (':=') introducing a declaration
...@@ -55,10 +55,10 @@ const ( ...@@ -55,10 +55,10 @@ const (
itemSpace // run of spaces separating arguments itemSpace // run of spaces separating arguments
itemString // quoted string (includes quotes) itemString // quoted string (includes quotes)
itemText // plain text itemText // plain text
itemVariable // variable starting with '$', such as '$' or '$1' or '$hello'. itemVariable // variable starting with '$', such as '$' or '$1' or '$hello'
// Keywords appear after all the rest. // Keywords appear after all the rest.
itemKeyword // used only to delimit the keywords itemKeyword // used only to delimit the keywords
itemDot // the cursor, spelled '.'. itemDot // the cursor, spelled '.'
itemDefine // define keyword itemDefine // define keyword
itemElse // else keyword itemElse // else keyword
itemEnd // end keyword itemEnd // end keyword
...@@ -88,16 +88,16 @@ type stateFn func(*lexer) stateFn ...@@ -88,16 +88,16 @@ type stateFn func(*lexer) stateFn
// lexer holds the state of the scanner. // lexer holds the state of the scanner.
type lexer struct { type lexer struct {
name string // the name of the input; used only for error reports. name string // the name of the input; used only for error reports
input string // the string being scanned. input string // the string being scanned
leftDelim string // start of action. leftDelim string // start of action
rightDelim string // end of action. rightDelim string // end of action
state stateFn // the next lexing function to enter. state stateFn // the next lexing function to enter
pos int // current position in the input. pos int // current position in the input
start int // start position of this item. start int // start position of this item
width int // width of last rune read from input. width int // width of last rune read from input
lastPos int // position of most recent item returned by nextItem lastPos int // position of most recent item returned by nextItem
items chan item // channel of scanned items. items chan item // channel of scanned items
parenDepth int // nesting depth of ( ) exprs parenDepth int // nesting depth of ( ) exprs
} }
...@@ -158,7 +158,7 @@ func (l *lexer) lineNumber() int { ...@@ -158,7 +158,7 @@ func (l *lexer) lineNumber() int {
return 1 + strings.Count(l.input[:l.lastPos], "\n") return 1 + strings.Count(l.input[:l.lastPos], "\n")
} }
// error returns an error token and terminates the scan by passing // errorf returns an error token and terminates the scan by passing
// back a nil pointer that will be the next state, terminating l.nextItem. // back a nil pointer that will be the next state, terminating l.nextItem.
func (l *lexer) errorf(format string, args ...interface{}) stateFn { func (l *lexer) errorf(format string, args ...interface{}) stateFn {
l.items <- item{itemError, l.start, fmt.Sprintf(format, args...)} l.items <- item{itemError, l.start, fmt.Sprintf(format, args...)}
...@@ -428,7 +428,7 @@ func (l *lexer) atTerminator() bool { ...@@ -428,7 +428,7 @@ func (l *lexer) atTerminator() bool {
} }
// lexChar scans a character constant. The initial quote is already // lexChar scans a character constant. The initial quote is already
// scanned. Syntax checking is done by the parser. // scanned. Syntax checking is done by the parser.
func lexChar(l *lexer) stateFn { func lexChar(l *lexer) stateFn {
Loop: Loop:
for { for {
...@@ -448,7 +448,7 @@ Loop: ...@@ -448,7 +448,7 @@ Loop:
return lexInsideAction return lexInsideAction
} }
// lexNumber scans a number: decimal, octal, hex, float, or imaginary. This // lexNumber scans a number: decimal, octal, hex, float, or imaginary. This
// isn't a perfect number scanner - for instance it accepts "." and "0x0.2" // isn't a perfect number scanner - for instance it accepts "." and "0x0.2"
// and "089" - but when it's wrong the input is invalid and the parser (via // and "089" - but when it's wrong the input is invalid and the parser (via
// strconv) will notice. // strconv) will notice.
...@@ -457,7 +457,7 @@ func lexNumber(l *lexer) stateFn { ...@@ -457,7 +457,7 @@ func lexNumber(l *lexer) stateFn {
return l.errorf("bad number syntax: %q", l.input[l.start:l.pos]) return l.errorf("bad number syntax: %q", l.input[l.start:l.pos])
} }
if sign := l.peek(); sign == '+' || sign == '-' { if sign := l.peek(); sign == '+' || sign == '-' {
// Complex: 1+2i. No spaces, must end in 'i'. // Complex: 1+2i. No spaces, must end in 'i'.
if !l.scanNumber() || l.input[l.pos-1] != 'i' { if !l.scanNumber() || l.input[l.pos-1] != 'i' {
return l.errorf("bad number syntax: %q", l.input[l.start:l.pos]) return l.errorf("bad number syntax: %q", l.input[l.start:l.pos])
} }
...@@ -534,7 +534,7 @@ func isSpace(r rune) bool { ...@@ -534,7 +534,7 @@ func isSpace(r rune) bool {
return r == ' ' || r == '\t' return r == ' ' || r == '\t'
} }
// isEndOfLine reports whether r is an end-of-line character // isEndOfLine reports whether r is an end-of-line character.
func isEndOfLine(r rune) bool { func isEndOfLine(r rune) bool {
return r == '\r' || r == '\n' return r == '\r' || r == '\n'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment