Created
November 22, 2014 03:02
-
-
Save qfox/2f520023226c1a3aeb81 to your computer and use it in GitHub Desktop.
sed-js2php
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
sed -r -e 's/module.exports.*$/<?php\nreturn function ($bh) {/' \ | |
-e 's/bh\.match/\$bh->match/' \ | |
-e 's/function\(ctx\)/function($ctx)/' \ | |
-e 's/function\(ctx, json\)/function($ctx, $json)/' \ | |
-e 's/ctx\./$ctx->/g' \ | |
-e 's/(\s*)ctx$/\1$ctx/' \ | |
-e 's/json\./$json->/g' \ | |
-e 's/attrs\./$attrs->/g' \ | |
-e 's/\.(\w+)/->\1/g' \ | |
-e 's/(\w+) : /'\''\1'\'' => /g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment