title: Python PLY get next token during parsing
body: <p>I'm trying to get next token and make some operation depending on it. I know this is odd, but still is it possible to to something like this?:</p>
  <pre><code>def p_func(p):
      '''expr : MY_TOKEN'''
      if next_token is None:
          #do something here
      p[0] = p[1]
  </code></pre>
  <p>I've tried to do the following:</p>
  <pre><code>def p_func(p):
      '''expr : MY_TOKEN'''
      if parser.token() is None:
          #do something here
      p[0] = p[1]
  </code></pre>
  <p>it works to obtain token but it after this function next token skipped because I took it. Is it possible to return it back or get just copy of next token?</p>