summaryrefslogtreecommitdiff
path: root/support/tiny_c2l/testfile.l
blob: 3d1efba639ad655fbe970af3201cc392cc911375 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
/*\v1 \centerline{\huge\bf File testfile.l}
     \section{Block comment examples} */
/*\b
   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
   <<<<<<<<<<<<<<<<<<<<<<<<<<<<***********************>>>>>>>>>>>>>>>>>>>>>>>>
   <*  filenamex : testfile.l                                               *>
   <*  purpose   : this is a little lex file as an example for a simple     *>
   <*  iiiiiiiii : converter using the position macros. Only a few          *>
   <*  mmmmmmmmm : basic conversions are implemented; all fonts etc. are    *>
   <*            : hard-coded. You may use this file as example for use     *>
   <*            : of the position macros or as starting point for an own   *>
   <*            : converter project.                                       *>
   <<<<<<<<<<<<<<<<<<<<<<<<<<<<***********************>>>>>>>>>>>>>>>>>>>>>>>>
   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
*/

   /**************************************************************************\b
    * filename   : testfile.l (using the block comment mode)                 *
    * purpose    : this is a little lex file as an example for a simple      *
    * jjjjjjjjjj : converter using the position macros. Only a few basic iii *
    * aaaaaaaaaa : conversions are implemented; all fonts etc are hardcoded. *
    * xxxxxxxxxx : You may use this file as example for use of the position_ *
    * iiiiiiiiii : or as starting point for an own converter project.        *
    * vvvvvvvvvv : Note: vertical alignment of the colon depends here not on *
    * uuuuuuuuuu : the number of blanks before the colon; also the star at__ *
    * mmmmmmmmmm : line end is aligned even with a single blank.             *
    **************************************************************************/

   /**************************************************************************
    * filename   : testfile.l (using the normal comment mode)                *
    * purpose    : this is a test for the normal comment mode.               *
    * vvvvvvvvvv : Note: vertical alignment of the colon in this example de- *
    * uuuuuuuuuu : pends on the number of blanks before the colon; also the_ *
    * mmmmmmmmmm : star at line end is not aligned with a single blank.      *
    **************************************************************************/

 /*\v1 \section{Handling of overlong Lines:}
      \subsection{Preprocessor Statements}
  */
#define DUMMY1 stmt_without_blanks();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();stmt();

#define DUMMY2 stmt_with_blanks(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt(); stmt();

 /*\v1 \subsection{General Statements} */
   dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement(); dummy_statement();
   
   this_is(not(fine));because(we/you(also?grrrrrrr:better_for_us));didnt(include);any_spaces(into(this_line)/but(it));seems_to_be(no(problem));this_is(notatall(fine));because(we/you(also));didnt(include)||insert_any_spaces(into(this_line)/but(it));seems_to_be(no(problem));

 /*\v1 \subsection{Strings} */
   "this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string"

   "this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string\
    this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string\
    this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string\
    this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string   this is a very long string"

   "another_string_with_\n_another_string_with_\n_another_string_with_\n_another_string_with_\n_another_string_with_\n_another_string_with_\n_another_string_with_\n_another_string_with_\n_another_string_with_\n"

 /*\v1 \subsection{Comments} */
                /*this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment   */

   MMMMMMMMM(); /* NOTE: This comment start at the same ASCII position as the last one; but the LaTeX position is shifted right because the MMMMMMMM characters need a lot of space. The continuation lines are aligned to the comment start in both cases. */

     stmt();    /* Again the same ASCII position this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment */

   for(ptr=buffer;*ptr++;)stmt(ptr,var); //     this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment this is a very long comment

                                        for(ptr=buffer;*ptr++;)stmt(ptr,var); /* this comment starts at ASCII position > 50; the indentation of continuation lines is taken from the code instead of the comment start */

   stmt(); /*   1 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            *   2 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            *   3 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            *   4 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. */

stmt();    /* 1 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            * 2 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            * 3 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            * 4 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. */

