I'm trying to make a rule in yacc that recognizes comments. For this, I have defined one token for the comments of only 1 line an another one for the multi line ones; in the lex file:
comentario [//]([^"])* [\n]
comentarioMulti [/*]([^"])*[*/]
And also a rule for it in the yacc file :
comentario: COMENTARIO
COMENTARIMULTILINEA
;
But it gives me this error:
syntax error en la línea 26
COMENTARIO MacBook-Air-de-administrador:Sintactico administrador$
I have also tried by putting the \n
without the []
and some other options, but I get the same error every time.