title: Looking for RPAREN correctly (to enable fast parsing)
body: <p>What is the best way to look for the RPAREN in a code?
  For instance, I have this pseudo-code:</p>
  
  <pre><code>if(a &amp;&amp; (b || "c)"))
    |     ^---------^| CASE A
    ^----------------^ CASE B
  </code></pre>
  
  <p>For instance, if I consider the first LPAREN, it need match with the last RPAREN (Case B). If I consider the second LPAREN it need match with the last-1 RPAREN (Case A).</p>
  
  <p>Note that there are the string <code>"C)"</code> that have a RPAREN, but it need be ignored for the case.</p>
  
  <p>Well... I think about regex, but I guess that it will be very complex (note that need match strings, regex, and another thinks then can include RPAREN or something like that). Then I think about use a manual scan (via code) to detect each part (like a manual regex).</p>
  
  <p>I need that to parse a code that I'm building (own programmation language). And I want to ignore to read some codes to make it faster.</p>
  
  <p>For instance:</p>
  
  <pre><code>function a() { return 1; }
  function b() { return 2; }
  alert(b());
  </code></pre>
  
  <p>On this case, only <code>b()</code> need be parsed, because <code>a()</code> never is used. So I will scan by starter <code>{</code> and ignore (but store) until the real <code>}</code>. If the function is used, it'll be parsed.</p>
  
  <p>My doubts:</p>
  
  <ol>
  <li>Regex or manual code?</li>
  <li>It's a good or a bad thing to do? Do ignore the code if it never is used will help to improve de speed of parser?</li>
  <li>Off-topic: some tips to faster the parser? Maybe a "pre-parsed" file that store the language code with computer code (opcode???)?</li>
  </ol>