-
Notifications
You must be signed in to change notification settings - Fork 156
Style Guide
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.
- Introduction
- ... Motivation
- ... Features
- ... Simple Java Example
- ... Simple Scala Example
- ... RegEx vs. parboiled vs. Parser Generators
- ... Projects using parboiled
- Installation
- Concepts
- ... The Big Picture
- ... The Rule Tree
- ... The Value Stack
- ... The Parse Tree
- ... AST Construction
- ... Parse Error Handling
- parboiled for Java
- ... Rule Construction in Java
- ... Parser Action Expressions
- ... Working with the Value Stack
- ... Action Variables
- ... Parser Extension in Detail
- ... Style Guide
- ... Java Examples
- ...... ABC Grammar
- ...... Calculators
- ...... Time Parser
- ...... Java Parser
- ...... Markdown processor
- parboiled for Scala
- ... Rule Construction in Scala
- ... Parser Actions in Scala
- ... Parser Testing in Scala
- ... Scala Examples
- ...... Simple Calculator
- ...... JSON Parser
- Advanced Topics
- ... Handling Whitespace
- ... Parsing Performance Tuning
- ... Indentation Based Grammars
- ... The ProfilingParseRunner
- ... Grammar and Parser Debugging
- ... Thread Safety
- Building parboiled
- parboiled-core Javadoc API
- parboiled-java Javadoc API
- parboiled-scala Scaladoc API
- Change Log
- Patch Policy