Ticket #334: comma-sep-intrnl-error.patch
File comma-sep-intrnl-error.patch, 1.9 KB (added by hopscc, 12 years ago) |
---|
-
Source/CobraParser.cobra
3210 3210 while true 3211 3211 if isSpaceAgnostic 3212 3212 _spaceAgnostic 3213 if .peek is nil 3214 literal = {'RPAREN': ')', 'RBRACKET': ']'} 3215 what = (for t in terminators.split(c'.') where t.trim<>'' get '"[if(literal.containsKey(t), literal[t], t)]"').join(' or ') 3216 .throwError('Expecting "," or [what].') 3217 if .peek.which.isOneOf(terminators) 3213 if _peekCommaSep(terminators) 3218 3214 .grab 3219 3215 break 3220 3216 if expectSep 3221 3217 .expect(sep) 3222 if .peek.which.isOneOf(terminators)3218 if _peekCommaSep(terminators) 3223 3219 .grab 3224 3220 break 3225 3221 if isSpaceAgnostic 3226 3222 _spaceAgnostic 3227 if .peek.which.isOneOf(terminators)3223 if _peekCommaSep(terminators) 3228 3224 .grab 3229 3225 break 3230 3226 .newOpStack … … 3237 3233 .delOpStack 3238 3234 expectSep = true 3239 3235 return exprs 3240 3236 3237 def _peekCommaSep(terminators as String) as bool 3238 p = .peek 3239 if p is nil 3240 literal = {'RPAREN': ')', 'RBRACKET': ']'} 3241 what = (for t in terminators.split(c'.') where t.trim<>'' get '"[if(literal.containsKey(t), literal[t], t)]"').join(' or ') 3242 .throwError('Unexpected end of comma separated expressions - Expecting "," or [what].') 3243 return p.which.isOneOf(terminators) 3244 3241 3245 def doExpr as AnonymousExpr 3242 3246 """ 3243 3247 Example: -
Tests/820-errors/200-expressions/710-unexpected-end.cobra
1 # .error. end of comma separated expressions 2 class Program 3 4 def main 5 variable as int 6 streamReader = StreamReader("Something.txt") 7 streamReader.getType(variable,