title: Detecting and skipping line comments with Flex
body: <p>How can I detect one line comments like <code>//</code> in Flex and skip those lines?</p>
  
  <p>Also, for <code>/*</code> comments, will the following snippet be enough?</p>
  
  <pre><code>   "/*"         { comment(); }
    %%
  
      comment()
      {
          char c, c1;
      loop:
          while ((c = input()) != '*' &amp;&amp; c != 0)
              putchar(c);
  
          if ((c1 = input()) != '/' &amp;&amp; c != 0)
          {
              unput(c1);
              goto loop;
          }
  
          if (c != 0)
              putchar(c1);
      }
  </code></pre>