title: Parse indentation level with PEG.js
body: <p>I have essentially the same question as <a href="https://stackoverflow.com/questions/4205442/peg-for-python-style-indentation">PEG for Python style indentation</a>, but I'd like to get a little more direction regarding <a href="https://stackoverflow.com/a/10708913/711902">this answer</a>.</p>
  
  <p>The answer successfully generates an array of strings that are each line of input with 'INDENT' and 'DEDENT' between lines. It seems like he's pretty much used PEG.js to tokenize, but no real parsing is happening.</p>
  
  <p>So how can I extend his example to do some actual parsing?</p>
  
  <p>As an example, how can I change this grammar:</p>
  
  <pre><code>start = obj
  obj = id:id children:(indent obj* outdent)?
      {
          if (children) {
              let o = {}; o[id] = children[1];
              return o;
          } else {
              return id;
          }
      }
  id = [a-z]
  indent = '{'
  outdent = '}'
  </code></pre>
  
  <p>to use indentation instead of braces to delineate blocks, and still get the same output?</p>
  
  <p>(Use <a href="http://pegjs.majda.cz/online" rel="nofollow noreferrer">http://pegjs.majda.cz/online</a> to test that grammar with the following input: <code>a{bcd{zyx{}}}</code>)</p>