MCPcopy Create free account
hub / github.com/araddon/qlbridge / O

Method O

expr/parse.go:321–342  ·  view source on GitHub ↗

* General overview of Recursive Descent Parsing https://www.engr.mun.ca/~theo/Misc/exp_parsing.htm Operator Predence planner during parse phase: when we parse and build our node-sub-node structures we need to plan the precedence rules, we use a recursion tree to build this http://dev.mysql.c

(depth int)

Source from the content-addressed store, hash-verified

319
320// expr:
321func (t *tree) O(depth int) Node {
322 debugf(depth, "O pre: %v", t.Cur())
323 n := t.A(depth)
324 debugf(depth, "O post: n:%v cur:%v ", n, t.Cur())
325 for {
326 tok := t.Cur()
327 switch tok.T {
328 case lex.TokenLogicOr, lex.TokenOr:
329 t.Next()
330 n = NewBinaryNode(tok, n, t.A(depth+1))
331 case lex.TokenCommentSingleLine:
332 t.Next() // consume --
333 t.Next() // consume comment after --
334 case lex.TokenEOF, lex.TokenEOS, lex.TokenFrom, lex.TokenComma, lex.TokenIf,
335 lex.TokenAs, lex.TokenSelect, lex.TokenLimit:
336 // these are indicators of End of Current Clause, so we can return
337 return n
338 default:
339 return n
340 }
341 }
342}
343
344func (t *tree) A(depth int) Node {
345 debugf(depth, "A pre: %v", t.Cur())

Callers 5

parseMethod · 0.95
vMethod · 0.95
FuncMethod · 0.95
ArrayNodeMethod · 0.95
nodeArrayFunction · 0.80

Calls 5

AMethod · 0.95
NewBinaryNodeFunction · 0.85
debugfFunction · 0.70
CurMethod · 0.65
NextMethod · 0.65

Tested by

no test coverage detected