Go fmt em all

This commit is contained in:
2014-10-20 22:27:40 +07:00
parent 81068376fa
commit 3c14e17cb1
12 changed files with 1625 additions and 1799 deletions
+221 -223
View File
@@ -1,12 +1,11 @@
package lexer
import(
import (
"fmt"
"github.com/localhots/penny/token"
)
type ActionTable [NumStates] ActionRow
type ActionTable [NumStates]ActionRow
type ActionRow struct {
Accept token.Type
@@ -18,297 +17,296 @@ func (this ActionRow) String() string {
}
var ActTab = ActionTable{
ActionRow{ // S0
ActionRow{ // S0
Accept: 0,
Ignore: "",
},
ActionRow{ // S1
Ignore: "",
},
ActionRow{ // S1
Accept: -1,
Ignore: "!whitespace",
},
ActionRow{ // S2
Ignore: "!whitespace",
},
ActionRow{ // S2
Accept: 7,
Ignore: "",
},
ActionRow{ // S3
Ignore: "",
},
ActionRow{ // S3
Accept: 39,
Ignore: "",
},
ActionRow{ // S4
Ignore: "",
},
ActionRow{ // S4
Accept: 9,
Ignore: "",
},
ActionRow{ // S5
Ignore: "",
},
ActionRow{ // S5
Accept: 10,
Ignore: "",
},
ActionRow{ // S6
Ignore: "",
},
ActionRow{ // S6
Accept: 3,
Ignore: "",
},
ActionRow{ // S7
Ignore: "",
},
ActionRow{ // S7
Accept: 40,
Ignore: "",
},
ActionRow{ // S8
Ignore: "",
},
ActionRow{ // S8
Accept: 28,
Ignore: "",
},
ActionRow{ // S9
Ignore: "",
},
ActionRow{ // S9
Accept: 4,
Ignore: "",
},
ActionRow{ // S10
Ignore: "",
},
ActionRow{ // S10
Accept: 30,
Ignore: "",
},
ActionRow{ // S11
Ignore: "",
},
ActionRow{ // S11
Accept: 0,
Ignore: "",
},
ActionRow{ // S12
Ignore: "",
},
ActionRow{ // S12
Accept: 13,
Ignore: "",
},
ActionRow{ // S13
Ignore: "",
},
ActionRow{ // S13
Accept: 0,
Ignore: "",
},
ActionRow{ // S14
Ignore: "",
},
ActionRow{ // S14
Accept: 0,
Ignore: "",
},
ActionRow{ // S15
Ignore: "",
},
ActionRow{ // S15
Accept: 0,
Ignore: "",
},
ActionRow{ // S16
Ignore: "",
},
ActionRow{ // S16
Accept: 0,
Ignore: "",
},
ActionRow{ // S17
Ignore: "",
},
ActionRow{ // S17
Accept: 0,
Ignore: "",
},
ActionRow{ // S18
Ignore: "",
},
ActionRow{ // S18
Accept: 0,
Ignore: "",
},
ActionRow{ // S19
Ignore: "",
},
ActionRow{ // S19
Accept: 0,
Ignore: "",
},
ActionRow{ // S20
Ignore: "",
},
ActionRow{ // S20
Accept: 0,
Ignore: "",
},
ActionRow{ // S21
Ignore: "",
},
ActionRow{ // S21
Accept: 0,
Ignore: "",
},
ActionRow{ // S22
Ignore: "",
},
ActionRow{ // S22
Accept: 24,
Ignore: "",
},
ActionRow{ // S23
Ignore: "",
},
ActionRow{ // S23
Accept: 8,
Ignore: "",
},
ActionRow{ // S24
Ignore: "",
},
ActionRow{ // S24
Accept: 25,
Ignore: "",
},
ActionRow{ // S25
Ignore: "",
},
ActionRow{ // S25
Accept: 38,
Ignore: "",
},
ActionRow{ // S26
Ignore: "",
},
ActionRow{ // S26
Accept: 5,
Ignore: "",
},
ActionRow{ // S27
Ignore: "",
},
ActionRow{ // S27
Accept: 16,
Ignore: "",
},
ActionRow{ // S28
Ignore: "",
},
ActionRow{ // S28
Accept: 29,
Ignore: "",
},
ActionRow{ // S29
Ignore: "",
},
ActionRow{ // S29
Accept: 35,
Ignore: "",
},
ActionRow{ // S30
Ignore: "",
},
ActionRow{ // S30
Accept: 33,
Ignore: "",
},
ActionRow{ // S31
Ignore: "",
},
ActionRow{ // S31
Accept: 31,
Ignore: "",
},
ActionRow{ // S32
Ignore: "",
},
ActionRow{ // S32
Accept: 32,
Ignore: "",
},
ActionRow{ // S33
Ignore: "",
},
ActionRow{ // S33
Accept: 34,
Ignore: "",
},
ActionRow{ // S34
Ignore: "",
},
ActionRow{ // S34
Accept: 37,
Ignore: "",
},
ActionRow{ // S35
Ignore: "",
},
ActionRow{ // S35
Accept: 13,
Ignore: "",
},
ActionRow{ // S36
Ignore: "",
},
ActionRow{ // S36
Accept: 0,
Ignore: "",
},
ActionRow{ // S37
Ignore: "",
},
ActionRow{ // S37
Accept: 2,
Ignore: "",
},
ActionRow{ // S38
Ignore: "",
},
ActionRow{ // S38
Accept: 0,
Ignore: "",
},
ActionRow{ // S39
Ignore: "",
},
ActionRow{ // S39
Accept: 26,
Ignore: "",
},
ActionRow{ // S40
Ignore: "",
},
ActionRow{ // S40
Accept: 0,
Ignore: "",
},
ActionRow{ // S41
Ignore: "",
},
ActionRow{ // S41
Accept: 0,
Ignore: "",
},
ActionRow{ // S42
Ignore: "",
},
ActionRow{ // S42
Accept: 19,
Ignore: "",
},
ActionRow{ // S43
Ignore: "",
},
ActionRow{ // S43
Accept: 0,
Ignore: "",
},
ActionRow{ // S44
Ignore: "",
},
ActionRow{ // S44
Accept: 17,
Ignore: "",
},
ActionRow{ // S45
Ignore: "",
},
ActionRow{ // S45
Accept: 12,
Ignore: "",
},
ActionRow{ // S46
Ignore: "",
},
ActionRow{ // S46
Accept: 0,
Ignore: "",
},
ActionRow{ // S47
Ignore: "",
},
ActionRow{ // S47
Accept: 0,
Ignore: "",
},
ActionRow{ // S48
Ignore: "",
},
ActionRow{ // S48
Accept: 0,
Ignore: "",
},
ActionRow{ // S49
Ignore: "",
},
ActionRow{ // S49
Accept: 6,
Ignore: "",
},
ActionRow{ // S50
Ignore: "",
},
ActionRow{ // S50
Accept: 36,
Ignore: "",
},
ActionRow{ // S51
Ignore: "",
},
ActionRow{ // S51
Accept: 13,
Ignore: "",
},
ActionRow{ // S52
Ignore: "",
},
ActionRow{ // S52
Accept: 2,
Ignore: "",
},
ActionRow{ // S53
Ignore: "",
},
ActionRow{ // S53
Accept: 0,
Ignore: "",
},
ActionRow{ // S54
Ignore: "",
},
ActionRow{ // S54
Accept: 0,
Ignore: "",
},
ActionRow{ // S55
Ignore: "",
},
ActionRow{ // S55
Accept: 0,
Ignore: "",
},
ActionRow{ // S56
Ignore: "",
},
ActionRow{ // S56
Accept: 0,
Ignore: "",
},
ActionRow{ // S57
Ignore: "",
},
ActionRow{ // S57
Accept: 0,
Ignore: "",
},
ActionRow{ // S58
Ignore: "",
},
ActionRow{ // S58
Accept: 0,
Ignore: "",
},
ActionRow{ // S59
Ignore: "",
},
ActionRow{ // S59
Accept: 11,
Ignore: "",
},
ActionRow{ // S60
Ignore: "",
},
ActionRow{ // S60
Accept: 0,
Ignore: "",
},
ActionRow{ // S61
Ignore: "",
},
ActionRow{ // S61
Accept: 0,
Ignore: "",
},
ActionRow{ // S62
Ignore: "",
},
ActionRow{ // S62
Accept: 0,
Ignore: "",
},
ActionRow{ // S63
Ignore: "",
},
ActionRow{ // S63
Accept: 14,
Ignore: "",
},
ActionRow{ // S64
Ignore: "",
},
ActionRow{ // S64
Accept: 27,
Ignore: "",
},
ActionRow{ // S65
Ignore: "",
},
ActionRow{ // S65
Accept: 20,
Ignore: "",
},
ActionRow{ // S66
Ignore: "",
},
ActionRow{ // S66
Accept: 21,
Ignore: "",
},
ActionRow{ // S67
Ignore: "",
},
ActionRow{ // S67
Accept: 15,
Ignore: "",
},
ActionRow{ // S68
Ignore: "",
},
ActionRow{ // S68
Accept: 18,
Ignore: "",
},
ActionRow{ // S69
Ignore: "",
},
ActionRow{ // S69
Accept: 0,
Ignore: "",
},
ActionRow{ // S70
Ignore: "",
},
ActionRow{ // S70
Accept: 0,
Ignore: "",
},
ActionRow{ // S71
Ignore: "",
},
ActionRow{ // S71
Accept: 23,
Ignore: "",
},
ActionRow{ // S72
Ignore: "",
},
ActionRow{ // S72
Accept: 22,
Ignore: "",
},
Ignore: "",
},
}
+15 -18
View File
@@ -1,27 +1,26 @@
package lexer
import (
// "fmt"
// "github.com/localhots/penny/util"
"github.com/localhots/penny/token"
"io/ioutil"
"unicode/utf8"
"github.com/localhots/penny/token"
)
const(
NoState = -1
NumStates = 73
const (
NoState = -1
NumStates = 73
NumSymbols = 90
)
)
type Lexer struct {
src []byte
pos int
line int
column int
src []byte
pos int
line int
column int
}
func NewLexer(src []byte) *Lexer {
@@ -43,9 +42,9 @@ func NewLexerFile(fpath string) (*Lexer, error) {
}
func (this *Lexer) Scan() (tok *token.Token) {
// fmt.Printf("Lexer.Scan() pos=%d\n", this.pos)
tok = new(token.Token)
if this.pos >= len(this.src) {
tok.Type = token.EOF
@@ -56,9 +55,9 @@ func (this *Lexer) Scan() (tok *token.Token) {
tok.Type = token.INVALID
state, rune1, size := 0, rune(-1), 0
for state != -1 {
// fmt.Printf("\tpos=%d, line=%d, col=%d, state=%d\n", this.pos, this.line, this.column, state)
if this.pos >= len(this.src) {
rune1 = -1
} else {
@@ -77,7 +76,6 @@ func (this *Lexer) Scan() (tok *token.Token) {
this.column++
}
// Production start
if rune1 != -1 {
state = TransTab[state](rune1)
@@ -98,7 +96,6 @@ func (this *Lexer) Scan() (tok *token.Token) {
// }
// state = nextState
// Debug end
if state != -1 {
switch {
+857 -1006
View File
File diff suppressed because it is too large Load Diff