Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Style Guide

Mathias edited this page · 5 revisions
Clone this wiki locally

Especially for larger parser projects implemented with parboiled for Java it makes sense to adhere to a few code style conventions so as to increase readability and therefore maintainability.
parboiled adheres to the commonly accepted Java naming conventions except for two occasions. Parser methods returning Rule instances that are subject to parboiled for Java parser extension logic are unlike “normal” Java methods. They are rewritten to include automatic labeling, caching, proxy object creation, action expression wrapping, and so on. In order to visually separate such Rule creation methods from all other (action) methods parboiled names for these methods begin with an uppercase letter. This also matches the common grammar notations (PEGs or the (E)BNFs for CFGs) that commonly use capitalized rule/production names. Since your IDE normally provides for intelligent syntax highlighting there should be little confusion with other identifiers beginning with an uppercase character like classes or interfaces.

The special method ACTION defined in the BaseParser class has an all-cap names since it’s completely different from regular Java methods. It does not execute any code but merely serve as a marker for parboiled parser extension logic.

Something went wrong with that request. Please try again.