diff options
Diffstat (limited to 'support/splint/examples/symbols')
-rw-r--r-- | support/splint/examples/symbols/Makefile | 8 | ||||
-rw-r--r-- | support/splint/examples/symbols/slimbo.sty | 2 | ||||
-rw-r--r-- | support/splint/examples/symbols/symbols.w | 46 | ||||
-rw-r--r-- | support/splint/examples/symbols/symfm.sty | 2 | ||||
-rw-r--r-- | support/splint/examples/symbols/symmap.sty | 5 | ||||
-rw-r--r-- | support/splint/examples/symbols/symtoks.sty | 2 | ||||
-rw-r--r-- | support/splint/examples/symbols/symtricks.sty | 2 |
7 files changed, 36 insertions, 31 deletions
diff --git a/support/splint/examples/symbols/Makefile b/support/splint/examples/symbols/Makefile index 964927bc9d..80a6aed0c6 100644 --- a/support/splint/examples/symbols/Makefile +++ b/support/splint/examples/symbols/Makefile @@ -1,4 +1,4 @@ -# Copyright 2012-2020, Alexander Shibakov +# Copyright 2012-2022, Alexander Shibakov # This file is part of SPLinT # # SPLinT is free software: you can redistribute it and/or modify @@ -18,8 +18,8 @@ # purposes; the main directory (../..) follows a slightly more # modular organization scheme. -SYMBOLS_PREREQS = %.tex %.idx ${SPLINT_XTEXSTYLES} ${SPLINT_ROOT}cweb/bo.tok ${SPLINT_ROOT}cweb/fo.tok symtoks.sty -SYMBOLS_PREREQS += ${SPLINT_XPTABLES} ${SPLINT_XLTABLES} symmap.sty symtricks.sty symfm.sty slimbo.sty +SYMBOLS_PREREQS = %.tex %.idx ${SPLINT_XTEXSTYLES} ${SPLINT_XTABLES} symtoks.sty +SYMBOLS_PREREQS += symmap.sty symtricks.sty symfm.sty slimbo.sty SYMBOLS_PREREQS += ${SPLINT_ROOT}cweb/fil.l ${SPLINT_ROOT}cweb/bg.y ${SPLINT_ROOT}cweb/lo.l @@ -53,7 +53,7 @@ mostlyclean: clean_temp distclean: clean cd ${SPLINT_ROOT} && ${MAKE} clean -.PRECIOUS: ${SPLINT_ROOT}cweb/fo.tok ${SPLINT_ROOT}cweb/bo.tok ${SPLINT_ROOT}cweb/lo.l \ +.PRECIOUS: ${SPLINT_XOTABLES} ${SPLINT_ROOT}cweb/lo.l \ ${SPLINT_ROOT}cweb/fil.l ${SPLINT_ROOT}cweb/dyytab.tex ${SPLINT_ROOT}cweb/gyytab.tex \ ${SPLINT_ROOT}cweb/fyytab.tex symbols.gdy diff --git a/support/splint/examples/symbols/slimbo.sty b/support/splint/examples/symbols/slimbo.sty index 48da360f55..1dcfe15a84 100644 --- a/support/splint/examples/symbols/slimbo.sty +++ b/support/splint/examples/symbols/slimbo.sty @@ -1,4 +1,4 @@ -% Copyright 2012-2020, Alexander Shibakov +% Copyright 2012-2022, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify diff --git a/support/splint/examples/symbols/symbols.w b/support/splint/examples/symbols/symbols.w index dc58adc0bd..f680b1bffc 100644 --- a/support/splint/examples/symbols/symbols.w +++ b/support/splint/examples/symbols/symbols.w @@ -1,4 +1,4 @@ -% Copyright 2012-2020, Alexander Shibakov +% Copyright 2012-2024, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify @@ -13,7 +13,6 @@ % % You should have received a copy of the GNU General Public License % along with SPLinT. If not, see <http://www.gnu.org/licenses/>. -\newwrite\gindex % the namespace choices below are a bit random as this is a demo only @@ -21,11 +20,6 @@ \def\optimization{5} \input yy.sty \modenormal -\input noweb.sty - \xreflocaltrue - \readlxrefs - \newwrite\xrefstream - \immediate\openout\xrefstream=\jobname.xxr \input dcols.sty \input symmap.sty \let\parsernamespace\flexnamespace @@ -70,7 +64,8 @@ \input symfm.sty \input slimbo.sty -\setupfootnotes +\topskip=9pt +\initauxstream @** Introduction. The manual supplied with \splint\ presents an outline of the main @@ -243,7 +238,7 @@ the value of \.{\\gaglue} set by a copy of one of the productions. \insertraw{\let\stashnext\stashnextwithspace}% line_breaking_and_symbols: GEN\stashed{|stash!=0|}ERIC '(' expression',' \ ss another es')' \ - \insertraw{\let\stashnext\stashnextwithnothingnx}% + \insertraw{\let\stashnext\stashnextwithnothing}% ` inline_\stashed{look: $\rightarrow\,$}c \{ \stashed{\X{$\infty$}:See this example to deduce $\ldots$\X\6}\stashed{|b == a - c|} \} ` more_inline_c \{ \stashed{|func(int a, char b);|} \} % @@ -285,7 +280,7 @@ symbol_tricks: \input symtricks.sty \noindent The stash chunks, inserted by \.{\\stashed\{}{\it random input\/}\.{\}} are invisible to the parser. As an example, the stash producing the action in the first rule below (|stash!=0|) was -inserted in the middle of the first term (\prodstyle{GENERIC}). The space (\.{ }) is a special case. +inserted in the middle of the first term (\prodstyle{GENERIC}). The space (\.{\ }) is a special case. \medskip \beginprod line_breaking_and_symbols: @@ -305,7 +300,7 @@ Here is the same set of productions with stash producing a space in the middle o \insertraw{\let\stashnext\stashnextwithspace}% line_breaking_and_symbols: GEN\stashed{|stash!=0|}ERIC '(' expression',' \ ss another es')' \ - \insertraw{\let\stashnext\stashnextwithnothingnx}% + \insertraw{\let\stashnext\stashnextwithnothing}% ` inline_\stashed{look: $\rightarrow\,$}c \{ \stashed{\X{$\infty$}:See this example to deduce $\ldots$\X\6}\stashed{|b == a - c|} \} ` more_inline_c \{ \stashed{|func(int a, char b);|} \} % @@ -316,7 +311,7 @@ line_breaking_and_symbols: {\it \flexrestyle{\^\\\\[\\"\\'?\\\\]}}. Portions of \flex\ files may be typeset with the help of \.{\\beginflex}$\ldots$\.{\\endflex} macros. Just as in the case of \bison\ productions, care must be taken to escape some symbols that have special meaning to \TeX. The ones that {\it must be\/} escaped when used inside -regular expressions are `\.{\{}', `\.{\}}', `\.{\\}', and~`\.{\%}'. Others, such as `\.{\^}', `\.{\_}', `\.{\$}', `\.{\#}', +regular expressions are `\.{\{}', `\.{\}}', `\.{\\}', `\.{\ }' (see more below), and~`\.{\%}'. Others, such as `\.{\^}', `\.{\_}', `\.{\$}', `\.{\#}', and~`\.{\&}' do not require any special treatment (although they continue to perform their special functions inside \.{\\stashed} blocks). As a note of caution, `$\ldots$\.{\\\\]}' results in `$\ldots$\flexrestyle{\\]}' and not @@ -331,6 +326,9 @@ this character is nearly inaccessible in the \TeX\ mode of \CTANGLE, which resul `\.{\\`}' instead. If the example is not part of a \CWEB\ input (for example it is included from its own \TeX\ file similar to \.{symtricks.sty} above) then one can use the `\.{\yl}' character as intended. However, even inside a `pure \TeX\ file' to get `\.{`}', one must still type `\.{\\`}'. +Finally, it is worth remembering that a space (\.{\ }) would terminate a regular expression (and produce a syntax error) inside +\.{\\flexrestyle}. This is part of the regular \flex\ syntax and not a \splint\ specific limitation. To make a space character +a part of a regular expression it must be escaped. Many of the points made above may become more transparent after examining the source of the example following this sentence. \medskip \cdebugtrue @@ -371,6 +369,20 @@ LEXOPT [porkacne] M4QSTART "[[" M4QEND "]]" +@ Lexer specific options can be typeset as well. Any portion specific to \Cee\ can be relegated +to \CWEB\ as can be seen below. Adjusting the typesetting of various \Cee\ terms works as expected +(see the source for this example). +@s scan_state int +@<Lexer options@>= +@G(fs1) +%option bison-bridge +%option noyywrap noinput reentrant nounput +%option header-file="lexer.h" +%option prefix="main_c" +%option extra-type="@>struct scan_state *@=" +%option stack +@g + @ The first three lines of the previous section successfully parse as section~2 input. \parseverbosetrue @<As section 2@>= @@ -425,7 +437,8 @@ NOT_WS [^[:blank:]\r\n] @q of index entries depends on the placement of this inclusion @> @i alphas.hx -@** Index. Various identifiers in \bison\ productions and \flex\ sections are put in the index, along with +@** Index. \global\let\secrangedisplay\empty% do not show the current section range anymore +Various identifiers in \bison\ productions and \flex\ sections are put in the index, along with the identifiers from the \Cee\ portions of the \CWEB\ input. The mechanism used to typeset these identifiers is different from the one employed by the \CWEB's indexing macros. While the \.{\\I} macros in @@ -434,16 +447,9 @@ only outputs the context in which the identifier was encountered. By redefining the macros that interpret this context to typeset the index, several useful effects can be achieved\footnote{One pretty common use is to redefine macros that take parameters to take none.}. -\unsetfootnotes -\input gindex.sty \def\otherlangindexseparator{% the index is too short \toksg{}% \vskip.5\baselineskip \centerline{B{\sc ISON}, F{\sc LEX, AND} \TeX\ {\sc INDICES}}% \vskip.5\baselineskip } -\closeout\gindex -\termindexfalse % do not attach indexing entries to the terms in the index, or the section list -\let\inx\inxmod -\let\fin\finmod -\def\topofcontents{\null\vskip-3\baselineskip\centerline{C{\sc ONTENTS} (\sc\uppercase\expandafter{\title})}\medskip} diff --git a/support/splint/examples/symbols/symfm.sty b/support/splint/examples/symbols/symfm.sty index 9cfeacbeaa..985d4148d1 100644 --- a/support/splint/examples/symbols/symfm.sty +++ b/support/splint/examples/symbols/symfm.sty @@ -1,4 +1,4 @@ -% Copyright 2012-2020, Alexander Shibakov +% Copyright 2012-2022, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify diff --git a/support/splint/examples/symbols/symmap.sty b/support/splint/examples/symbols/symmap.sty index 450dd9a649..0a4afbc50a 100644 --- a/support/splint/examples/symbols/symmap.sty +++ b/support/splint/examples/symbols/symmap.sty @@ -1,4 +1,4 @@ -% Copyright 2012-2020, Alexander Shibakov +% Copyright 2012-2022, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify @@ -25,7 +25,7 @@ \restorecslist{symbols}\yyunion \toksa{}\toksb{}\toksc{}\toksd{}% %\showthe\newsymswitch - \the\symstream + \the\table \global\newsymswitch\newsymswitch \else \newsymswitch{}% otherwise \yysymswitch is trying to expand the wrong names (\namepair is not present to do \csname ... ) @@ -118,7 +118,6 @@ \ifyyparsefail \errmessage{could not process symbols}% \else - \symstream\table \tointermediateparser % the parsing is finished, so we have two very long strings: % o the rules of the hosted parser ([intermediate]) % o the rules of the same parser just parsed diff --git a/support/splint/examples/symbols/symtoks.sty b/support/splint/examples/symbols/symtoks.sty index 3ab9b142c7..6c1bcff58d 100644 --- a/support/splint/examples/symbols/symtoks.sty +++ b/support/splint/examples/symbols/symtoks.sty @@ -1,4 +1,4 @@ -% Copyright 2012-2020, Alexander Shibakov +% Copyright 2012-2022, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify diff --git a/support/splint/examples/symbols/symtricks.sty b/support/splint/examples/symbols/symtricks.sty index 04bf5c5ac1..cc29bf7dea 100644 --- a/support/splint/examples/symbols/symtricks.sty +++ b/support/splint/examples/symbols/symtricks.sty @@ -1,4 +1,4 @@ -% Copyright 2012-2020, Alexander Shibakov +% Copyright 2012-2022, Alexander Shibakov % This file is part of SPLinT % % SPLinT is free software: you can redistribute it and/or modify |