From ce5930b13b15a98e0c365003ef56cedc1c9cb6b3 Mon Sep 17 00:00:00 2001 From: Johan Paulsson Date: Tue, 26 Feb 2013 19:18:54 +0000 Subject: osx gui underlines the offending line on a parser error in document message --- tikzit/src/common/TikzGraphAssembler.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tikzit/src/common/TikzGraphAssembler.m') diff --git a/tikzit/src/common/TikzGraphAssembler.m b/tikzit/src/common/TikzGraphAssembler.m index b07ee58..1dc997a 100644 --- a/tikzit/src/common/TikzGraphAssembler.m +++ b/tikzit/src/common/TikzGraphAssembler.m @@ -46,8 +46,20 @@ void yyerror(const char *str) { NSLog(@"Parse error on line %i: %s\n%s\n%@\n", lineno, str, linebuff, [[@"" stringByPaddingToLength:(tokenpos-yyleng) withString: @" " startingAtIndex:0] stringByAppendingString:[@"" stringByPaddingToLength:yyleng withString: @"^" startingAtIndex:0]]); if (currentAssembler != nil) { NSError *error = [NSError errorWithDomain:@"net.sourceforge.tikzit" - code:TZ_ERR_PARSE - userInfo:[NSDictionary dictionaryWithObject:[NSString stringWithCString:str] forKey: NSLocalizedDescriptionKey]]; + code:TZ_ERR_PARSE + userInfo:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:[NSString stringWithCString:str encoding:NSUTF8StringEncoding], + [NSNumber numberWithInt:lineno], + [NSString stringWithCString:linebuff encoding:NSUTF8StringEncoding], + [NSNumber numberWithInt:tokenpos], + [NSNumber numberWithInt:yyleng], + nil] + forKeys: [NSArray arrayWithObjects:NSLocalizedDescriptionKey, + @"lineNumber", + @"syntaxString", + @"tokenStart", + @"tokenLength", + nil]]]; + [currentAssembler invalidateWithError:error]; } } -- cgit v1.2.3