1
0
Fork 0

Go fmt em all

This commit is contained in:
Gregory Eremin 2014-10-20 22:27:40 +07:00
parent 81068376fa
commit 3c14e17cb1
12 changed files with 1625 additions and 1799 deletions

View File

@ -1,4 +1,3 @@
package errors package errors
import ( import (

View File

@ -1,4 +1,3 @@
package lexer package lexer
import ( import (
@ -310,5 +309,4 @@ var ActTab = ActionTable{
Accept: 22, Accept: 22,
Ignore: "", Ignore: "",
}, },
} }

View File

@ -1,4 +1,3 @@
package lexer package lexer
import ( import (
@ -6,9 +5,9 @@ import (
// "fmt" // "fmt"
// "github.com/localhots/penny/util" // "github.com/localhots/penny/util"
"github.com/localhots/penny/token"
"io/ioutil" "io/ioutil"
"unicode/utf8" "unicode/utf8"
"github.com/localhots/penny/token"
) )
const ( const (
@ -77,7 +76,6 @@ func (this *Lexer) Scan() (tok *token.Token) {
this.column++ this.column++
} }
// Production start // Production start
if rune1 != -1 { if rune1 != -1 {
state = TransTab[state](rune1) state = TransTab[state](rune1)
@ -99,7 +97,6 @@ func (this *Lexer) Scan() (tok *token.Token) {
// state = nextState // state = nextState
// Debug end // Debug end
if state != -1 { if state != -1 {
switch { switch {
case ActTab[state].Accept != -1: case ActTab[state].Accept != -1:

View File

@ -1,8 +1,5 @@
package lexer package lexer
/* /*
Let s be the current state Let s be the current state
Let r be the current input rune Let r be the current input rune
@ -78,7 +75,6 @@ var TransTab = TransitionTable{
case r == 125: // ['}','}'] case r == 125: // ['}','}']
return 24 return 24
default: default:
return 25 return 25
} }
@ -89,8 +85,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -100,8 +94,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -113,8 +105,6 @@ var TransTab = TransitionTable{
case r == 38: // ['&','&'] case r == 38: // ['&','&']
return 26 return 26
} }
return NoState return NoState
@ -124,8 +114,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -135,8 +123,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -148,8 +134,6 @@ var TransTab = TransitionTable{
case 48 <= r && r <= 57: // ['0','9'] case 48 <= r && r <= 57: // ['0','9']
return 6 return 6
} }
return NoState return NoState
@ -161,8 +145,6 @@ var TransTab = TransitionTable{
case r == 59: // [';',';'] case r == 59: // [';',';']
return 27 return 27
} }
return NoState return NoState
@ -178,8 +160,6 @@ var TransTab = TransitionTable{
case r == 62: // ['>','>'] case r == 62: // ['>','>']
return 30 return 30
} }
return NoState return NoState
@ -189,8 +169,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -206,8 +184,6 @@ var TransTab = TransitionTable{
case r == 124: // ['|','|'] case r == 124: // ['|','|']
return 33 return 33
} }
return NoState return NoState
@ -219,8 +195,6 @@ var TransTab = TransitionTable{
case r == 110: // ['n','n'] case r == 110: // ['n','n']
return 34 return 34
} }
return NoState return NoState
@ -236,8 +210,6 @@ var TransTab = TransitionTable{
case 97 <= r && r <= 122: // ['a','z'] case 97 <= r && r <= 122: // ['a','z']
return 36 return 36
} }
return NoState return NoState
@ -249,8 +221,6 @@ var TransTab = TransitionTable{
case 65 <= r && r <= 90: // ['A','Z'] case 65 <= r && r <= 90: // ['A','Z']
return 37 return 37
} }
return NoState return NoState
@ -264,8 +234,6 @@ var TransTab = TransitionTable{
case r == 97: // ['a','a'] case r == 97: // ['a','a']
return 38 return 38
} }
return NoState return NoState
@ -279,8 +247,6 @@ var TransTab = TransitionTable{
case r == 111: // ['o','o'] case r == 111: // ['o','o']
return 39 return 39
} }
return NoState return NoState
@ -296,8 +262,6 @@ var TransTab = TransitionTable{
case r == 115: // ['s','s'] case r == 115: // ['s','s']
return 41 return 41
} }
return NoState return NoState
@ -313,8 +277,6 @@ var TransTab = TransitionTable{
case r == 111: // ['o','o'] case r == 111: // ['o','o']
return 43 return 43
} }
return NoState return NoState
@ -330,8 +292,6 @@ var TransTab = TransitionTable{
case r == 110: // ['n','n'] case r == 110: // ['n','n']
return 45 return 45
} }
return NoState return NoState
@ -345,8 +305,6 @@ var TransTab = TransitionTable{
case r == 104: // ['h','h'] case r == 104: // ['h','h']
return 46 return 46
} }
return NoState return NoState
@ -360,8 +318,6 @@ var TransTab = TransitionTable{
case r == 110: // ['n','n'] case r == 110: // ['n','n']
return 47 return 47
} }
return NoState return NoState
@ -375,8 +331,6 @@ var TransTab = TransitionTable{
case r == 104: // ['h','h'] case r == 104: // ['h','h']
return 48 return 48
} }
return NoState return NoState
@ -386,8 +340,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -399,8 +351,6 @@ var TransTab = TransitionTable{
case r == 124: // ['|','|'] case r == 124: // ['|','|']
return 49 return 49
} }
return NoState return NoState
@ -410,8 +360,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -421,8 +369,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -432,8 +378,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -443,8 +387,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -454,8 +396,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -467,8 +407,6 @@ var TransTab = TransitionTable{
case r == 45: // ['-','-'] case r == 45: // ['-','-']
return 50 return 50
} }
return NoState return NoState
@ -478,8 +416,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -489,8 +425,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -500,8 +434,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -511,8 +443,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -522,8 +452,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -539,8 +467,6 @@ var TransTab = TransitionTable{
case 97 <= r && r <= 122: // ['a','z'] case 97 <= r && r <= 122: // ['a','z']
return 36 return 36
} }
return NoState return NoState
@ -552,8 +478,6 @@ var TransTab = TransitionTable{
case 65 <= r && r <= 90: // ['A','Z'] case 65 <= r && r <= 90: // ['A','Z']
return 51 return 51
} }
return NoState return NoState
@ -569,8 +493,6 @@ var TransTab = TransitionTable{
case 97 <= r && r <= 122: // ['a','z'] case 97 <= r && r <= 122: // ['a','z']
return 53 return 53
} }
return NoState return NoState
@ -582,8 +504,6 @@ var TransTab = TransitionTable{
case r == 115: // ['s','s'] case r == 115: // ['s','s']
return 54 return 54
} }
return NoState return NoState
@ -595,8 +515,6 @@ var TransTab = TransitionTable{
case r == 110: // ['n','n'] case r == 110: // ['n','n']
return 55 return 55
} }
return NoState return NoState
@ -610,8 +528,6 @@ var TransTab = TransitionTable{
case r == 115: // ['s','s'] case r == 115: // ['s','s']
return 57 return 57
} }
return NoState return NoState
@ -623,8 +539,6 @@ var TransTab = TransitionTable{
case r == 97: // ['a','a'] case r == 97: // ['a','a']
return 58 return 58
} }
return NoState return NoState
@ -634,8 +548,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -647,8 +559,6 @@ var TransTab = TransitionTable{
case r == 114: // ['r','r'] case r == 114: // ['r','r']
return 59 return 59
} }
return NoState return NoState
@ -658,8 +568,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -669,8 +577,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -682,8 +588,6 @@ var TransTab = TransitionTable{
case r == 101: // ['e','e'] case r == 101: // ['e','e']
return 60 return 60
} }
return NoState return NoState
@ -695,8 +599,6 @@ var TransTab = TransitionTable{
case r == 116: // ['t','t'] case r == 116: // ['t','t']
return 61 return 61
} }
return NoState return NoState
@ -708,8 +610,6 @@ var TransTab = TransitionTable{
case r == 105: // ['i','i'] case r == 105: // ['i','i']
return 62 return 62
} }
return NoState return NoState
@ -719,8 +619,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -730,8 +628,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -747,8 +643,6 @@ var TransTab = TransitionTable{
case 97 <= r && r <= 122: // ['a','z'] case 97 <= r && r <= 122: // ['a','z']
return 36 return 36
} }
return NoState return NoState
@ -764,8 +658,6 @@ var TransTab = TransitionTable{
case 97 <= r && r <= 122: // ['a','z'] case 97 <= r && r <= 122: // ['a','z']
return 53 return 53
} }
return NoState return NoState
@ -777,8 +669,6 @@ var TransTab = TransitionTable{
case 65 <= r && r <= 90: // ['A','Z'] case 65 <= r && r <= 90: // ['A','Z']
return 37 return 37
} }
return NoState return NoState
@ -790,8 +680,6 @@ var TransTab = TransitionTable{
case r == 101: // ['e','e'] case r == 101: // ['e','e']
return 63 return 63
} }
return NoState return NoState
@ -803,8 +691,6 @@ var TransTab = TransitionTable{
case r == 101: // ['e','e'] case r == 101: // ['e','e']
return 64 return 64
} }
return NoState return NoState
@ -816,8 +702,6 @@ var TransTab = TransitionTable{
case r == 102: // ['f','f'] case r == 102: // ['f','f']
return 65 return 65
} }
return NoState return NoState
@ -829,8 +713,6 @@ var TransTab = TransitionTable{
case r == 101: // ['e','e'] case r == 101: // ['e','e']
return 66 return 66
} }
return NoState return NoState
@ -842,8 +724,6 @@ var TransTab = TransitionTable{
case r == 99: // ['c','c'] case r == 99: // ['c','c']
return 67 return 67
} }
return NoState return NoState
@ -853,8 +733,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -866,8 +744,6 @@ var TransTab = TransitionTable{
case r == 110: // ['n','n'] case r == 110: // ['n','n']
return 68 return 68
} }
return NoState return NoState
@ -879,8 +755,6 @@ var TransTab = TransitionTable{
case r == 105: // ['i','i'] case r == 105: // ['i','i']
return 69 return 69
} }
return NoState return NoState
@ -892,8 +766,6 @@ var TransTab = TransitionTable{
case r == 108: // ['l','l'] case r == 108: // ['l','l']
return 70 return 70
} }
return NoState return NoState
@ -903,8 +775,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -914,8 +784,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -925,8 +793,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -936,8 +802,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -947,8 +811,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -958,8 +820,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -971,8 +831,6 @@ var TransTab = TransitionTable{
case r == 108: // ['l','l'] case r == 108: // ['l','l']
return 71 return 71
} }
return NoState return NoState
@ -984,8 +842,6 @@ var TransTab = TransitionTable{
case r == 101: // ['e','e'] case r == 101: // ['e','e']
return 72 return 72
} }
return NoState return NoState
@ -995,8 +851,6 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
@ -1006,11 +860,8 @@ var TransTab = TransitionTable{
func(r rune) int { func(r rune) int {
switch { switch {
} }
return NoState return NoState
}, },
} }

View File

@ -1,4 +1,3 @@
package parser package parser
import ( import (

View File

@ -1,4 +1,3 @@
package parser package parser
type ( type (
@ -56,7 +55,6 @@ var actionTab = actionTable{
nil, /* ; */ nil, /* ; */
}, },
}, },
actionRow{ // S1 actionRow{ // S1
canRecover: false, canRecover: false,
@ -104,7 +102,6 @@ var actionTab = actionTable{
nil, /* ; */ nil, /* ; */
}, },
}, },
actionRow{ // S2 actionRow{ // S2
canRecover: false, canRecover: false,
@ -152,8 +149,5 @@ var actionTab = actionTable{
nil, /* ; */ nil, /* ; */
}, },
}, },
} }

