Produced from testfile.l on 25–Feb–2000 08:39

File testfile.l

1 Block comment examples

3 /∗
4  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
5  <<<<<<<<<<<<<<<<<<<<<<<<∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗>>>>>>>>>>>>>>>>>>>>
6  <∗ filenamex : testfile.l  ∗>
7  <∗ purpose : this is a little lex file as an example for a simple  ∗>
8  <∗ iiiiiiiii  : converter using the position macros. Only a few  ∗>
9  <∗ mmmmmmmmm : basic conversions are implemented; all fonts etc. are  ∗>
10  <∗  : hard–coded. You may use this file as example for use  ∗>
11  <∗  : of the position macros or as starting point for an own  ∗>
12  <∗  : converter project.  ∗>
13  <<<<<<<<<<<<<<<<<<<<<<<<∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗>>>>>>>>>>>>>>>>>>>>
14  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
15 ∗/

16

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

28

29  /∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗
30  ∗ filename  : testfile.l (using the normal comment mode)  ∗
31  ∗ purpose  : this is a test for the normal comment mode.  ∗
32  ∗ vvvvvvvvvv : Note: vertical alignment of the colon in this example de– ∗
33  ∗ uuuuuuuuuu : pends on the number of blanks before the colon; also the ∗
34 ∗ mmmmmmmmmm : star at line end is not aligned with a single blank. ∗
35  ∗∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗/

2 Handling of overlong Lines:

2.1 Preprocessor Statements

40 #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();

41

42 #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();

2.2 General Statements

45  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();

46

47  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)

Page 1

Produced from testfile.l on 25–Feb–2000 08:39

||insert any spaces(into(this line)/but(it));seems to be(no(problem));

2.3 Strings

50  “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”

51

52  “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\
53  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\
54  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\
55  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”

56

57  “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”

2.4 Comments

60  /∗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 ∗/

61

62  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. ∗/

63

64  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 ∗/

65

66  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

67

68  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 ∗/

69

70  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.
71  ∗ 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.
72  ∗ 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.
73  ∗ 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. ∗/

74

75 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.
76  ∗ 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.
77  ∗ 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.
78  ∗ 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. ∗/

79

80 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.
81  ∗ 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.
82 ∗ 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.
83  ∗ 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.
84  ∗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.
85  ∗/

86

87  stmt(); /∗ 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. ;–)))

∗/

104

105  MMMM(); /∗ 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. ;–)))
∗/

126

127  iiii(); /∗ 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.
∗/

134 135 136

137  stmt(); // 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).

149

150  // 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.
151  // Here begins a new comment line; the fill comment was terminated by the empty line.

152

153  stmt(); /∗ iiiiiiiiiiiiii  this is just a reference to show the effect of the \jmpo and \xnjo
∗ macro ∗/
154  MMMMMMM(); /∗ iiiiiiiiiiii this is just a reference to show the effect of the \jmpo and \xnjo
∗ macro ∗/
155  stmt(); /∗ 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
∗/

3 Deklarations

160  i  = 3;
161  j  = 4;
162  veryvery long var = 5; /∗ with Tab: the = character is aligned with the others ∗/
163  veryvery long var = 5; /∗ with Blank: no alignment, because only one blank before the = ∗/

4 Embedded L^{A}TEX comments

166 dummy statement(); /∗ ∑_{n=0}^{N} g_{n}(x) = ∫_{a}^{b} f(x) dx = ∫_{a}^{b} f(x) dx = ∮_{c}^{d} F (z) dz ∗/

170 dummy statement(); this is a verbatim-comment; it appears without comment characters!

171

172 xxx(); // Again an embedded L^{A}TEX comment, using C++ comment: ∑_{n=0}^{N} g_{n}(x) = ∮_{c}^{d} F (z) dz

Produced from testfile.l on 25–Feb–2000 08:39

5 LEX Rules

175 [#$%{} &] fprintf(yyout,“\\%c”,∗yytext); LEN(2);  /∗ | ∗/
176 \\  fprintf(yyout,“$\\backslash$”); LEN(12);  /∗ | ∗/
177 \ˆ  fprintf(yyout,“$\\hat{∼}$”); LEN(9);  /∗ | ∗/
178 [<>]  fprintf(yyout,“$%c$”,∗yytext); LEN(3);  /∗ | ∗/
179 \<{2,9} fprintf(yyout,“\\mlt{%d}”,yyleng); LEN(7);  /∗ | ∗/
180 \>{2,9} fprintf(yyout,“\\mgt{%d}”,yyleng); LEN(7);  /∗ | ∗/
181 \\{2,}  fprintf(yyout,“\\bs{%d}”,yyleng); LEN(6);  /∗ | ∗/

6 Omitting Code

184

/∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗ SKIP 3 LINES ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗/

190

/∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗ SKIP A LINE ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗/
193  will+be+omitted–
194  fromˆ output();

195

199  fromˆ output();

200

/∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗ SKIP 3 LINES ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗/
205  ∗ Comments are recognized
206  ∗ even if they begin in the
207  ∗ omitted text!
208  ∗/

209

214  ∗ Comments are recognized
215  ∗ even if they begin in the
216  ∗ omitted text!
217  ∗/

218

219  /∗ NOTE: The following omit statement has no ’\o–’; it ends at end of the file. ∗/

220

/∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗ SKIP 7 LINES ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗∗/