Skip to content

Commit 8244033

Browse files
committed
fmt
1 parent 03dd77b commit 8244033

4 files changed

Lines changed: 15 additions & 12 deletions

File tree

lexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ func LookupType(word string, tokenTypes []TokenType) TokenType {
4242
Words: []string{""},
4343
CaseSensitive: false,
4444
}
45-
}
45+
}

lexer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ func TestLookupType(t *testing.T) {
6464
assertions.Equal("keyword", result.Type)
6565
assertions.Equal([]string{"if", "for"}, result.Words)
6666
assertions.Equal(false, result.CaseSensitive)
67-
}
67+
}

token.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package stringutils
22

3+
// Token represents a word tokenized into a category of token types
34
type Token struct {
4-
Type string // verb, keyword, separator, etc
5-
Position int // position of the word in string
6-
Text string // text
5+
Type string // verb, keyword, separator, etc
6+
Position int // position of the word in string
7+
Text string // text
78
}
89

10+
//TokenType represents a category of words, with a collection of tokens and whether or not they should be matched as
11+
// case sensitive
912
type TokenType struct {
10-
Type string // verb, keyword, separator, etc
11-
Words []string // words to be considered as a given token type
12-
CaseSensitive bool // whether or not this token type is case sensitive
13+
Type string // verb, keyword, separator, etc
14+
Words []string // words to be considered as a given token type
15+
CaseSensitive bool // whether or not this token type is case sensitive
1316
}

token_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ func TestToken(t *testing.T) {
2222
assertions := assert.New(t)
2323

2424
result := Token{
25-
Type: "keyword",
26-
Position: 1,
27-
Text: "if",
25+
Type: "keyword",
26+
Position: 1,
27+
Text: "if",
2828
}
2929
assertions.Equal("keyword", result.Type)
3030
assertions.Equal("if", result.Text)
3131
assertions.Equal(1, result.Position)
32-
}
32+
}

0 commit comments

Comments
 (0)