massimiliano-mantione/metascript — pull request #41 by drslump (2014-06-15 19:43:38+00:00)
Title: Parser CST support and linter option

In order to implement linter style tools we need a concrete syntax tree to better reflect what's the source like. Since metascript is has such a regular syntax the current AST as generated by the parser (before the combination phase) is close enough. These changes introduce three new syntax tokens (``, `` and ``) to capture information that was being discarded until now.

Moreover, since the CST and AST are so similar, the compiler can consume either one, CST tokens are stripped on the combination phase. This means that if we want to access the CST but also compile the source, there is no need to parse it twice.

The idea is that for tools (linters, editor plugins, ...) requiring more specific information about the original source they can reuse the parser instead of rolling their own. To demo the implementation I've included a really dumb linter.

> note: The generation of CST nodes is optional and not enabled by default.