| 
									
										
										
										
											2009-04-09 05:50:38 -04:00
										 |  |  | ! Copyright (C) 2009 Slava Pestov. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  | USING: assocs debugger io kernel sequences source-files.errors | 
					
						
							| 
									
										
										
										
											2009-04-18 04:21:31 -04:00
										 |  |  | summary accessors continuations make math.parser io.styles namespaces | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | compiler.errors prettyprint ;
 | 
					
						
							| 
									
										
										
										
											2009-04-09 05:50:38 -04:00
										 |  |  | IN: tools.errors | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #! Tools for source-files.errors. Used by tools.tests and others | 
					
						
							|  |  |  | #! for error reporting | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | M: source-file-error compute-restarts error>> compute-restarts ;
 | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | M: source-file-error error-help error>> error-help ;
 | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-22 11:46:50 -04:00
										 |  |  | CONSTANT: +listener-input+ "<Listener input>" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-04 22:01:21 -04:00
										 |  |  | : error-location ( error -- string )
 | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  |     [ | 
					
						
							| 
									
										
										
										
											2009-08-04 22:01:21 -04:00
										 |  |  |         [ file>> [ % ] [ +listener-input+ % ] if* ] | 
					
						
							|  |  |  |         [ line#>> [ ": " % # ] when* ] bi
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  |     ] "" make ;
 | 
					
						
							| 
									
										
										
										
											2009-04-17 16:50:11 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-04 22:01:21 -04:00
										 |  |  | M: source-file-error summary error>> summary ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-17 16:50:11 -04:00
										 |  |  | M: source-file-error error. | 
					
						
							| 
									
										
										
										
											2009-08-04 22:01:21 -04:00
										 |  |  |     [ error-location print nl ] | 
					
						
							| 
									
										
										
										
											2009-04-23 23:36:34 -04:00
										 |  |  |     [ asset>> [ "Asset: " write short. nl ] when* ] | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  |     [ error>> error. ] | 
					
						
							|  |  |  |     tri ;
 | 
					
						
							| 
									
										
										
										
											2009-04-15 01:27:02 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-09 05:50:38 -04:00
										 |  |  | : errors. ( errors -- )
 | 
					
						
							|  |  |  |     group-by-source-file sort-errors | 
					
						
							|  |  |  |     [ | 
					
						
							| 
									
										
										
										
											2009-04-22 11:46:50 -04:00
										 |  |  |         [ nl "==== " write +listener-input+ or print nl ] | 
					
						
							| 
									
										
										
										
											2009-04-09 05:50:38 -04:00
										 |  |  |         [ [ nl ] [ error. ] interleave ] | 
					
						
							|  |  |  |         bi*
 | 
					
						
							|  |  |  |     ] assoc-each ;
 | 
					
						
							| 
									
										
										
										
											2009-04-18 04:21:31 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | : :errors ( -- ) compiler-errors get values errors. ;
 | 
					
						
							| 
									
										
										
										
											2009-04-18 04:21:31 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-04-23 23:17:25 -04:00
										 |  |  | : :linkage ( -- ) linkage-errors get values errors. ;
 | 
					
						
							| 
									
										
										
										
											2009-04-20 23:05:41 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | M: not-compiled summary | 
					
						
							|  |  |  |     word>> name>> "The word " " cannot be executed because it failed to compile" surround ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: not-compiled error. | 
					
						
							|  |  |  |     [ summary print nl ] [ error>> error. ] bi ;
 |