Skip to content

Commit 6e97f74

Browse files
authored
Merge pull request #3 from sc-forks/interpolation
Allow simple interpolated argument in CallExpression
2 parents 68e1540 + 861498a commit 6e97f74

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

solidity.pegjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ IdentifierName "identifier"
171171
};
172172
}
173173

174+
Interpolation
175+
= "{{" __ name:IdentifierName __ "}}" { return name; }
176+
174177
IdentifierStart
175178
= UnicodeLetter
176179
/ "$"
@@ -660,6 +663,9 @@ Arguments
660663
/ "(" __ "{" __ args:(NameValueList (__ ",")? )? __ "}" __ ")" {
661664
return optionalList(extractOptional(args, 0));
662665
}
666+
/ "(" __ args:Interpolation __ ")" {
667+
return [args];
668+
}
663669

664670
ArgumentList
665671
= head:AssignmentExpression tail:(__ "," __ AssignmentExpression)* {

test/doc_examples.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,8 @@ contract Ballot {
395395
voted: true,
396396
});
397397
}
398+
399+
contract GnosisInterpolations {
400+
uint constant x = 2;
401+
EventFactory constant eventFactory = EventFactory({{EventFactory}});
402+
}

0 commit comments

Comments
 (0)