code: func countIndents(input string) int {
  	var (
  		indents     = 0
  		inString    = false
  		strOpenChar = ' '   // keep track of the string open char to allow var str = "I'm ....";
  		charEscaped = false // keep track if the previous char was the '\' char, allow var str = "abc\"def";
  	)
  
  	for _, c := range input {
  		switch c {
  		case '\\':
  			// indicate next char as escaped when in string and previous char isn't escaping this backslash
  			if !charEscaped && inString {
  				charEscaped = true
  			}
  		case '\'', '"':
  			if inString && !charEscaped && strOpenChar == c { // end string
  				inString = false
  			} else if !inString && !charEscaped { // begin string
  				inString = true
  				strOpenChar = c
  			}
  			charEscaped = false
  		case '{', '(':
  			if !inString { // ignore brackets when in string, allow var str = "a{"; without indenting
  				indents++
  			}
  			charEscaped = false
  		case '}', ')':
  			if !inString {
  				indents--
  			}
  			charEscaped = false
  		default:
  			charEscaped = false
  		}
  	}
  
  	return indents
  }
docs: // countIndents returns the number of identations for the given input.
  // In case of invalid input such as var a = } the result can be negative.