From 3dd3ead1516df85ad02e729c301e87ab1926ffb0 Mon Sep 17 00:00:00 2001 From: simonm Date: Mon, 15 Dec 1997 11:14:48 +0000 Subject: [PATCH] [project @ 1997-12-15 11:14:46 by simonm] Add verbatim for SGML. --- glafp-utils/sgmlverb/Makefile | 15 ++++++++++ glafp-utils/sgmlverb/sgmlverb.lex | 60 +++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 glafp-utils/sgmlverb/Makefile create mode 100644 glafp-utils/sgmlverb/sgmlverb.lex diff --git a/glafp-utils/sgmlverb/Makefile b/glafp-utils/sgmlverb/Makefile new file mode 100644 index 0000000..9d47c26 --- /dev/null +++ b/glafp-utils/sgmlverb/Makefile @@ -0,0 +1,15 @@ +TOP=.. +include $(TOP)/mk/boilerplate.mk + +C_SRCS = sgmlverb.c +C_PROG = sgmlverb +LIBS = $(FLEX_LIB) + +override SRC_FLEX_OPTS=-8 + +# +# For src distributions, include flex output. +# +SRC_DIST_FILES += sgmlverb.c + +include $(TOP)/mk/target.mk diff --git a/glafp-utils/sgmlverb/sgmlverb.lex b/glafp-utils/sgmlverb/sgmlverb.lex new file mode 100644 index 0000000..c605200 --- /dev/null +++ b/glafp-utils/sgmlverb/sgmlverb.lex @@ -0,0 +1,60 @@ + + /* This Lex script acts as a filter to pre-process Latex files. + + It surrounds groups of lines beginning with a ">" sign, and + preceded and followed by a blank line, with \begin{verbatim} + and \end{verbatim}. The ">" may be preceded by a digit or digit + range (eg 4>, 2-5>, 3->); in this case the digits are removed. + They are meant to be used for filtering out versions. + + It takes words surrounded with @ signs (thus @letrec@) and makes them + come out in typewriter font, regardless of the current mode. + */ + +%START NORM VERB VERBENV +sp [ \t]* +nl {sp}\n{sp} +miranda ([0-9]+(\-([0-9]+)?)?)?> +%{ +#define PUSH states[top++] = +#define POP BEGIN states[--top] +#define yywrap() 1 +%} +%% + int states[256]; + int top; + BEGIN NORM; + top = 0; +@@ { printf ("@"); } +@ { printf (""); PUSH NORM; BEGIN VERB; } +@ { printf (""); POP; } +@@ { printf ("@"); } +\> { printf (">"); } +\< { printf ("<"); } +\# { printf ("#"); } +\$ { printf ("$"); } +\% { printf ("%"); } +\& { printf ("&"); } +\~ { printf ("˜"); } +\^ { printf ("ˆ"); } + +\ { printf (""); PUSH NORM; BEGIN VERBENV; } +\<\/verb\> { printf (""); POP; } +\&\& { printf ("&"); } +\& { printf ("&ero;"); } +\<\/ { printf ("&etago;"); } + +%% +int +main() +{ + yylex(); + return(0); +} + +/* +\_ { printf ("{\\char'137}"); } +\\ { printf ("{\\char'134}"); } +\{ { printf ("{\\char'173}"); } +\} { printf ("{\\char'175}"); } +*/ -- 1.7.10.4