Building Parsers with Java

sjm.examples.pretty
Class ShowPrettyAlternations

java.lang.Object
  |
  +--sjm.examples.pretty.ShowPrettyAlternations

public class ShowPrettyAlternations
extends java.lang.Object

Show how the pretty printer displays a deep match of alternations. The grammar this class shows is:

 
     reptile     = crocodilian | squamata;
     crocodilian = crocodile | alligator;
     squamata    = snake | lizard;
     crocodile   = "nileCroc" | "cubanCroc";
     alligator   = "chineseGator" | "americanGator";
     snake       = "cobra" | "python";
     lizard      = "gecko" | "iguana";
 


Constructor Summary
ShowPrettyAlternations()
           
 
Method Summary
static Parser alligator()
          Returns a parser that recognizes some alligators.
static Parser crocodile()
          Returns a parser that recognizes some crocs.
static Parser crocodilian()
          Returns a parser that recognizes members of the crocodilian order.
static Parser lizard()
          Returns a parser that recognizes some lizards.
static void main(java.lang.String[] args)
          Show how a series of alternations appear when pretty- printed.
static Parser reptile()
          Returns a parser that recognizes some reptiles.
static Parser snake()
          Returns a parser that recognizes some snakes.
static Parser squamata()
          Returns a parser that recognizes some members of the squamata order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShowPrettyAlternations

public ShowPrettyAlternations()
Method Detail

alligator

public static Parser alligator()
Returns a parser that recognizes some alligators.

crocodile

public static Parser crocodile()
Returns a parser that recognizes some crocs.

crocodilian

public static Parser crocodilian()
Returns a parser that recognizes members of the crocodilian order.

lizard

public static Parser lizard()
Returns a parser that recognizes some lizards.

main

public static void main(java.lang.String[] args)
Show how a series of alternations appear when pretty- printed.

reptile

public static Parser reptile()
Returns a parser that recognizes some reptiles.

snake

public static Parser snake()
Returns a parser that recognizes some snakes.

squamata

public static Parser squamata()
Returns a parser that recognizes some members of the squamata order.

by Steve Metsker