0

Just starting to write my first lexer and i've come across this:

RPAREN options { paraphrase = ")"; } : ")";

I'd like to know what paraphrase actually does, does it mean that in this case RPAREN can also be used as simply ) in the parser?

thanks!

EDIT - just found this online

We can use paraphrases in Rules to make error messages user-friendly

is this correct?

user2058186
  • 287
  • 2
  • 13

1 Answers1

2

paraphrase is not a valid option in ANTLR 3 or ANTLR 4. Including it would either produce a warning or error, and it would not have any impact on behavior.

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
  • thanks for the reply, my friend next to me has copied rules from somewhere online and his lexer and parser work perfectly, is it effectively bypassing it and doing nothing? – user2058186 Mar 21 '14 at 18:37
  • 1
    It may have been part of ANTLR 2 (which is long before I became involved in the project), or part of a fork of the project which implemented its own options independently from the main ANTLR project. – Sam Harwell Mar 21 '14 at 18:39
  • thanks alot for the replies, I'll write my code without them :) – user2058186 Mar 21 '14 at 18:41