r40779 - in /trunk/libjavascript-beautifier-perl: Changes META.yml debian/changelog debian/control debian/copyright lib/JavaScript/Beautifier.pm t/01-javascript-beauty.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Sun Jul 26 19:56:43 UTC 2009
Author: jawnsy-guest
Date: Sun Jul 26 19:56:31 2009
New Revision: 40779
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=40779
Log:
* New upstream release
+ Allow unescaped / in regular expression character classes
+ Fixed broken <!-- / --> handline
+ Added space between anonymous function parentheses
* Standards-Version 3.8.2 (no changes)
* Updated description in control file
* Added myself to Uploaders and Copyright
Modified:
trunk/libjavascript-beautifier-perl/Changes
trunk/libjavascript-beautifier-perl/META.yml
trunk/libjavascript-beautifier-perl/debian/changelog
trunk/libjavascript-beautifier-perl/debian/control
trunk/libjavascript-beautifier-perl/debian/copyright
trunk/libjavascript-beautifier-perl/lib/JavaScript/Beautifier.pm
trunk/libjavascript-beautifier-perl/t/01-javascript-beauty.t
Modified: trunk/libjavascript-beautifier-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-beautifier-perl/Changes?rev=40779&op=diff
==============================================================================
--- trunk/libjavascript-beautifier-perl/Changes (original)
+++ trunk/libjavascript-beautifier-perl/Changes Sun Jul 26 19:56:31 2009
@@ -1,4 +1,9 @@
Revision history for JavaScript-Beautifier
+
+0.12 2009.07.26
+ fixed broken <!-- / --> handline
+ Allow unescaped / in regexp character classes.
+ Added space between anon function parens.
0.11 2009.06.09
Fix .git MANIFEST
Modified: trunk/libjavascript-beautifier-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-beautifier-perl/META.yml?rev=40779&op=diff
==============================================================================
--- trunk/libjavascript-beautifier-perl/META.yml (original)
+++ trunk/libjavascript-beautifier-perl/META.yml Sun Jul 26 19:56:31 2009
@@ -1,6 +1,6 @@
---
name: JavaScript-Beautifier
-version: 0.11
+version: 0.12
author:
- 'Fayland Lam <fayland at gmail.com>'
abstract: Beautify Javascript (beautifier for javascript)
@@ -15,7 +15,7 @@
provides:
JavaScript::Beautifier:
file: lib/JavaScript/Beautifier.pm
- version: 0.11
+ version: 0.12
generated_by: Module::Build version 0.33
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
Modified: trunk/libjavascript-beautifier-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-beautifier-perl/debian/changelog?rev=40779&op=diff
==============================================================================
--- trunk/libjavascript-beautifier-perl/debian/changelog (original)
+++ trunk/libjavascript-beautifier-perl/debian/changelog Sun Jul 26 19:56:31 2009
@@ -1,3 +1,15 @@
+libjavascript-beautifier-perl (0.12-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ + Allow unescaped / in regular expression character classes
+ + Fixed broken <!-- / --> handline
+ + Added space between anonymous function parentheses
+ * Standards-Version 3.8.2 (no changes)
+ * Updated description in control file
+ * Added myself to Uploaders and Copyright
+
+ -- Jonathan Yu <frequency at cpan.org> Sun, 26 Jul 2009 11:51:15 -0400
+
libjavascript-beautifier-perl (0.11-1) unstable; urgency=low
[ Nathan Handler ]
Modified: trunk/libjavascript-beautifier-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-beautifier-perl/debian/control?rev=40779&op=diff
==============================================================================
--- trunk/libjavascript-beautifier-perl/debian/control (original)
+++ trunk/libjavascript-beautifier-perl/debian/control Sun Jul 26 19:56:31 2009
@@ -4,8 +4,8 @@
Build-Depends: debhelper (>= 7.0.50), quilt (>= 0.46-7)
Build-Depends-Indep: libtest-pod-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Ryan Niebur <ryanryan52 at gmail.com>
-Standards-Version: 3.8.1
+Uploaders: Ryan Niebur <ryanryan52 at gmail.com>, Jonathan Yu <frequency at cpan.org>
+Standards-Version: 3.8.2
Homepage: http://search.cpan.org/dist/JavaScript-Beautifier/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libjavascript-beautifier-perl/
Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libjavascript-beautifier-perl/
@@ -13,8 +13,8 @@
Package: libjavascript-beautifier-perl
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}
-Description: beautifier for javascript
- JavaScript::Beautifier is a Perl-rewrite of a javascript
- beautifier. This beautifier can process your messy or compacted
- javascript, making it all neatly and consistently formatted and
- readable.
+Description: Perl module to beautify JavaScript code
+ JavaScript::Beautifier is a Perl module providing a simple way to beautify
+ arbitrary JavaScript code. This beautifier can process your messy or compacted
+ JavaScript, neatly and consistently formatting it, thus making it easier to
+ read and maintain.
Modified: trunk/libjavascript-beautifier-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-beautifier-perl/debian/copyright?rev=40779&op=diff
==============================================================================
--- trunk/libjavascript-beautifier-perl/debian/copyright (original)
+++ trunk/libjavascript-beautifier-perl/debian/copyright Sun Jul 26 19:56:31 2009
@@ -5,12 +5,13 @@
Upstream-Name: JavaScript-Beautifier
Files: *
-Copyright: Copyright (C) 2008-2009 Fayland Lam
+Copyright: 2008-2009, Fayland Lam <ayland at gmail.com>
License-Alias: Perl
License: Artistic | GPL-1+
Files: debian/*
-Copyright: 2009, Ryan Niebur <ryanryan52 at gmail.com>
+Copyright: 2009, Jonathan Yu <frequency at cpan.org>
+ 2009, Ryan Niebur <ryanryan52 at gmail.com>
License: Artistic | GPL-1+
License: Artistic
Modified: trunk/libjavascript-beautifier-perl/lib/JavaScript/Beautifier.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-beautifier-perl/lib/JavaScript/Beautifier.pm?rev=40779&op=diff
==============================================================================
--- trunk/libjavascript-beautifier-perl/lib/JavaScript/Beautifier.pm (original)
+++ trunk/libjavascript-beautifier-perl/lib/JavaScript/Beautifier.pm Sun Jul 26 19:56:31 2009
@@ -3,7 +3,7 @@
use warnings;
use strict;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
our $AUTHORITY = 'cpan:FAYLAND';
use base 'Exporter';
@@ -72,7 +72,7 @@
# do nothing on (( and )( and ][ and ]( ..
} elsif ( $last_type ne 'TK_WORD' && $last_type ne 'TK_OPERATOR' ) {
print_space();
- } elsif ( (grep { $last_word eq $_ } @line_starter) && $last_word ne 'function' ) {
+ } elsif ( grep { $last_word eq $_ } @line_starter ) {
print_space();
}
print_token();
@@ -343,7 +343,8 @@
}
sub print_space {
- my $last_output = scalar @output ? $output[ scalar @output - 1 ] : ' ';
+ my $last_output = ' ';
+ $last_output = $output[ scalar @output - 1 ] if scalar @output;
if ( $last_output ne ' ' && $last_output ne "\n" && $last_output ne $indent_string ) { # prevent occassional duplicate space
push @output, ' ';
}
@@ -376,17 +377,24 @@
}
sub get_next_token {
my $n_newlines = 0;
- my $c = '';
- do {
+
+ if ( $parser_pos >= scalar @input ) {
+ return ['', 'TK_EOF'];
+ }
+
+ my $c = $input[$parser_pos];
+ $parser_pos++;
+
+ while ( grep { $_ eq $c } @whitespace ) {
if ( $parser_pos >= scalar @input ) {
return ['', 'TK_EOF'];
}
+ if ( $c eq "\n" ) {
+ $n_newlines += 1;
+ }
$c = $input[$parser_pos];
$parser_pos++;
- if ( $c eq "\n" ) {
- $n_newlines += 1;
- }
- } while ( grep { $_ eq $c } @whitespace );
+ };
my $wanted_newline = 0;
if ( $opt_preserve_newlines ) {
if ( $n_newlines > 1 ) {
@@ -409,10 +417,11 @@
}
# small and surprisingly unugly hack for 1E-10 representation
- if ( $parser_pos != scalar @input && $c =~ /^[0-9]+[Ee]$/ && $input[$parser_pos] eq '-' ) {
+ if ( $parser_pos != scalar @input && $c =~ /^[0-9]+[Ee]$/ && ($input[$parser_pos] eq '-' || $input[$parser_pos] eq '+') ) {
+ my $sign = $input[$parser_pos];
$parser_pos++;
my $t = get_next_token($parser_pos);
- $c .= '-' . $t->[0];
+ $c .= $sign . $t->[0];
return [$c, 'TK_WORD'];
}
if ( $c eq 'in' ) { # hack for 'in' operator
@@ -481,20 +490,46 @@
my $esc = 0;
my $resulting_string = $c;
if ( $parser_pos < scalar @input ) {
- while ( $esc || $input[$parser_pos] ne $sep ) {
- $resulting_string .= $input[$parser_pos];
- if ( not $esc ) {
- $esc = ( $input[$parser_pos] eq '\\' ) ? 1 : 0;
- } else {
- $esc = 0;
+ if ( $sep eq '/') {
+ # handle regexp separately...
+ my $in_char_class = 0;
+ while ( $esc || $in_char_class || $input[$parser_pos] ne $sep ) {
+ $resulting_string .= $input[$parser_pos];
+ if ( not $esc ) {
+ $esc = ( $input[$parser_pos] eq '\\' ) ? 1 : 0;
+ if ( $input[$parser_pos] eq '[' ) {
+ $in_char_class = 1;
+ } elsif ( $input[$parser_pos] eq ']' ) {
+ $in_char_class = 0;
+ }
+ } else {
+ $esc = 0;
+ }
+ $parser_pos++;
+ if ( $parser_pos >= scalar @input ) {
+ # incomplete string/rexp when end-of-file reached.
+ # bail out with what had been received so far.
+ return [$resulting_string, 'TK_STRING'];
+ }
}
- $parser_pos++;
- if ( $parser_pos >= scalar @input ) {
- # incomplete string/rexp when end-of-file reached.
- # bail out with what had been received so far.
- return [$resulting_string, 'TK_STRING'];
- }
- }
+
+ } else {
+ # and handle string also separately
+ while ( $esc || $input[$parser_pos] ne $sep ) {
+ $resulting_string .= $input[$parser_pos];
+ if ( not $esc ) {
+ $esc = ( $input[$parser_pos] eq '\\' ) ? 1 : 0;
+ } else {
+ $esc = 0;
+ }
+ $parser_pos++;
+ if ( $parser_pos >= scalar @input ) {
+ # incomplete string/rexp when end-of-file reached.
+ # bail out with what had been received so far.
+ return [$resulting_string, 'TK_STRING'];
+ }
+ }
+ }
}
$parser_pos++;
$resulting_string .= $sep;
@@ -526,10 +561,17 @@
}
}
}
-
- if ($c eq '<' && join('', @input[0..3]) eq '<!--') {
+
+ if ($c eq '<' && $parser_pos + 2 < scalar @input && join('', @input[$parser_pos-1 .. $parser_pos+2]) eq '<!--') {
$parser_pos += 3;
return ['<!--', 'TK_COMMENT'];
+ }
+ if ($c eq '-' && $parser_pos + 1 < scalar @input && join('', @input[$parser_pos-1 .. $parser_pos+1]) eq '-->') {
+ $parser_pos += 2;
+ if ($wanted_newline) {
+ print_newline();
+ }
+ return ['-->', 'TK_COMMENT'];
}
if ( grep { $c eq $_ } @punct ) {
Modified: trunk/libjavascript-beautifier-perl/t/01-javascript-beauty.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libjavascript-beautifier-perl/t/01-javascript-beauty.t?rev=40779&op=diff
==============================================================================
--- trunk/libjavascript-beautifier-perl/t/01-javascript-beauty.t (original)
+++ trunk/libjavascript-beautifier-perl/t/01-javascript-beauty.t Sun Jul 26 19:56:31 2009
@@ -69,7 +69,7 @@
[ "do { a(); } while ( 1 );", "do {\n a();\n} while (1);" ],
[ "do {\n} while ( 1 );", "do {} while (1);" ],
- [ "var a, b, c, d = 0, c = function() {}, d = '';", "var a, b, c, d = 0,\nc = function() {},\nd = '';" ],
+ [ "var a, b, c, d = 0, c = function() {}, d = '';", "var a, b, c, d = 0,\nc = function () {},\nd = '';" ],
[ "delete x if (a) b();", "delete x\nif (a) b();" ],
[ "delete x[x] if (a) b();", "delete x[x]\nif (a) b();" ],
[ "do{x()}while(a>1)", "do {\n x()\n} while (a > 1)" ],
@@ -87,8 +87,20 @@
[ "a=/regexp", "a = /regexp" ], # incomplete regexp
[ "{a:#1=[],b:#1#,c:#999999#}", "{\n a: #1=[],\n b: #1#,\n c: #999999#\n}" ],
- [ 'var o=$.extend(a,function(){alert(x);}', "var o = \$.extend(a, function() {\n alert(x);\n}" ],
- [ 'var o=$.extend(a);function(){alert(x);}', "var o = \$.extend(a);\nfunction() {\n alert(x);\n}" ],
+ ["<!--\nsomething();\n-->", "<!--\nsomething();\n-->" ],
+ ["<!--\nif(i<0){bla();}\n-->", "<!--\nif (i < 0) {\n bla();\n}\n-->"],
+ ["<!--\nsomething();\n-->\n<!--\nsomething();\n-->", "<!--\nsomething();\n-->\n<!--\nsomething();\n-->"],
+ ["<!--\nif(i<0){bla();}\n-->\n<!--\nif(i<0){bla();}\n-->", "<!--\nif (i < 0) {\n bla();\n}\n-->\n<!--\nif (i < 0) {\n bla();\n}\n-->"],
+
+ [ 'var o=$.extend(a,function(){alert(x);}', "var o = \$.extend(a, function () {\n alert(x);\n}" ],
+ [ 'var o=$.extend(a);function(){alert(x);}', "var o = \$.extend(a);\nfunction () {\n alert(x);\n}" ],
+
+ # regexps
+ [ 'a(/abc\\/\\/def/);b()', "a(/abc\\/\\/def/);\nb()" ],
+ [ 'a(/a[b\\[\\]c]d/);b()', "a(/a[b\\[\\]c]d/);\nb()" ],
+ [ 'a(/a[b\\[', "a(/a[b\\[" ], # incomplete char class
+ # allow unescaped / in char classes
+ [ 'a(/[a/b]/);b()', "a(/[a/b]/);\nb()" ],
);
plan tests => scalar @tests + 4;
More information about the Pkg-perl-cvs-commits
mailing list