Skip to content

Commit

Permalink
Allow placeholder to be changed
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Jul 17, 2017
1 parent ee2f7a7 commit 5fa8631
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/config.lsc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export getMetadata() ->
description: "Specify arguments for a function using placeholders in the body."
valueType: "boolean"
}
placeholder: {
description: "Specify an identifier to be transformed into PlaceholderExpression."
valueType: "string"
}
}
}

Expand All @@ -88,6 +92,8 @@ export getParserOpts(pluginOpts, initialParserOpts) ->
if pluginOpts?.enhancedComprehension: plugins.push("enhancedComprehension")
if pluginOpts?.preferObjectLiteral: plugins.push("objectBlockAmbiguity_preferObject")
if pluginOpts?.placeholderArgs: plugins.push("syntacticPlaceholder")
if pluginOpts?.placeholder:
parserOpts.placeholder = pluginOpts.placeholder

// TODO: watch upstream on pattern matching; default to their syntax when complete
// patternMatchingVersion = pluginOpts?.patternMatching or "v4"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use @oigroup/lightscript with placeholder: "P"'

-> P
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use @oigroup/lightscript with placeholder: "P"';

(function (_arg) {
return _arg;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-> P
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(function (_arg) {
return _arg;
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": [["lightscript", { "placeholderArgs": true, "placeholder": "P" }]]
}

0 comments on commit 5fa8631

Please sign in to comment.