Enki - Comments

(Back to Syntax Guide)

There are several ways that you can place comments in your custom grammar.

'Pound Comments'

The typical comment form is to prefix any line with a '#' symbol. The entire line will be treated as a comment and will pass to the generated output as an embedded D comment.

#This is a comment

The only drawback to this comment type is that it is not allowed within a given Rule Definition. This was done to prevent any confusion between these kinds of comments and the Range Operator.

'C Comments'

Both the slash-star (/*...*/) and slash-slash (//) comment forms are allowed anywhere in the grammar file, including within Rule definitions.

MyRule // this is my rule
  ::= "foo" /* We parse foo before Bar */ "bar";

Comments that appear before and after Rules and Directives will be passed to the generated parser. All other comments will be ignored and will not appear in the generated parser.