Ticket #218: bad-docString.patch
File bad-docString.patch, 3.5 KB (added by hopscc, 14 years ago) |
---|
-
Source/CobraParser.cobra
2049 2065 s.afterParserRecognizesStatement 2050 2066 if .optional('COMMA') 2051 2067 s = .multiTargetAssign(s to Expr) 2052 if expectEOL 2053 if .verbosity>=5 2054 print '<> last statement start token=[token]' 2055 print '<> s = [s]' 2056 try 2057 .expect('EOL') 2058 catch pe as ParserException 2059 # example: puts 5 2060 token = .last(1) 2061 if token <> nil 2062 sugg = if(token.text.length, Compiler.suggestionFor(token.text), nil) 2063 sugg = if(sugg, ' Try "[sugg]" instead of "[token.text]".', nil) 2064 if sugg, pe = pe.cloneWithMessage(pe.message + sugg) 2065 throw pe 2068 if expectEOL, _handleStmtEOL(token, s) 2066 2069 _finishSpaceAgnostic 2067 2070 return s 2068 2069 2071 2072 def _handleStmtEOL(token as IToken?, s as Stmt?) 2073 if .verbosity>=5 2074 print '<> last statement start token=[token]' 2075 print '<> s = [s]' 2076 try 2077 .expect('EOL') 2078 catch pe as ParserException 2079 # example: puts 5 2080 token = .last(1) 2081 if token <> nil 2082 print token, .last 2083 sugg = if(token.text.length, Compiler.suggestionFor(token.text), nil) 2084 sugg = if(sugg, ' Try "[sugg]" instead of "[token.text]".', nil) 2085 if sugg == nil and .last.which == 'DOUBLE_QUOTE' and token.which =='STRING_DOUBLE' 2086 l2 = 'A docString needs to be either entirely on a single line or have its start and end triple quotes alone on a separate line before and after the docString text.' 2087 sugg = '\nThis looks like the start of a docString but it wasnt recognised.\n[l2]' 2088 if sugg, pe = pe.cloneWithMessage(pe.message + sugg) 2089 throw pe 2090 2070 2091 ## 2071 2092 ## Individual Statements 2072 2093 ## -
Tests/820-errors/100-lexing-and-parsing/404-doc-string.cobra
1 # .error. This looks like the start of a docString but it wasnt recognised. 2 # on line 9 3 class Program 4 5 def main 6 pass 7 8 def m1 # below docstring is invalid, need leading/trailing delim alone on own lines 9 """ This docString causes 10 indigestion. """ 11 pass -
Tests/820-errors/100-lexing-and-parsing/406-doc-string.cobra
1 class Program 2 3 def main 4 pass 5 6 def m1 # below docstring is invalid, need leading/trailing delim alone on own lines 7 """ 8 This one also causes 9 it indigestion. """ 10 pass 11 # .error. Expecting more doc string contents or the end of the doc string instead of "DEDENT". -
Developer/IntermediateReleaseNotes.text
475 475 * Fixed: Dynamic binding cannot find `shared` methods. ticket:208 476 476 477 477 * Fixed: File and line number are duplicated in some compiler error messages. ticket:212 478 479 * Fixed: Better error message for unrecognised docString : ticket:218