massimiliano-mantione/metascript — pull request #22 by drslump (2014-05-30 21:38:58+00:00)
Title: Support for regexp literals

Incorporates regexp literals to the language with the exact same syntax they have on JavaScript.

The only inconvenience is the disambiguation with the division operator, since on metascript the following is equivalent:

func /foo/ -> func(/foo/)

it gets trickier to detect what's a regexp literal and what's just an arithmetic operation with two division operators on the same line. The solution implemented has been to completely forbid spaces on regexp literals:

func /foo/ -> func(/foo/)
func / foo/ bar -> func / foo/ bar

In the future I would like to extend the regexp literal syntax to allow it to support multi line patterns ala [xregexp](http://xregexp.com/) by following the triple quotes for strings:

///
foo ; ident
[a-z]+ ; class
(? \d+ ) ; capture with name
///m