more cleanup
This commit is contained in:
parent
16671b3406
commit
78680de687
6 changed files with 200491 additions and 189802 deletions
|
|
@ -52,9 +52,6 @@ func New(dir string) (db *DB, err error) {
|
|||
}
|
||||
|
||||
_, err = db.CreatePage(core.IndexPage, core.WikiSection, welcome, defUser, core.Public)
|
||||
if err != nil && err != store.ErrKeyNotFound {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ var (
|
|||
errPermissionDenied = errors.New("db: permission denied")
|
||||
errInvalidPermission = errors.New("db: invalid permission")
|
||||
errPrivateWikiPage = errors.New("db: private wiki pages are not allowed")
|
||||
errNonPublicIndexPage = errors.New("db: internal/private index page is not allowed")
|
||||
errDeleteIndexPage = errors.New("db: index page can not be deleted")
|
||||
)
|
||||
|
||||
|
|
@ -77,7 +78,9 @@ func (db *DB) CreatePage(title, section, markdown, username string, p core.Permi
|
|||
}
|
||||
}
|
||||
st := render.StoreTitle(section, render.Title(title))
|
||||
if _, err = db.getPage(st, username); err != nil && err != store.ErrKeyNotFound {
|
||||
_, err = db.getPage(st, username)
|
||||
//if err == nil || (err != nil && err != store.ErrKeyNotFound) {
|
||||
if err != store.ErrKeyNotFound {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -113,6 +116,11 @@ func (db *DB) UpdatePage(title, section, markdown, username string, p core.Permi
|
|||
err = errPrivateWikiPage
|
||||
return
|
||||
}
|
||||
if section == core.WikiSection && title == core.IndexPage &&
|
||||
(p == core.Internal || p == core.Private) {
|
||||
err = errNonPublicIndexPage
|
||||
return
|
||||
}
|
||||
st := render.StoreTitle(section, title)
|
||||
page, err := db.getPage(st, username)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ var (
|
|||
debug = false
|
||||
)
|
||||
|
||||
func InitLogger(dir, file string, debug bool) {
|
||||
debug = debug
|
||||
func InitLogger(dir, file string, d bool) {
|
||||
debug = d
|
||||
if file == "-" {
|
||||
return
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ func Fatal(v ...interface{}) {
|
|||
|
||||
func Debug(v ...interface{}) {
|
||||
if debug {
|
||||
log.Println(append([]interface{}{"debug:"}, v...))
|
||||
log.Println(append([]interface{}{"debug:"}, v...)...)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,22 +18,21 @@ type BoltStore struct {
|
|||
db *bolt.DB
|
||||
}
|
||||
|
||||
func NewBoltStore(file string, m Marshaler) (bs *BoltStore, err error) {
|
||||
func NewBoltStore(file string, m Marshaler) (Store, error) {
|
||||
if m == nil {
|
||||
m = NewGOB()
|
||||
}
|
||||
db, err := bolt.Open(file, fileMode, nil)
|
||||
if err != nil {
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
if err = db.Update(func(tx *bolt.Tx) (err error) {
|
||||
_, err = tx.CreateBucketIfNotExists([]byte(defaultBoltBucket))
|
||||
return
|
||||
}); err != nil {
|
||||
return
|
||||
return nil, err
|
||||
}
|
||||
bs = &BoltStore{m, db}
|
||||
return
|
||||
return &BoltStore{m, db}, nil
|
||||
}
|
||||
|
||||
type dump struct {
|
||||
|
|
|
|||
302
vendor/github.com/blevesearch/segment/segment_words.go
generated
vendored
302
vendor/github.com/blevesearch/segment/segment_words.go
generated
vendored
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
//line segment_words.rl:1
|
||||
// Copyright (c) 2015 Couchbase, Inc.
|
||||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
||||
|
|
@ -31,7 +30,6 @@ const (
|
|||
Ideo
|
||||
)
|
||||
|
||||
|
||||
//line segment_words.go:36
|
||||
var _s_key_offsets []uint16 = []uint16{
|
||||
0, 1, 3, 5, 7, 10, 15, 20,
|
||||
|
|
@ -18539,10 +18537,8 @@ const s_error int = -1
|
|||
|
||||
const s_en_main int = 4862
|
||||
|
||||
|
||||
//line segment_words.rl:35
|
||||
|
||||
|
||||
func segmentWords(data []byte, maxTokens int, atEOF bool, val [][]byte, types []int) ([][]byte, []int, int, error) {
|
||||
cs, p, pe := 0, 0, len(data)
|
||||
cap := maxTokens
|
||||
|
|
@ -18587,12 +18583,11 @@ func segmentWords(data []byte, maxTokens int, atEOF bool, val [][]byte, types []
|
|||
if p == pe {
|
||||
goto _test_eof
|
||||
}
|
||||
_resume:
|
||||
_resume:
|
||||
switch _s_from_state_actions[cs] {
|
||||
case 23:
|
||||
//line NONE:1
|
||||
ts = p
|
||||
|
||||
ts = p
|
||||
|
||||
//line segment_words.go:18598
|
||||
}
|
||||
|
|
@ -18639,7 +18634,7 @@ ts = p
|
|||
switch {
|
||||
case data[p] < _s_trans_keys[_mid]:
|
||||
_upper = _mid - 2
|
||||
case data[p] > _s_trans_keys[_mid + 1]:
|
||||
case data[p] > _s_trans_keys[_mid+1]:
|
||||
_lower = _mid + 2
|
||||
default:
|
||||
_trans += int((_mid - int(_keys)) >> 1)
|
||||
|
|
@ -18649,9 +18644,9 @@ ts = p
|
|||
_trans += _klen
|
||||
}
|
||||
|
||||
_match:
|
||||
_match:
|
||||
_trans = int(_s_indicies[_trans])
|
||||
_eof_trans:
|
||||
_eof_trans:
|
||||
cs = int(_s_trans_targs[_trans])
|
||||
|
||||
if _s_trans_actions[_trans] == 0 {
|
||||
|
|
@ -18664,19 +18659,18 @@ _eof_trans:
|
|||
|
||||
endPos = p
|
||||
|
||||
|
||||
case 34:
|
||||
//line segment_words.rl:76
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
if !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Number)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18684,9 +18678,9 @@ p--
|
|||
|
||||
case 37:
|
||||
//line segment_words.rl:89
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18695,7 +18689,7 @@ p--
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Letter)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18703,9 +18697,9 @@ p--
|
|||
|
||||
case 39:
|
||||
//line segment_words.rl:104
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18714,7 +18708,7 @@ p--
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18722,15 +18716,15 @@ p--
|
|||
|
||||
case 35:
|
||||
//line segment_words.rl:119
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
if !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Letter)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18738,9 +18732,9 @@ p--
|
|||
|
||||
case 38:
|
||||
//line segment_words.rl:131
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18749,7 +18743,7 @@ p--
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18757,9 +18751,9 @@ p--
|
|||
|
||||
case 40:
|
||||
//line segment_words.rl:146
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18768,7 +18762,7 @@ p--
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18776,15 +18770,15 @@ p--
|
|||
|
||||
case 41:
|
||||
//line segment_words.rl:161
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -18795,7 +18789,7 @@ p--
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18803,15 +18797,15 @@ p--
|
|||
|
||||
case 32:
|
||||
//line segment_words.rl:161
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -18822,7 +18816,7 @@ p--
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18830,15 +18824,15 @@ p--
|
|||
|
||||
case 36:
|
||||
//line segment_words.rl:161
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -18849,7 +18843,7 @@ p--
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18857,15 +18851,15 @@ p--
|
|||
|
||||
case 31:
|
||||
//line segment_words.rl:161
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
te = p
|
||||
p--
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -18876,7 +18870,7 @@ p--
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18884,15 +18878,15 @@ p--
|
|||
|
||||
case 4:
|
||||
//line segment_words.rl:76
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
if !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Number)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18900,8 +18894,8 @@ p = (te) - 1
|
|||
|
||||
case 12:
|
||||
//line segment_words.rl:89
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18910,7 +18904,7 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Letter)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18918,8 +18912,8 @@ p = (te) - 1
|
|||
|
||||
case 17:
|
||||
//line segment_words.rl:104
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18928,7 +18922,7 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18936,14 +18930,14 @@ p = (te) - 1
|
|||
|
||||
case 7:
|
||||
//line segment_words.rl:119
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
if !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Letter)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18951,8 +18945,8 @@ p = (te) - 1
|
|||
|
||||
case 15:
|
||||
//line segment_words.rl:131
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18961,7 +18955,7 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18969,8 +18963,8 @@ p = (te) - 1
|
|||
|
||||
case 19:
|
||||
//line segment_words.rl:146
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
} else if dr, size := utf8.DecodeRune(data[endPos+1:]); dr == utf8.RuneError && size == 1 {
|
||||
|
|
@ -18979,7 +18973,7 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -18987,14 +18981,14 @@ p = (te) - 1
|
|||
|
||||
case 21:
|
||||
//line segment_words.rl:161
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19005,7 +18999,7 @@ p = (te) - 1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -19013,14 +19007,14 @@ p = (te) - 1
|
|||
|
||||
case 8:
|
||||
//line segment_words.rl:161
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19031,7 +19025,7 @@ p = (te) - 1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -19039,14 +19033,14 @@ p = (te) - 1
|
|||
|
||||
case 1:
|
||||
//line segment_words.rl:161
|
||||
p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19057,7 +19051,7 @@ p = (te) - 1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -19067,7 +19061,8 @@ p = (te) - 1
|
|||
//line NONE:1
|
||||
switch act {
|
||||
case 1:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
if !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
|
|
@ -19075,13 +19070,14 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Number)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
|
|
@ -19091,13 +19087,14 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Letter)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
|
|
@ -19107,26 +19104,28 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
if !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Letter)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
case 5:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
return val, types, totalConsumed, nil
|
||||
|
|
@ -19136,20 +19135,21 @@ p = (te) - 1
|
|||
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, Ideo)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
case 7:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19160,20 +19160,21 @@ p = (te) - 1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
case 12:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19184,20 +19185,21 @@ p = (te) - 1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
case 13:
|
||||
{p = (te) - 1
|
||||
{
|
||||
p = (te) - 1
|
||||
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19208,14 +19210,13 @@ p = (te) - 1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
case 28:
|
||||
//line segment_words.rl:68
|
||||
|
||||
|
|
@ -19225,21 +19226,20 @@ p = (te) - 1
|
|||
|
||||
endPos = p
|
||||
|
||||
|
||||
case 33:
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
te = p+1
|
||||
{
|
||||
te = p + 1
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19250,7 +19250,7 @@ te = p+1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -19262,14 +19262,14 @@ te = p+1
|
|||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
te = p+1
|
||||
{
|
||||
te = p + 1
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19280,7 +19280,7 @@ te = p+1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -19288,13 +19288,12 @@ te = p+1
|
|||
|
||||
case 18:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
|
||||
case 26:
|
||||
//line segment_words.rl:68
|
||||
|
||||
|
|
@ -19305,14 +19304,14 @@ te = p+1
|
|||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
te = p+1
|
||||
{
|
||||
te = p + 1
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19323,7 +19322,7 @@ te = p+1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -19339,14 +19338,14 @@ te = p+1
|
|||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
te = p+1
|
||||
{
|
||||
te = p + 1
|
||||
{
|
||||
lastPos := startPos
|
||||
for lastPos <= endPos {
|
||||
_, size := utf8.DecodeRune(data[lastPos:])
|
||||
lastPos += size
|
||||
}
|
||||
endPos = lastPos -1
|
||||
endPos = lastPos - 1
|
||||
p = endPos
|
||||
|
||||
if endPos+1 == pe && !atEOF {
|
||||
|
|
@ -19357,7 +19356,7 @@ te = p+1
|
|||
// otherwise, consume this as well
|
||||
val = append(val, data[startPos:endPos+1])
|
||||
types = append(types, None)
|
||||
totalConsumed = endPos+1
|
||||
totalConsumed = endPos + 1
|
||||
if maxTokens > 0 && len(val) >= maxTokens {
|
||||
return val, types, totalConsumed, nil
|
||||
}
|
||||
|
|
@ -19365,95 +19364,95 @@ te = p+1
|
|||
|
||||
case 5:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:76
|
||||
act = 1;
|
||||
act = 1
|
||||
|
||||
case 11:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:89
|
||||
act = 2;
|
||||
act = 2
|
||||
|
||||
case 16:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:104
|
||||
act = 3;
|
||||
act = 3
|
||||
|
||||
case 6:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:119
|
||||
act = 4;
|
||||
act = 4
|
||||
|
||||
case 14:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:131
|
||||
act = 5;
|
||||
act = 5
|
||||
|
||||
case 20:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
act = 7;
|
||||
act = 7
|
||||
|
||||
case 9:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
act = 12;
|
||||
act = 12
|
||||
|
||||
case 2:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:72
|
||||
|
||||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
act = 13;
|
||||
act = 13
|
||||
|
||||
case 29:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:68
|
||||
|
||||
|
|
@ -19464,11 +19463,11 @@ te = p+1
|
|||
endPos = p
|
||||
|
||||
//line segment_words.rl:76
|
||||
act = 1;
|
||||
act = 1
|
||||
|
||||
case 30:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:68
|
||||
|
||||
|
|
@ -19479,11 +19478,11 @@ te = p+1
|
|||
endPos = p
|
||||
|
||||
//line segment_words.rl:119
|
||||
act = 4;
|
||||
act = 4
|
||||
|
||||
case 25:
|
||||
//line NONE:1
|
||||
te = p+1
|
||||
te = p + 1
|
||||
|
||||
//line segment_words.rl:68
|
||||
|
||||
|
|
@ -19494,17 +19493,16 @@ te = p+1
|
|||
endPos = p
|
||||
|
||||
//line segment_words.rl:161
|
||||
act = 13;
|
||||
act = 13
|
||||
|
||||
//line segment_words.go:19500
|
||||
}
|
||||
|
||||
_again:
|
||||
_again:
|
||||
switch _s_to_state_actions[cs] {
|
||||
case 22:
|
||||
//line NONE:1
|
||||
ts = 0
|
||||
|
||||
ts = 0
|
||||
|
||||
//line segment_words.go:19510
|
||||
}
|
||||
|
|
@ -19512,7 +19510,9 @@ ts = 0
|
|||
if p++; p != pe {
|
||||
goto _resume
|
||||
}
|
||||
_test_eof: {}
|
||||
_test_eof:
|
||||
{
|
||||
}
|
||||
if p == eof {
|
||||
if _s_eof_trans[cs] > 0 {
|
||||
_trans = int(_s_eof_trans[cs] - 1)
|
||||
|
|
@ -19524,7 +19524,6 @@ ts = 0
|
|||
|
||||
startPos = p
|
||||
|
||||
|
||||
//line segment_words.go:19529
|
||||
}
|
||||
}
|
||||
|
|
@ -19533,7 +19532,6 @@ ts = 0
|
|||
|
||||
//line segment_words.rl:278
|
||||
|
||||
|
||||
if cs < s_first_final {
|
||||
return val, types, totalConsumed, ParseError
|
||||
}
|
||||
|
|
|
|||
24417
vendor/github.com/blevesearch/segment/segment_words_prod.go
generated
vendored
24417
vendor/github.com/blevesearch/segment/segment_words_prod.go
generated
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue