Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: docs/language/bnf.sty

Issue 2705323003: Add bnf.sty to github, since it is referenced by the latex language spec file. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: docs/language/bnf.sty
diff --git a/docs/language/bnf.sty b/docs/language/bnf.sty
new file mode 100644
index 0000000000000000000000000000000000000000..9d01563fc2d6004134ee6229a1a9f834156ce0a9
--- /dev/null
+++ b/docs/language/bnf.sty
@@ -0,0 +1,125 @@
+%This _sty_ file was developed by Hugh Osborne at the University of
+%Nijmegen, The Netherlands. It may be freely distributed under
+%condition that this notice is always included in any copy distributed.
+%No charge may be made for (copies of) this file, nor may any other
+%remuneration be requested.
+
+\typeout{Style-Option: `bnf' v1.1a <92/01/30> (Hugh Osborne/br)}
+
+\def\@actifygrammarchars{%
+ \catcode`\"\active%
+ \catcode`\:\active%
+ \catcode`\,\active%
+ \catcode`\;\active%
+ \catcode`\.\active%
+ \catcode`\<\active%
+ \catcode`\>\active}
+
+\def\@deactifygrammarchars{%
+ \@makeother\"%
+ \@makeother\:%
+ \@makeother\,%
+ \@makeother\;%
+ \@makeother\.%
+ \@makeother\<%
+ \@makeother\>}
+
+\let\escapegrammar=\@deactifygrammarchars
+
+\begingroup
+ \@deactifygrammarchars
+ \global\let\quotesymbol="
+ \global\let\lessthan=<
+ \global\let\greaterthan=>
+\endgroup
+
+\newif\if@outsidestring \@outsidestringtrue
+
+\def\@first#1#2{#1}
+\def\@second#1#2{#2}
+
+\begingroup
+
+\@actifygrammarchars
+
+ \gdef\@defcolon#1{
+ \catcode`\:\active
+ \def:{\def\newline{\hfill\break\hspace*{2em}}{\@deactifygrammarchars #1}}
+ \@makeother\:}
+
+ \gdef\@defcomma#1{
+ \catcode`\,\active
+ \def,{\def\newline{\hfill\break\hspace*{4em}}{\@deactifygrammarchars #1}}
+ \@makeother\,}
+
+ \gdef\@defsemicolon#1{
+ \catcode`\;\active
+ \def;{\def\newline{\hfill\break\hspace*{2em}}{\@deactifygrammarchars #1}}
+ \@makeother\;}
+
+ \gdef\@defperiod#1{
+ \catcode`\.\active
+ \def.{\def\newline{\vskip10pt plus10pt minus5pt}{\@deactifygrammarchars #1}}
+ \@makeother\.}
+
+ \gdef\@defnonterminal#1{
+ \catcode`\<\active
+ \catcode`\>\active
+ \def<{%
+ \begingroup%
+ \@first#1%
+ \@deactifygrammarchars%
+ \catcode`\>\active}
+ \def>{%
+ \@second#1%
+ \endgroup}
+ \@makeother\<
+ \@makeother\>}
+
+ \gdef\@defquote#1{
+ \catcode`\"\active
+ \def"{%
+ \if@outsidestring%
+ \@outsidestringfalse%
+ \begingroup%
+ \@deactifygrammarchars%
+ \catcode`\"\active%
+ \@first#1%
+ \else%
+ \@second#1%
+ \endgroup%
+ \@outsidestringtrue%
+ \fi}
+ \@makeother\"}
+
+\endgroup
+
+\let\@defterminal=\@defquote
+
+\newenvironment{grammar}%
+ {
+ \begin{quote}%
+ \@defaultchardefs%
+ \@dogrammarchars}%
+ {\@deactifygrammarchars%
+ \end{quote}
+ }
+
+\def\@dogrammarchars{
+ \@actifygrammarchars
+ \@ifnextchar [{\@deactifygrammarchars\@getchardef}{}}
+
+\def\@getchardef[(#1)#2]{
+ \@dogrammarchar{#1}[#2]
+ \@dogrammarchars}
+
+\def\@dogrammarchar#1[#2]{
+ \csname @def#1\endcsname{#2}}
+
+\def\@defaultchardefs{
+ \@defquote{{``}{''}}%
+ \@defnonterminal{{$<$}{$>$}}%
+ \@defcolon{:\\ {\hbox{ }} }%
+ \@defsemicolon{ $|$\\{\hbox{ }}}%
+ \@defperiod{\\{\hbox{ }};\\ }%
+ \@defcomma{, }}%
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698