%\filename{SynChart-test.tex}
%\edited{by stolfi on Fri Oct 10 00:30:11 1986}

% simple tests of SynChart.tex

\input showboxdims
\input SynChart

\def\showit#1{\showboxdims{\hbox{\ignorespaces #1}}}

\font\NonTerminalFont=amti10 \relax
\font\TerminalFont=amtt10 \relax
\font\KeywordFont=ambx10 \relax

\SyntaxChart

\parindent 0pt
\parskip 10pt
\hsize=7truein
\hoffset=-0.5truein
\DontIgnoreWhiteSpace

Dimensions: Wid = \the\Wid{} Unit = \the\Unit{} 
  ArrowLength = \the\ArrowLength

\def\one{\Keyword{ONE}}
\def\two{\Keyword{TWO}}
\def\three{\Keyword{THREE}}

Arrow Tips:\par
  \showit{\ARRF >}
  \showit{\ARRF <}
  \showit{\BARRF >}
  \showit{\BARRF <}

  \showit{\ARRF \char'024}
  \showit{\BARRF \char'024}
  \showit{\ARRF \char'014}
  \showit{\BARRF \char'014}
  \par

Quarter Circles: \par
    \showboxdims{\I} \showboxdims{\II} 
    \showboxdims{\III} \showboxdims{\IV}

  {\BigCircles
    \showboxdims{\I} \showboxdims{\II}
    \showboxdims{\III} \showboxdims{\IV}
  }

Round box caps:\par
    \showboxdims{\LeftRound}
    \showboxdims{\RightRound}
  {\BigCircles
    \showboxdims{\LeftRound}
    \showboxdims{\RightRound}
  }

Arrows:\par
  \showit{\LeftGoingArrow}
  \showit{\RightGoingArrow}
  \showit{\BigLeftGoingArrow}
  \showit{\BigRightGoingArrow}
  
  \showit{\DownGoingArrow}

\vfill\eject

Symbol box stems:\par
  \showit{\InputLeftArrow}
  \showit{\OutputLeftArrow}

Terminals:\par
      \showit{\Sandwich{\kern -0.5\Unit\TerminalFont >\kern-0.5\Unit}}
      \showit{\LeftRound
        \Sandwich{\kern -0.5\Unit\TerminalFont >\kern-0.5\Unit}\RightRound
      }

      \showit{\Terminal{+\OpStrut}}
      \showit{\Terminal{.\OpStrut}} 

  {\BigCircles
      \showit{\Sandwich{\kern -0.5\Unit\TerminalFont >\kern-0.5\Unit}}
      \showit{\LeftRound
        \Sandwich{\kern -0.5\Unit\TerminalFont >\kern-0.5\Unit}\RightRound
      }

      \showit{\Terminal{+\OpStrut}}
      \showit{\Terminal{.\OpStrut}} 
      \showit{\Terminal{-->\OpStrut}}
  }
  
  \leavevmode
  \hbox{\Terminal{+\OpStrut}}
  \hbox{\Terminal{E}}
  \hbox{\Terminal{'\OpStrut}}\par

NonTerminals:\par
  \showit{\NonTerminal{Beginning}}
  {\BigCircles \showit{\NonTerminal{Beginning}}}

Keywords:\par
    \showit{\Keyword{Begin}}
    \showit{\Sandwich{\kern-0.25\Unit\KeywordFont Bg\kern-0.25\Unit}}
  
  {\BigCircles
    \showit{\Keyword{Begin}}
    \showit{\Sandwich{\kern-0.25\Unit\KeywordFont Bg\kern-0.25\Unit}}
  }

\vfill\eject

Alternatives: \par
  \showit{\Alternatives{\Upper{\Terminal{+}}}}
  \showit{\Alternatives{\Lower{\Terminal{+}}}}
  \showit{\Alternatives{\Middle{\Terminal{+}}}}

  \showit{\Alternatives{\Upper{\Terminal{+}}\Upper{\Terminal{-}}}}
  \showit{\Alternatives{\Upper{\Terminal{+}}\Middle{\Terminal{-}}}}
  \showit{\Alternatives{\Upper{\Terminal{+}}\Lower{\Terminal{-}}}}

  \showit{\Alternatives{\Middle{\Terminal{+}}\Lower{\Terminal{-}}}}
  \showit{\Alternatives{\Lower{\Terminal{+}}\Lower{\Terminal{-}}}}
  \showit{\Alternatives{
      \Upper{\Terminal{+}}
      \Middle{\Terminal{-\OpStrut}}
      \Lower{\Terminal{-}}
    }}

  \showit{\Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Middle{\Empty}
      \Lower{\Terminal{-}}
    }}
  \showit{\AltSpacing=1
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Middle{\Empty}
      \Lower{\Terminal{-}}
    }}
  \showit{\AltSpacing=3
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Middle{\Empty}
      \Lower{\Terminal{-}}
    }}

  \showit{
    \Alternatives{
      \Upper{\Empty}
      \Upper{\Empty}
      \Middle{\Arrow}
      \Lower{\Empty}
      \Lower{\Empty}
    }}
  \showit{\AltSpacing=1
    \Alternatives{
      \Upper{\Empty}
      \Upper{\Empty}
      \Middle{\Arrow}
      \Lower{\Empty}
      \Lower{\Empty}
    }}
  \showit{\AltSpacing=3
    \Alternatives{
      \Upper{\Empty}
      \Upper{\Empty}
      \Middle{\Arrow}
      \Lower{\Empty}
      \Lower{\Empty}
    }}

\vfill\eject

More alternatives: \par
  \showit{
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Middle{\Arrow}
      \Lower{\Terminal{-}}
    }}
  \showit{\AltSpacing=1
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Middle{\Arrow}
      \Lower{\Terminal{-}}
    }}
  \showit{\AltSpacing=3
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Middle{\Arrow}
      \Lower{\Terminal{-}}
    }}

  \showit{
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Lower{\Terminal{-}}
      \Lower{\Terminal{(}}
    }}
  \showit{\AltSpacing=1
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Lower{\Terminal{-}}
      \Lower{\Terminal{(}}
    }}
  \showit{\AltSpacing=3
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Lower{\Terminal{-}}
      \Lower{\Terminal{(}}
    }}

  \showit{
    \BigCircles
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Lower{\Terminal{-}}
      \Lower{\Terminal{(}}
    }}
  \showit{\AltSpacing=1
    \BigCircles
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Lower{\Terminal{-}}
      \Lower{\Terminal{(}}
    }}
  \showit{\AltSpacing=3
    \BigCircles
    \Alternatives{
      \Upper{\Terminal{+}}
      \Upper{\Terminal{?}}
      \Lower{\Terminal{-}}
      \Lower{\Terminal{(}}
    }}

\IgnoreWhiteSpace

\Define{Foo}
    \Fil
    \Terminal{Baz}
    \Fil\Fil
\EndDef

\Define{Foo Bar}
  \Fil
  \Terminal{Bar}
  \NonTerminal{Baz}
  \Fil\Fil
\EndDef

\Define{Foo Bar}
  \Fil
  \Terminal{Bar}
  \NewLine
  \NonTerminal{Baz}
  \Fil\Fil
\EndDef

\Define{Two}
  \Fil
  \Alternatives{\Upper{\Terminal{Foo}}\Lower{\Terminal{Baz}}}
  \Fil
\EndDef

\Define{Many}
  \Fil
  \Alternatives{
    \Upper{
      \Fil
      \Alternatives{\Upper{\Terminal{Foo}}\Lower{\Terminal{Baz}}}
      \Fil
    }
    \Middle{\Terminal{Hep}}
    \Lower{\Terminal{Boo}}
    \Lower{\Terminal{Phew}}
  }
  \Fil
\EndDef

\Define{Horz\ Many}
  \Fil
  \HorzAlternatives{
    \Alternative{\Terminal{Foo}}
    \Alternative{\Terminal{Baz}}
    \Alternative{\Terminal{Gnek}}
  }
  \Fil
\EndDef

\Define{Too\ Many}
  \Fil
  \Repeat{
    \Upper{\Terminal{,}}
    \Upper{\Terminal{\$}}
    \Upper{\Terminal{?}}
    \Middle{\Empty}
  }
  \Fil
\EndDef

\Define{Test 1}
  \one
  \two
  \three
\EndDef

\Define{Test 2}
  \Fil
  \one
  \two
  \three
\EndDef

\Define{Test 3}
  \one
  \two
  \three
  \Fil
\EndDef

\Define{Test 4}
  \Fil
  \one
  \two
  \three
  \Fil
\EndDef

\Define{Test 5}
  \one
  \two
  \NewLine
  \three
  \two
  \one
\EndDef

\Define{Test 6}
  \one
  \two
  \three
  \NewLine
  \two
  \three
  \NewLine
  \two
  \three
  \NewLine
  \Fil
  \one
\EndDef

\Define{Test 7}
  \one
  \two
  \OptionalLines{
    \Line{\three\two\one}
    \Line{\Alternatives{\Upper{\one}\Lower{\two\three}}}
  }
  \two
  \three
  \Repeat{\Upper{\two}\Middle{}}
  \one
  \NewLine
  \one\one\one\Alternatives{\Upper{\one}\Middle{\two}\Lower{\three}}
  \two\two\two
  \Fil
\EndDef

{\MinLineWidth=\hsize \advance\MinLineWidth by -4\Unit

  \Define{Test 8}
    \one
    \two
    \three
    \NewLine
    \two
    \three
    \NewLine
    \two
    \three
    \NewLine
    \Fil
    \one
  \EndDef

  \Define{Test 9}
    \one
    \two
    \OptionalLines{
      \Line{\three\two\one}
      \Line{\Alternatives{\Upper{\one}\Lower{\two\three}}}
    }
    \two
    \three
    \Repeat{\Upper{\two}\Middle{}}
    \one
    \NewLine
    \one\one\one\Alternatives{\Upper{\one}\Middle{\two}\Lower{\three}}
    \two\two\two
    \Fil
  \EndDef

}

\vfill\bye