View File

@ -1,9 +1,9 @@
/* /*
*/ */
package parser package parser
const numNTSymbols = 47 const numNTSymbols = 47
type ( type (
gotoTable [numStates]gotoRow gotoTable [numStates]gotoRow
gotoRow [numNTSymbols]int gotoRow [numNTSymbols]int
@ -60,7 +60,6 @@ var gotoTab = gotoTable{
-1, // Separator -1, // Separator
-1, // SequentialSep -1, // SequentialSep
}, },
gotoRow{ // S1 gotoRow{ // S1
@ -112,7 +111,6 @@ var gotoTab = gotoTable{
-1, // Separator -1, // Separator
-1, // SequentialSep -1, // SequentialSep
}, },
gotoRow{ // S2 gotoRow{ // S2
@ -164,7 +162,5 @@ var gotoTab = gotoTable{
-1, // Separator -1, // Separator
-1, // SequentialSep -1, // SequentialSep
}, },
} }

View File

@ -1,10 +1,9 @@
package parser package parser
import ( import (
"bytes" "bytes"
"fmt"
"errors" "errors"
"fmt"
parseError "github.com/localhots/penny/errors" parseError "github.com/localhots/penny/errors"
"github.com/localhots/penny/token" "github.com/localhots/penny/token"
) )
@ -190,7 +189,6 @@ func (this *Parser) Parse(scanner Scanner) (res interface{}, err error) {
// fmt.Printf("S%d %s %s\n", this.stack.top(), token.TokMap.TokenString(this.nextToken), action.String()) // fmt.Printf("S%d %s %s\n", this.stack.top(), token.TokMap.TokenString(this.nextToken), action.String())
switch act := action.(type) { switch act := action.(type) {
case accept: case accept:
res = this.stack.popN(1)[0] res = this.stack.popN(1)[0]

View File

@ -1,4 +1,3 @@
package parser package parser
import "github.com/localhots/penny/ast" import "github.com/localhots/penny/ast"
@ -1099,5 +1098,4 @@ var productionsTable = ProdTab {
return X[0], nil return X[0], nil
}, },
}, },
} }

View File

@ -1,4 +1,3 @@
package token package token
import ( import (
@ -145,4 +144,3 @@ var TokMap = TokenMap{
";": 40, ";": 40,
}, },
} }

View File

@ -1,4 +1,3 @@
//Copyright 2013 Vastech SA (PTY) LTD //Copyright 2013 Vastech SA (PTY) LTD
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,4 +1,3 @@
//Copyright 2013 Vastech SA (PTY) LTD //Copyright 2013 Vastech SA (PTY) LTD
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");