@{ fret; };
action emit {
- escapeXML( tokstart, tokend-tokstart );
+ escapeXML( ts, te-ts );
}
#
}
};
- default => { escapeXML( *tokstart ); };
+ default => { escapeXML( *ts ); };
*|;
#
# Word
word {
write( "<word>" );
- write( tokstart, tokend-tokstart );
+ write( ts, te-ts );
write( "</word>\n" );
};
# Decimal integer.
integer {
write( "<int>" );
- write( tokstart, tokend-tokstart );
+ write( ts, te-ts );
write( "</int>\n" );
};
# Hexidecimal integer.
hex {
write( "<hex>" );
- write( tokstart, tokend-tokstart );
+ write( ts, te-ts );
write( "</hex>\n" );
};
# Single literal string.
"'" ( [^'\\] | /\\./ )* "'" {
write( "<single_lit>" );
- escapeXML( tokstart, tokend-tokstart );
+ escapeXML( ts, te-ts );
write( "</single_lit>\n" );
};
# Double literal string.
'"' ( [^"\\] | /\\./ )* '"' {
write( "<double_lit>" );
- escapeXML( tokstart, tokend-tokstart );
+ escapeXML( ts, te-ts );
write( "</double_lit>\n" );
};
# Or literal.
'[' ( [^\]\\] | /\\./ )* ']' {
write( "<or_lit>" );
- escapeXML( tokstart, tokend-tokstart );
+ escapeXML( ts, te-ts );
write( "</or_lit>\n" );
};
# Regex Literal.
'/' ( [^/\\] | /\\./ ) * '/' {
write( "<re_lit>" );
- escapeXML( tokstart, tokend-tokstart );
+ escapeXML( ts, te-ts );
write( "</re_lit>\n" );
};
'"' ( [^"\\] | /\\./ )* '"' => emit;
'/*' {
- escapeXML( tokstart, tokend-tokstart );
+ escapeXML( ts, te-ts );
fcall c_comment;
};
};
default {
- escapeXML( *tokstart );
+ escapeXML( *ts );
};
# EOF.
std::ios::sync_with_stdio(false);
int cs, act;
- char *tokstart, *tokend;
+ char *ts, *te;
int stack[1], top;
static char inbuf[BUFSIZE];
exit(1);
}
- if ( tokstart == 0 )
+ if ( ts == 0 )
have = 0;
else {
/* There is a prefix to preserve, shift it over. */
- have = pe - tokstart;
- memmove( inbuf, tokstart, have );
- tokend = inbuf + (tokend-tokstart);
- tokstart = inbuf;
+ have = pe - ts;
+ memmove( inbuf, ts, have );
+ te = inbuf + (te-ts);
+ ts = inbuf;
}
}
return 0;