From 9d925a30c73ee5856c83d3caab124f7dbeaa85a8 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Sun, 22 Apr 2012 02:58:26 -0700 Subject: SI-5702 Pattern parser halts on star In patterns, the parser halts when it sees stars. This means it does not handle infix notation for a case class named "*". This patch uses lookahead to decide whether to parse '_' '*' as a sequence pattern or as the start of infix. (For both normal and error cases, the tokens are always consumed immediately.) Error messages are improved for _* (as a help to learners) and slightly improved recovery helps the parse continue. The entry point for XML patterns is now distinct; otherwise, the change is local to pattern3-simplepattern; the entry point for simplepattern() is unchanged because it is commented "hook for IDE." --- test/files/neg/t5702-neg-bad-xbrace.check | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/files/neg/t5702-neg-bad-xbrace.check (limited to 'test/files/neg/t5702-neg-bad-xbrace.check') diff --git a/test/files/neg/t5702-neg-bad-xbrace.check b/test/files/neg/t5702-neg-bad-xbrace.check new file mode 100644 index 0000000000..d88638aee9 --- /dev/null +++ b/test/files/neg/t5702-neg-bad-xbrace.check @@ -0,0 +1,7 @@ +t5702-neg-bad-xbrace.scala:19: error: bad brace or paren after _* + case {_*)} => y + ^ +t5702-neg-bad-xbrace.scala:28: error: bad brace or paren after _* + val {a, z@_*)} = xml + ^ +two errors found -- cgit v1.2.3