Last active
August 29, 2015 14:10
-
-
Save WayneCui/0435543758e3d0ed642f to your computer and use it in GitHub Desktop.
remove comments from JS source files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rebol [ | |
Title: {remove comments from JS source files} | |
Author: "Cui Wen" | |
File: %comment-cleaner.reb | |
Version: 0.1.0 | |
Tabs: 4 | |
] | |
data: { | |
/** | |
* Helper function for iterating over an array. | |
*/ | |
function each(ary, func) {} //Similar to .... | |
/** | |
* Allow getting a global that is expressed in dot notation, like 'a.b.c'. | |
*/ | |
var s = 1; | |
function getGlobal(value) {} | |
//the end | |
var url = "http://www.rebol.com" | |
} | |
parse data [ | |
any [ | |
to [ {/*} | {//} | {://} ][ | |
remove [ | |
{/*} thru {*/} | {//} to lf | |
] | |
| | |
{://} skip ; match branch REMOVE | |
] | |
| | |
skip ;match branch TO | |
] | |
] | |
probe data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment