title: PLY Lex: ID could be anything
body: <p>I have a following simple format:</p>
  <pre><code>BLOCK ID {
      SUBBLOCK ID {
          SUBSUBBLOCK ID {
              SOME STATEMENTS;
          };
      };
  };
  </code></pre>
  <p>I configured ply to work with this format. But the issue is that ID could be any string including &quot;BLOCK&quot;, &quot;SUBBLOCK&quot;, etc.
  In the lexer I define ID as:</p>
  <pre><code>@TOKEN(r'[a-zA-Z_][a-zA-Z_0-9]*')
  def t_ID(self, t):
      t.type = self.keyword_map.get(t.value, &quot;ID&quot;)
      return t
  </code></pre>
  <p>But it means that BLOCK word will not be allowed as a block name.</p>
  <p>How I can overcome this issue?</p>