MCPcopy Create free account
hub / github.com/foxcpp/maddy / NextLine

Method NextLine

framework/config/lexer/dispenser.go:107–122  ·  view source on GitHub ↗

NextLine loads the next token only if it is not on the same line as the current token, and returns true if a token was loaded; false otherwise. If false, there is not another token or it is on the same line. It handles imported tokens correctly.

()

Source from the content-addressed store, hash-verified

105// loaded; false otherwise. If false, there is not another token
106// or it is on the same line. It handles imported tokens correctly.
107func (d *Dispenser) NextLine() bool {
108 if d.cursor < 0 {
109 d.cursor++
110 return true
111 }
112 if d.cursor >= len(d.tokens) {
113 return false
114 }
115 if d.cursor < len(d.tokens)-1 &&
116 (d.tokens[d.cursor].File != d.tokens[d.cursor+1].File ||
117 d.tokens[d.cursor].Line+d.numLineBreaks(d.cursor) < d.tokens[d.cursor+1].Line) {
118 d.cursor++
119 return true
120 }
121 return false
122}
123
124// NextBlock can be used as the condition of a for loop
125// to load the next token as long as it opens a block or

Callers 3

TestDispenser_NextLineFunction · 0.95
readNodeMethod · 0.80
readNodesMethod · 0.80

Calls 1

numLineBreaksMethod · 0.95

Tested by 1

TestDispenser_NextLineFunction · 0.76