allowing Mod1 - Mod5 in keybindings defined through :map command
[vimprobable2.git] / js-merge-helper.pl
blob050d871791c56e8f9a3a776ad23fa6edfd464417
1 #!/bin/env perl -w
2 use strict;
4 sub escape_c_string {
5 shift;
6 s/\t|\r|\n/ /g; # convert spacings to whitespaces
7 s/[^\/]\/\*.*?\*\///g; # remove comments (careful: hinttags look like comment!)
8 s/ {2,}/ /g; # strip whitespaces
9 s/(^|\(|\)|;|,|:|\}|\{|=|\+|\-|\*|\&|\||\<|\>|!) +/$1/g;
10 s/ +($|\(|\)|;|,|:|\}|\{|=|\+|\-|\*|\&|\||\<|\>|!)/$1/g;
11 s/\\/\\\\/g; # escape backslashes
12 s/\"/\\\"/g; # escape quotes
13 return $_
16 open(JSFILE, "hinting.js") or die "Failed to open file: $!";
17 $_ = do { local $/; <JSFILE> };
18 close(JSFILE);
19 my $js_hints = escape_c_string($_);
21 open(JSFILE, "input-focus.js") or die "Failed to open file: $!";
22 $_ = do { local $/; <JSFILE> };
23 close(JSFILE);
24 my $js_input = escape_c_string($_);
26 open(HFILE, ">javascript.h") or die "Failed to open javascript.h: $!";
27 print HFILE "#define JS_SETUP_HINTS ";
28 printf HFILE "\"%s\"\n", $js_hints;
29 print HFILE "#define JS_SETUP_INPUT_FOCUS ";
30 printf HFILE "\"%s\"\n", $js_input;
31 close(HFILE);
33 exit;