NextArg loads the next token if it is on the same line and if it is not a block opening (open curly brace). Returns true if an argument token was loaded; false otherwise. If false, all tokens on the line have been consumed except for potentially a block opening. It handles imported tokens correctly.
()
| 87 | // a block opening. It handles imported tokens |
| 88 | // correctly. |
| 89 | func (d *Dispenser) NextArg() bool { |
| 90 | if !d.nextOnSameLine() { |
| 91 | return false |
| 92 | } |
| 93 | if d.Val() == "{" { |
| 94 | // roll back; a block opening is not an argument |
| 95 | d.cursor-- |
| 96 | return false |
| 97 | } |
| 98 | return true |
| 99 | } |
| 100 | |
| 101 | // nextOnSameLine advances the cursor if the next |
| 102 | // token is on the same line of the same file. |