private static String addLineNumber ( String code ) { String [ ] lines = code . split ( "\n" ) ; StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < lines . length ; i ++ ) { builder . append ( "/* " ) . append ( i + 1 ) . append ( " */" ) . append ( lines [ i ] ) . append ( "\n" ) ; } return builder . toString ( ) ; }
To output more information when an error occurs . Generally when cook fails it shows which line is wrong . This line number starts at 1 .