Skip to content

Commit

Permalink
The configuration generated for a module referenced by its path no lo…
Browse files Browse the repository at this point in the history
…nger contains quotes around the path
  • Loading branch information
xcambar committed Apr 4, 2012
1 parent 94f6629 commit 9d106b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions harmony_parser.js
Expand Up @@ -25,9 +25,9 @@ case 7:this.$ = []
break;
case 8:this.$ = {type: 'module', path: $$[$0]}
break;
case 9:this.$ = {type: 'uri', path: $$[$0].replace(/^['"]/, '').replace(/['"]$/, '')}
case 9:this.$ = {type: 'uri', path: $$[$0].trim().replace(/^(['"])(.*)\1$/, function (str, m1, m2, m3) { return m2;})}
break;
case 10:this.$ = {id: $$[$0-3], path: $$[$0-1]}
case 10:this.$ = {id: $$[$0-3], path: $$[$0-1].trim().replace(/^(['"])(.*)\1$/, function (str, m1, m2, m3) { return m2;})}
break;
case 11:this.$ = {id: $$[$0-3], src: $$[$0-1]}
break;
Expand Down
4 changes: 2 additions & 2 deletions src/harmony_parser.jison
Expand Up @@ -109,12 +109,12 @@ ModuleSpecifier
: Path
{$$ = {type: 'module', path: $1}}
| String
{$$ = {type: 'uri', path: $1.replace(/^['"]/, '').replace(/['"]$/, '')}}
{$$ = {type: 'uri', path: $1.trim().replace(/^(['"])(.*)\1$/, function (str, m1, m2, m3) { return m2;})}}
;

ModuleDeclaration
: module Id at String SEMICOLON
{$$ = {id: $2, path: $4}}
{$$ = {id: $2, path: $4.trim().replace(/^(['"])(.*)\1$/, function (str, m1, m2, m3) { return m2;})}}
| module Id IS ImportSource SEMICOLON
{$$ = {id: $2, src: $4}}
| module Id OPEN_BRACE ModuleBody CLOSE_BRACE
Expand Down
2 changes: 1 addition & 1 deletion test/parserSpec.js
Expand Up @@ -15,7 +15,7 @@ describe ('ECMAScript:Harmony module definition parser', function () {
it('should accept module reference', function () {
expect(parser.parse('module M at "http://code.jquery.com/latest.js";')[0].type).toBe('module');
expect(parser.parse('module M at "http://code.jquery.com/latest.js";')[0].decl.id).toBe('M');
expect(parser.parse('module M at "http://code.jquery.com/latest.js";')[0].decl.path).toBe('"http://code.jquery.com/latest.js"');
expect(parser.parse('module M at "http://code.jquery.com/latest.js";')[0].decl.path).toBe('http://code.jquery.com/latest.js');
});

it('should accept local renaming', function () {
Expand Down

0 comments on commit 9d106b7

Please sign in to comment.