Skip to content

Commit

Permalink
Update plugins line pattern to support opt parens (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
friederbluemle authored Feb 5, 2022
1 parent 2e54594 commit 0bc0585
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var DEPS_EASY_GAV_STRING_REGEX = RegExp('(["\']?)([\\w.-]+):([\\w.-]+):([\\w\\[\
var DEPS_HARD_GAV_STRING_REGEX = RegExp(DEPS_KEYWORD_STRING_PATTERN + '(?:\\((.*)\\)|(.*))');
var DEPS_ITEM_BLOCK_REGEX = RegExp(DEPS_KEYWORD_STRING_PATTERN + '\\(((["\']?)(.*)\\3)\\)[ \\t]*\\{');
var DEPS_EXCLUDE_LINE_REGEX = RegExp('exclude[ \\t]+([^\\n]+)', 'g');
var PLUGINS_LINE_PATTERN = RegExp('(id|version)(?:[ \\t])(["\']?)([A-Za-z0-9.]+)\\2', 'g');
var PLUGINS_LINE_PATTERN = RegExp('(id|version)[ \\t]*\\(?(["\']?)([A-Za-z0-9.]+)\\2\\)?', 'g');


function deepParse(chunk, state, keepFunctionCalls, skipEmptyValues) {
Expand Down
6 changes: 6 additions & 0 deletions test/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ describe('Gradle build file parser', function() {
id 'some.id.here' version 'some.version.here'
id 'another.id.here'
version 'some.other.version.here' id 'some.other.id.here'
id "plugin.id.doublequotes"
id ('plugin.id.parens')
id ('plugin.id.parens.version') version '1.2.3'
}
*/});

Expand All @@ -309,6 +312,9 @@ describe('Gradle build file parser', function() {
{id: 'some.id.here', version: 'some.version.here'},
{id: 'another.id.here'},
{id: 'some.other.id.here', version: 'some.other.version.here'},
{id: 'plugin.id.doublequotes'},
{id: 'plugin.id.parens'},
{id: 'plugin.id.parens.version', version: '1.2.3'}
]
};
return parser.parseText(dsl).then(function(parsedValue) {
Expand Down

0 comments on commit 0bc0585

Please sign in to comment.