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

Function nodeArray

expr/parse.go:870–917  ·  view source on GitHub ↗
(t *tree, depth int)

Source from the content-addressed store, hash-verified

868}
869
870func nodeArray(t *tree, depth int) ([]Node, error, bool) {
871
872 nodes := make([]Node, 0)
873
874 for {
875
876 t.discardNewLinesAndComments()
877
878 switch t.Cur().T {
879 case lex.TokenRightParenthesis:
880 debugf(depth, "NodeArray(%d) EXIT", len(nodes))
881 return nodes, nil, true
882 case lex.TokenComma:
883 t.Next() // Consume
884 }
885
886 debugf(depth, "NodeArray(%d) cur:%v peek:%v", len(nodes), t.Cur().V, t.Peek().V)
887 n := t.O(depth + 1)
888 if n == nil {
889 return nodes, nil, true
890 }
891 nodes = append(nodes, n)
892
893 nextNodeLoop:
894 for {
895 // We are going to loop until we find the first Non-Comment Token
896 switch t.Cur().T {
897 case lex.TokenNewLine:
898 t.Next() // Consume new line
899 break nextNodeLoop
900 case lex.TokenComma:
901 // indicates start of new expression
902 t.Next() // consume comma
903 break nextNodeLoop
904 case lex.TokenComment, lex.TokenCommentML,
905 lex.TokenCommentStart, lex.TokenCommentHash, lex.TokenCommentEnd,
906 lex.TokenCommentSingleLine, lex.TokenCommentSlashes:
907 // skip, currently ignore these
908 t.Next()
909 case lex.TokenRightParenthesis:
910 return nodes, nil, true
911 default:
912 // first non-comment token
913 break nextNodeLoop
914 }
915 }
916 }
917}
918
919func (t *tree) discardNewLinesAndComments() {
920 for {

Callers 1

FMethod · 0.85

Calls 6

OMethod · 0.80
debugfFunction · 0.70
CurMethod · 0.65
NextMethod · 0.65
PeekMethod · 0.65

Tested by

no test coverage detected