b3 icon indicating copy to clipboard operation
b3 copied to clipboard

parsing error on complete instruction

Open p8nut opened this issue 4 years ago • 1 comments

when b3 try to parse this instruction i get this error

arch_prctl(0x3001 /* ARCH_??? */, 0x7ffe4887f480) = -1 EINVAL (Invalid argument)
[PARSE ERROR] SyntaxError: Expected [0-9] but "A" found.

the full command here

strace -f ./a.out |& b3  -s
{"syscall":"execve","args":["./a.out",["./a.out"],140724292233112,"..."],"result":0,"timing":null,"pid":null,"type":"SYSCALL"}
{"syscall":"brk","args":[],"result":32165888,"timing":null,"pid":null,"type":"SYSCALL"}
[PARSE ERROR] SyntaxError: Expected [0-9] but "A" found.

it seem odd, because the instruction look complete (maybe the comment in the first parameter is the reason).

p8nut avatar Apr 30 '20 10:04 p8nut

i'm no expert un peg but it seem that this could do the job

_ = space comment { return undefined }
space = [ \t\n\r]* 

comment = space p:(single / multi)*
single = '//' p:([^\n]*) {return p.join('')}
multi = "/*" inner:(!"*/" i:. {return i})* "*/" {return inner.join('')}

thanks to: https://stackoverflow.com/questions/26556586/peg-js-how-to-parse-c-style-comments

p8nut avatar Apr 30 '20 11:04 p8nut