aboutsummaryrefslogtreecommitdiffstats
path: root/termui
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2020-03-14 16:47:38 +0100
committerMichael Muré <batolettre@gmail.com>2020-03-28 17:13:27 +0100
commit5e4dc87ffec7f87bbf3ebfcf256777ad773e8450 (patch)
tree04553cfb7ab8ea279c7415586ce1d0fe5c819996 /termui
parent58abc6b0a35b679ac0c34579ff1cb53c8fa71af4 (diff)
downloadgit-bug-5e4dc87ffec7f87bbf3ebfcf256777ad773e8450.tar.gz
cache: replace the all-in-one query parser by a complete one with AST/lexer/parser
Diffstat (limited to 'termui')
-rw-r--r--termui/bug_table.go8
-rw-r--r--termui/termui.go5
2 files changed, 8 insertions, 5 deletions
diff --git a/termui/bug_table.go b/termui/bug_table.go
index 41aa4e83..74f92826 100644
--- a/termui/bug_table.go
+++ b/termui/bug_table.go
@@ -12,6 +12,8 @@ import (
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entity"
+ "github.com/MichaelMure/git-bug/query"
+ "github.com/MichaelMure/git-bug/query/ast"
"github.com/MichaelMure/git-bug/util/colors"
)
@@ -26,7 +28,7 @@ const defaultQuery = "status:open"
type bugTable struct {
repo *cache.RepoCache
queryStr string
- query *cache.Query
+ query *ast.Query
allIds []entity.Id
excerpts []*cache.BugExcerpt
pageCursor int
@@ -34,14 +36,14 @@ type bugTable struct {
}
func newBugTable(c *cache.RepoCache) *bugTable {
- query, err := cache.ParseQuery(defaultQuery)
+ q, err := query.Parse(defaultQuery)
if err != nil {
panic(err)
}
return &bugTable{
repo: c,
- query: query,
+ query: q,
queryStr: defaultQuery,
pageCursor: 0,
selectCursor: 0,
diff --git a/termui/termui.go b/termui/termui.go
index 1ef960de..96b7583c 100644
--- a/termui/termui.go
+++ b/termui/termui.go
@@ -12,6 +12,7 @@ import (
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/entity"
"github.com/MichaelMure/git-bug/input"
+ "github.com/MichaelMure/git-bug/query"
)
var errTerminateMainloop = errors.New("terminate gocui mainloop")
@@ -336,12 +337,12 @@ func editQueryWithEditor(bt *bugTable) error {
bt.queryStr = queryStr
- query, err := cache.ParseQuery(queryStr)
+ q, err := query.Parse(queryStr)
if err != nil {
ui.msgPopup.Activate(msgPopupErrorTitle, err.Error())
} else {
- bt.query = query
+ bt.query = q
}
initGui(nil)