title: Acceptable use of a label and 'goto'?
body: <p>I am writing a tokenizer for a compiler. I have a while loop that loops over characters and then a switch that checks for certain conditions. I then need to exit both blocks to write the token:</p>
  
  <pre><code>Token token;
  
  while (peekChar() != '\0')
  {
      switch (c = nextChar())
      {
          case '(':
              token = Token(TOKEN_LEFT_PAREN, currentLine);
              goto MakeToken;
          // ... every other character, some with lots of logic
      }
  }
  
  MakeToken:
      // write the token
  </code></pre>
  
  <p>Is this an acceptable use of labels, or is there a better way? I have learnt to think of labels as just terrible practice, but surely there must be uses for them (or they wouldn't be implemented in the standard?). Thanks.</p>