/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*
* Portions Copyright 2011 Jens Elkner.
*/
%%
%int
%{
int p;
int span;
int div;
p = 0;
span = 0;
div = 0;
yyline++;
}
}
// TODO move this into an include file when bug #16053 is fixed
// Q&D methods to asure well-formed documents
if (p > 0) {
p--;
}
}
if (span > 0) {
span--;
}
}
if (div > 0) {
div--;
}
}
p++;
}
span++;
}
div++;
}
try {
while (span > 0) {
closeSpan();
}
while (p > 0) {
closePara();
}
} catch (IOException e) {
// nothing we can do here
}
}
%}
%eof{
cleanup();
try {
while (div > 0) {
closeDiv();
}
} catch (IOException e) {
// nothing we can do here
}
%eof}
WhiteSpace = [ \t\f]
EOL = \r|\n|\r\n
%%
<YYINITIAL> {
^(".\\\"")|(\'\\\")|("...\\\"") { yybegin(COMMENT);openSpan('c');}
}
<HEADER> {
{EOL} { yybegin(YYINITIAL); cleanup(); closeDiv(); yyline++;}
}
<COMMENT> {
{EOL} { yybegin(YYINITIAL); closeSpan(); out.write("<br/>"); yyline++;}
}
^\.(B|U|BI|BX|UL|LG|NL|SB|BR|RB) { yybegin(BOLD); openSpan('b'); }
^\.(I|SM|IB|IR|RI|IX) { yybegin(BOLD); openSpan('s'); }
^\.(CW) { yybegin(BOLD); openSpan('k'); }
^\.(DS|LD|ID|BD|CD|RD) { openSpan('k'); }
^\.DE { closeSpan(); }
<BOLD> {
{EOL} { yybegin(YYINITIAL); closeSpan(); out.write(' '); yyline++;}
}
"\\fB" { openSpan('b'); }
"\\fI" { openSpan('s'); }
"\\fC"|"\\f(CW" { openSpan('k'); }
"\\fR" { closeSpan(); }
"\\fP" { closeSpan(); }
^\.(PP|LP|P|TP|IP|HP|PD|SP|br|mk|ce) {
cleanup();
openPara();
}
^\.(RS)[^\n]* { cleanup(); openDiv("mnrs"); openPara(); }
^\.(RE)[^\n]* { cleanup(); closeDiv(); }
^\.so {out.write(".so ");}
^\.(EQ|in|sp|ne|rt|pn|ds|de|if|ig|el|ft|hy|ie|ll|ps|rm|ta|ti|na|ad|te|hw|nh|pl)[^\n]*\n { }
^\.(NH|DT|EE)[^\n]* {}
^"\\(bu\n" {}
^".nf" {closePara(); out.write("<pre>"); }
^".fi" {cleanup(); out.write("</pre>"); }
\\\*\(Tm { out.write("<sup>TM</sup> "); }
\\\*\R { out.write("® "); }
\\\((l|r)q { out.write('"'); }
\\\(mi { out.write('-'); }
<TBL> {
. {}
}
<TBLL> {
^[\_\=]\n {}
T[\{\}] {}
}
{
}
{File} {
{Path}
. { writeUnicodeChar(yycharat(0)); }