diff --git a/CiLexer.cs b/CiLexer.cs index 9bf1021d..b58e4618 100644 --- a/CiLexer.cs +++ b/CiLexer.cs @@ -570,9 +570,10 @@ CiToken ReadPreToken() case '"': return ReadString(false); case '$': - if (ReadChar() != '"') - throw ParseException("Expected interpolated string"); - return ReadString(true); + if (EatChar('"')) + return ReadString(true); + ReportError("Expected interpolated string"); + continue; case '0': switch (PeekChar()) { case 'B': diff --git a/test/error/LexInvalidDollar.ci b/test/error/LexInvalidDollar.ci index 7aecea52..be6061e3 100644 --- a/test/error/LexInvalidDollar.ci +++ b/test/error/LexInvalidDollar.ci @@ -1 +1,7 @@ -$foo //ERROR: Expected interpolated string +$public static class Test //ERROR: Expected interpolated string +{ + public static bool Run() + { + return true; + } +}