parser: print backtrace only in debug mode
							parent
							
								
									0a6840b6a6
								
							
						
					
					
						commit
						f8d14a216b
					
				|  | @ -27,8 +27,6 @@ fn (p mut Parser) warn(s string) { | |||
| 	p.warn_with_token_index(s, p.token_idx-1 ) | ||||
| } | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| fn (p mut Parser) production_error_with_token_index(e string, tokenindex int) { | ||||
| 	if p.pref.is_prod { | ||||
| 		p.error_with_token_index( e, tokenindex ) | ||||
|  | @ -37,8 +35,6 @@ fn (p mut Parser) production_error_with_token_index(e string, tokenindex int) { | |||
| 	} | ||||
| } | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| fn (p mut Parser) error_with_token_index(s string, tokenindex int) { | ||||
| 	p.error_with_position(s, p.scanner.get_scanner_pos_of_token( p.tokens[ tokenindex ] ) ) | ||||
| } | ||||
|  | @ -47,8 +43,6 @@ fn (p mut Parser) warn_with_token_index(s string, tokenindex int) { | |||
| 	p.warn_with_position(s, p.scanner.get_scanner_pos_of_token( p.tokens[ tokenindex ] ) ) | ||||
| } | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| fn (p mut Parser) error_with_position(s string, sp ScannerPos) { | ||||
| 	p.print_error_context() | ||||
| 	e := normalized_error( s ) | ||||
|  | @ -65,8 +59,6 @@ fn (p mut Parser) warn_with_position(s string, sp ScannerPos) { | |||
| 	p.scanner.goto_scanner_position( cpos ) | ||||
| } | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| fn (s &Scanner) error(msg string) { | ||||
| 	s.error_with_col(msg, 0) | ||||
| } | ||||
|  | @ -75,7 +67,6 @@ fn (s &Scanner) warn(msg string) { | |||
| 	s.warn_with_col(msg, 0) | ||||
| } | ||||
| 
 | ||||
| //////////////////////////////////////////////////////////////////////////////////////////////////
 | ||||
| fn (s &Scanner) warn_with_col(msg string, col int) { | ||||
| 	fullpath := s.get_error_filepath()		 | ||||
| 	color_on := s.is_color_output_on() | ||||
|  |  | |||
|  | @ -717,7 +717,9 @@ fn (p mut Parser) check(expected TokenKind) { | |||
| 		s := 'expected `${expected.str()}` but got `${p.strtok()}`' | ||||
| 		p.next() | ||||
| 		println('next token = `${p.strtok()}`') | ||||
| 		print_backtrace() | ||||
| 		if p.pref.is_debug { | ||||
| 			print_backtrace() | ||||
| 		} | ||||
| 		p.error(s) | ||||
| 	} | ||||
| 	/* | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue