parsing error on complete instruction
p8nut opened this issue · 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).
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