Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion panc/src/main/jjtree/PanParser.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ org.quattor.pan.ttemplate.SourceRange typeSpec() #TypeSpec :
org.quattor.pan.ttemplate.SourceRange baseTypeSpec() #BaseTypeSpec :
{ Token t = null, b=null, e=null; org.quattor.pan.utils.Range r = null; }
{
t=<CHOICE> <LPAREN> stringLiteral() (<COMMA> stringLiteral())* e=<RPAREN>
t=<CHOICE> <LPAREN> stringLiteral() (LOOKAHEAD(2) <COMMA> stringLiteral())* [ <COMMA> ] e=<RPAREN>
{
jjtThis.setIdentifier(t.image);
jjtThis.setSourceRange(PanParserUtils.sourceRangeFromTokens(t,(e!=null)?e:t));
Expand Down
8 changes: 7 additions & 1 deletion panc/src/test/pan/Functionality/choice/choice18.pan
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

object template choice18;

type mychoice = choice("aa", "bb", "aaa", "bbb");
# Each entry on a new line, but no trailing comma
type mychoice = choice(
Comment thread
jrha marked this conversation as resolved.
"aa",
"bb",
"aaa",
"bbb"
);
bind '/x' = mychoice with length(SELF) == 3;
'/x' = "aaa";
7 changes: 6 additions & 1 deletion panc/src/test/pan/Functionality/choice/choice19.pan
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

object template choice19;

type mychoice = choice("aa", "bb", "aaa", "bbb");
type mychoice = choice(
"aa",
"bb",
"aaa",
"bbb",
);
bind '/x' = mychoice with length(SELF) == 3;
'/x' = "aa";
7 changes: 6 additions & 1 deletion panc/src/test/pan/Functionality/choice/choice20.pan
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

object template choice20;

type mychoice = choice("aa", "bb", "aaa", "bbb");
type mychoice = choice(
"aa",
"bb",
"aaa",
"bbb",
);
bind '/x' = mychoice with length(SELF) == 3;
'/x' = "ddd";
9 changes: 7 additions & 2 deletions panc/src/test/pan/Functionality/choice/choice21.pan
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

object template choice21;

type mychoice = choice("aa", "bb", "aaa", "bbb");
type mychoice = choice(
"aa",
"bb",
"aaa",
"bbb",
);
bind '/x' = mychoice(3);
'/x' = "aaa";
'/x' = "aaa";
9 changes: 7 additions & 2 deletions panc/src/test/pan/Functionality/choice/choice22.pan
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

object template choice22;

type mychoice = choice("aa", "bb", "aaa", "bbb");
type mychoice = choice(
"aa",
"bb",
"aaa",
"bbb",
);
bind '/x' = mychoice(3);
'/x' = "aa";
'/x' = "aa";