scrat-team / scrat

Webapp Modular Framework
http://scrat-team.github.io/
773 stars 147 forks source link

[UPD] 忽略对swig中注释的处理 #68

Closed fouber closed 8 years ago

fouber commented 8 years ago

避免处理swig中的注释,这个最好测试一下

atian25 commented 8 years ago

\} 是没必要转义的, 要不要改下?

以下这个正则, 在 scrat3 里面单元测试过了.

//                comment   | (  1  )(?:(            2             )(        3      )(     4    )|(     5     )(    6   )(          7         ))/
const regex = /\{#[\s\S]*?#}|(\{%\s*)(?:(require\s+(?:\$id\s*=\s*)?)('[^']+'|"[^"]+")([\s\S]*?%})|(script\s*%})([\s\S]+?)(\{%\s*endscript\s*%}))/g; 

image

image