Amr Rady
Amr Rady

Reputation: 1197

How to comment a grammar rule in yacc and a regex matching rule in lex?

I want to comment this matching rule in lex. I don't want to delete it. I just want it commented so anyone sees the lex file later be informed that this part has been commented

<tickPragma_name_1>. {
    myyyless(0);
    BEGIN (0);
}

how I can do that? I know that I can comment the C code inside the {} .but I want to comment the whole rule.

Upvotes: 0

Views: 225

Answers (1)

rici
rici

Reputation: 241671

You can surround the rule with /* and */, just as in C, but with two major caveats:

  1. Everything needs to be indented by at least one space, including the /* (and, I believe, the contents).

  2. There cannot be any nested comments in the action.

Upvotes: 2

Related Questions