MCPcopy Create free account
hub / github.com/cogentcore/core / DepthError

Method DepthError

shell/shell.go:238–257  ·  view source on GitHub ↗

DepthError reports an error if any of the parsing depths are not zero, to be called at the end of transpiling a complete block of code.

()

Source from the content-addressed store, hash-verified

236// DepthError reports an error if any of the parsing depths are not zero,
237// to be called at the end of transpiling a complete block of code.
238func (sh *Shell) DepthError() error {
239 if sh.TotalDepth() == 0 {
240 return nil
241 }
242 str := ""
243 if sh.ParenDepth != 0 {
244 str += fmt.Sprintf("Incomplete parentheses (), remaining depth: %d\n", sh.ParenDepth)
245 }
246 if sh.BraceDepth != 0 {
247 str += fmt.Sprintf("Incomplete braces [], remaining depth: %d\n", sh.BraceDepth)
248 }
249 if sh.BrackDepth != 0 {
250 str += fmt.Sprintf("Incomplete brackets {}, remaining depth: %d\n", sh.BrackDepth)
251 }
252 if str != "" {
253 slog.Error(str)
254 return errors.New(str)
255 }
256 return nil
257}
258
259// AddLine adds line on the stack
260func (sh *Shell) AddLine(ln string) {

Callers 2

TranspileFileMethod · 0.95
RunFunction · 0.80

Calls 3

TotalDepthMethod · 0.95
NewFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected