diff --git a/lib/regexrules.js b/lib/regexrules.js index 191747b..d9d4596 100644 --- a/lib/regexrules.js +++ b/lib/regexrules.js @@ -83,6 +83,38 @@ module.exports = { start : "^[ \t]*#+[ \t]*@foreach[ \t]+(.*?)[ \t]*\n+", end : "^[ \t]*#+[ \t]*@endfor[ \t]*\n?" } + }, + pug : { + echo : [ + "(?:/\\*)[ \t]*@echo[ \t]*([^\n]*?)[ \t]*(?:\\*(?:\\*|/))", + "(?://-)[ \t]*@echo[ \t]*([^\n]*)[ \t]*" + ], + exec : "(?://-|/\\*)[ \t]*@exec[ \t]*([^\n]*)[ \t]*\\(([^\n]*)\\)[ \t]*(?:\\*(?:\\*|/))?", + include : [ + "(.*)(?:/\\*)[ \t]*@include(?!-)[ \t]*([^\n]*?)[ \t]*(?:\\*(?:\\*|/))", + "(.*)(?://-)[ \t]*@include(?!-)[ \t]*([^\n]*)[ \t]*" + ], + 'include-static': [ + "(.*)(?:/\\*)[ \t]*@include-static[ \t]*([^\n]*?)[ \t]*(?:\\*(?:\\*|/))", + "(.*)(?://-)[ \t]*@include-static[ \t]*([^\n]*)[ \t]*" + ], + exclude : { + start : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@exclude[ \t]*([^\n*]*)[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n]+)?", + end : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@endexclude[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n])?" + }, + extend : { + start : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@extend(?!able)[ \t]*([^\n*]*)[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n]+)?", + end : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@endextend[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n])?" + }, + extendable : "(?:[ \t]*)(?://-|/\\*)[ \t]*@extendable[ \t]*([^\n*]*)[ \t]*(?:\\*/)?", + if : { + start : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@(ifndef|ifdef|if)[ \t]*([^\n*]*)[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n]+)?", + end : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@endif[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n])?" + }, + foreach : { + start : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@foreach[ \t]*([^\n*]*)[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n]+)?", + end : "(?:[ \t]*)?(?://-|/\\*)[ \t]*@endfor[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*[\n])?" + } } };