Permalink
Browse files

Refactor scan.l

  • Loading branch information...
1 parent d283909 commit f9d02f5814d65cc469132ee3dd12ad9687d715d4 @umitanuki committed Jan 23, 2013
Showing with 109 additions and 175 deletions.
  1. +1 −3 src/bigpot/parser/gram.y
  2. +1 −1 src/bigpot/parser/gram_test.go
  3. +94 −152 src/bigpot/parser/scan.l
  4. +13 −19 src/bigpot/parser/scan_test.go
@@ -4,7 +4,6 @@ package parser
import (
"fmt"
- "strings"
)
type Node interface {
@@ -116,8 +115,7 @@ table_list: IDENT
%%
func ExParse(query string) Node {
- reader := strings.NewReader(query)
- lexer := newLexer(reader)
+ lexer := newLexer(query)
yyParse(lexer)
return TopList[0]
}
@@ -14,7 +14,7 @@ type MySuite struct{}
var _ = Suite(&MySuite{})
func (s *MySuite) TestYYParse_1(c *C) {
query := " select col1, col2 FROM tab1"
- lexer := strLexer(query)
+ lexer := newLexer(query)
yyParse(lexer)
node, ok := TopList[0].(*SelectStmt)
if !ok {
Oops, something went wrong.

0 comments on commit f9d02f5

Please sign in to comment.