Ciao ragazzi,
ho inizato a scrivere il codice per fare il parsing di un file come quello di seguito
dal quale devo prendere solo per le righe marcate in grassetto il primo elmento (campo 200x)codice:00002000 <_start>: _start: /* Init floating point instructions. */ /* calculate address of _Lconst_table */ bl _Lref1 /* get current address */ 2000: 48 00 00 05 bl 2004 <_Lref1> 00002004 <_Lref1>: _Lref1: mflr r4 /* r4=address of _Lref1 */ 2004: 7c 88 02 a6 mflr r4 lwz r5,(_Lref2-_Lref1)(r4) /* r5=offset to first constan */ 2008: 80 a4 00 94 lwz r5,148(r4) add r5,r5,r4 /* r5=address of first consrant */ 200c: 7c a5 22 14 add r5,r5,r4
il sesto (campo, add, lwz ecc.) e i campi ri, ad esempio r5, r4, ecc...
Ho iniziato con qualcosa del genere:
Row è un oggetto in cui vorrei collezionare i sudetti campi.codice:while((currentRecord = br.readLine()) != null){ String[] tokens = currentRecord.split("(\\s+)"); if(tokens.length != 0){ Row row = new Row(); row.setPcaddress(tokens[0]); row.setInstruction(tokens[6]); for( int i = 0; i<tokens.length; i++){ System.out.println(i + " "+tokens[i]); }
Ovviamente il codice non funziona, corretamente. Avete qualche idea da suggerirmi per
risolvere questo problema? Grazie

Rispondi quotando