title: How to get tokens in Jison?
body: <p>I'm using Jison for a college project, and I need to make a <code>switch</code> for each recognized token, so I can present to the professor something like:</p>
  
  <pre class="lang-none prettyprint-override"><code>&lt;identifier, s&gt;
  &lt;operator, =&gt;
  &lt;identifier, a&gt;
  &lt;operator, +&gt;
  &lt;identifier, b&gt;
  </code></pre>
  
  <p>Any way on how to get this done without recurring to regular expressions manually? (I mean, Jison uses regexp internally but that's not my business)</p>
  
  <p>What I tried doing is the following:
  </p>
  
  <pre><code>var lex = parser.lexer,
      token;
  lex.setInput('The code to parse');
  while (!lex.done) {
      token = lex.next();
  }
  </code></pre>
  
  <p>But the only thing I get saved in <code>token</code> is a number, and when a symbol is not defined in the grammar, it returns character-by-character token.</p>
  
  <p>Thanks in advance.</p>