summaryrefslogtreecommitdiff
path: root/support/splint/cweb/ssffo.w
diff options
context:
space:
mode:
Diffstat (limited to 'support/splint/cweb/ssffo.w')
-rw-r--r--support/splint/cweb/ssffo.w25
1 files changed, 15 insertions, 10 deletions
diff --git a/support/splint/cweb/ssffo.w b/support/splint/cweb/ssffo.w
index 56e710b8c6..315bffc798 100644
--- a/support/splint/cweb/ssffo.w
+++ b/support/splint/cweb/ssffo.w
@@ -1,4 +1,4 @@
-@q Copyright 2012-2015, Alexander Shibakov@>
+@q Copyright 2012-2020, Alexander Shibakov@>
@q This file is part of SPLinT@>
@q SPLinT is free software: you can redistribute it and/or modify@>
@@ -16,18 +16,21 @@
\input limbo.sty
\def\optimization{5}
\input yy.sty
-
+\modenormal
\let\oldN\N
\let\N\textN
\let\M\textM
-\def\hostparsernamespace{[unreacheable]}
+% uncomment the next line to leave the typesetting of tokens in its raw state.
+%\def\hostparsernamespace{[unreacheable]}
+\let\hostparsernamespace\mainnamespace
+\input btokenset.sty
@** A simple scanner for \flex\ options.
This is a `bare-bones' scanner for a subset of the `extended' \bison\
-grammar that parses, well, some of the `extensions', namely, the
+grammar that parses some of the `extensions', namely, the
\flex\ state declarations. It does not use the state mechanism
itself, and is supposed to be used with the bootstrapping parser, even
-though it is not strictly necessary. It parses state declarations as
+though this is not strictly necessary. It parses state declarations as
long as they are separated into their own \CWEB\ sections and extracts
the {\it names\/} of the states. The \flex\ scanner output `driver'
does the rest after including the produced header file.
@@ -57,7 +60,7 @@ something that should not have been. Making the syntax and the grammar
more restrictive helps to acheive this, as well as makes the overall
design simpler.
@<Lexer definitions@>=
-@G
+@G(fs1)
letter [_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]
id {letter}({letter}|[-0-9])*
@g
@@ -89,13 +92,15 @@ of tokens recognized by this routine is not very wide.
@ White space skipping.
@<Scan white space@>=
-@G
+@G(fs2)
[ \f\n\t\v] {@> @[TeX_( "/yylexnext" );@]@=}
@g
-@ The rest of it are either identifiers or \.{\%}-options.
+@ The rest of it are either identifiers or \.{\%}-options. The typesetting of
+the appropriate \bison\ tokens below was arranged by inputting \.{btokenset.sty} and
+relying on the pretty-printing macros for {\it \TeX} to do their job.
@<Scan identifiers@>=
-@G
+@G(fs2)
{id} {@> @<Return an identifier@> @=}
"%x" {@> @[TeX_( "/yylexreturnptr{FLEX_STATE_X}" );@] @=}
"%s" {@> @[TeX_( "/yylexreturnptr{FLEX_STATE_S}" );@] @=}
@@ -110,7 +115,7 @@ of tokens recognized by this routine is not very wide.
@ The lexer returns standard \.{\\yyunion} types.
@<Return an identifier@>=
- @[TeX_( "/edef/next{/yylval{/nx/idit{/the/yytextpure}{/the/yytext}" );@]@;
+ @[TeX_( "/edef/next{/yylval{{/the/yytextpure}{/the/yytext}" );@]@;
@[TeX_( " {/the/yyfmark}{/the/yysmark}}}/next" );@]@;
@[TeX_( "/yylexreturn{ID}" );@]@;