MMMMMMM(); /* 1 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            *     2 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            *       3 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            *   4 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            *5 This is a test for line breaking in a long multi-line comment. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense. We need some more text so here is some more nonsense.
            */

   stmt(); /*\f this is a special form of comment (fill comment):
            * for the continuation lines of the source text
            * the newline characters and the leading blanks and *
            * are replaced by a single blank; so linebreaking is done
            * by the TeX macros. @
            * To force a linebreak, put a blank and a single @ character
            * to the end of the line, as above.
            * @
            * To insert a blank line into the output, you may use the syntax as in the
            * last source line (only a @ character after the star).

            * If you insert just a blank line, this is preserved too;
            * the indentation does not change (as in this example).
            *
            * Finally you could use this form, with only a star in the comment.
            * The star is left in the output, as it should be. ;-)))
            */

   MMMM(); /*\f This comment starts at the same ASCII position as the comment
            * above; but the MMMM() characters need much more place in the output.
            * The new indentation is preserved for all special cases again:
            *
            * This is a special form of comment (fill comment):
            * for the continuation lines of the source text
            * the newline characters and the leading blanks and *
            * are replaced by a single blank; so linebreaking is done
            * by the TeX macros. @
            * To force a linebreak, put a blank and a single @ character
            * to the end of the line, as above.
            * @
            * To insert a blank line into the output, you may use the syntax as in the
            * last source line (only a @ character after the star).

            * If you insert just a blank line, this is preserved too;
            * the indentation does not change (as in this example).
            *
            * Finally you could use this form, with only a star in the comment.
            * The star is left in the output, as it should be. ;-)))
            */

   iiii(); /*\f This is again another form of the fill comment; the
              leading stars are omitted in the input; but they are written
              in the output. @
              Line breaking works just as in the standard form of fill comments
              (with stars).

              Blank lines work as in the standard form, as you can see here. */



   stmt(); //\f This is a little example/demo for a fill comment
           // for the C++/Java language (we need some more text here
           // to get the line full). @
           // The syntax is just the same as in C comments, only
           // the comment start uses //\f instead of the C comment start.
           // To get an "empty" line insert a commented out line
           // or a line containing just a @ after the comment characters.
           // The comment characters are written in this case; a completely
           // empty line requires a new fill comment start.
           // 
           // Blank lines are not allowed in this form of comment; if you insert
           // a blank line, the fill comment is ended (as after this line).

           // Here is again a normal C++ comment. The indentation changed slightly because the previous comment position was forced by the stmt() (there is only one blank after the statement). We need again some more text to show that normal linebreaking is in effect.
           // Here begins a new comment line; the fill comment was terminated by the empty line.

   stmt();  /* iiiiiiiiiiiiii  this is just a reference to show the effect of the \jmpo and \xnjo macro */
   MMMMMMM(); /* iiiiiiiiiiii  this is just a reference to show the effect of the \jmpo and \xnjo macro */
   stmt();  /*\f iiiiiiiiiiii  this is a fill comment again: the blanks are replaced by fix space, (\xnjo macro)
             * instead of using the \jmpo macro to jump to a specific position, as is done in the normal
             * comments above */

 /*\v1 \section{Deklarations} */
   i                 = 3;
   j                 = 4;
   veryvery_long_var	= 5; /* with Tab: the = character is aligned with the others */
   veryvery_long_var = 5; /* with Blank: no alignment, because only one blank before the = */

 /*\v1 \section{Embedded \LaTeX{} comments} */
   dummy_statement();   /*\a
              $ \sum_{n=0}^N g_n(x) =
              \int_a^b f(x) \,\mbox{d}x = \int\limits_a^b f(x) \,\mbox{d}x =
              \oint_c^d F(z) \,\mbox{d}z $ */
   dummy_statement();   /*\v1 this is a \emph{verbatim}-comment; it appears \textbf{without} comment characters! */

   xxx(); //\a Again an {\em embedded} \LaTeX\ comment, using C++ comment: $\sum_{n=0}^N g_n(x) = \oint_c^d F(z) \,\mbox{d}z$

 /*\v1 \section{LEX Rules} */
[#$%{}_&]  fprintf(yyout,"\\%c",*yytext); LEN(2);      /* | */
\\         fprintf(yyout,"$\\backslash$"); LEN(12);    /* | */
\^         fprintf(yyout,"$\\hat{~}$"); LEN(9);        /* | */
[<>]       fprintf(yyout,"$%c$",*yytext); LEN(3);      /* | */
\<{2,9}    fprintf(yyout,"\\mlt{%d}",yyleng); LEN(7);  /* | */
\>{2,9}    fprintf(yyout,"\\mgt{%d}",yyleng); LEN(7);  /* | */
\\{2,}     fprintf(yyout,"\\bs{%d}",yyleng); LEN(6);   /* | */

 /*\v1 \section{Omitting Code} */

   /*\o+*/
   these+lines+
   will+be+omitted-
   from^output();
   /*\o-*/

/*\o1*/
   these+lines+
   will+be+omitted-
   from^output();

/*\o2q*/
   these+lines+
   will+be+omitted-
   from^output();

/*\o3*/
   some_code();
   some_code();
 /* Note:
  * Comments are recognized
  * even if they begin in the
  * omitted text!
  */

/*\o3q*/
  some_code();
  some_code();
  /* Note:
   * Comments are recognized
   * even if they begin in the
   * omitted text!
   */

   /* NOTE: The following omit statement has no '\o-'; it ends at end of the file. */

/*\o+*/
  some_code();
  some_code();
  /* Note:
   * Comments are recognized
   * even if they begin in the
   * omitted text!
   */