Hey! You could fix that performance penalty by rewriting the "official" routine to check the <%include%> tag for a tag before processing it <G>
Or, what about using a <%include %filename%%> construct, so that the parser is still looking for the next %>, but if it hits a %text% block before a %> that becomes an include file not a literal. That could be handled by the file include routine, not the parser, even, by assuming it's a file name, then checking to see if it's a %filename% or just filename.
This is somewhat of a special case, since the include tag is already looking for a replaceable parameter, we only need to let the file open routine know whether it's a literal or variable, and if a variable, where to get the name to open.
Or, what about using a <%include %filename%%> construct, so that the parser is still looking for the next %>, but if it hits a %text% block before a %> that becomes an include file not a literal. That could be handled by the file include routine, not the parser, even, by assuming it's a file name, then checking to see if it's a %filename% or just filename.
This is somewhat of a special case, since the include tag is already looking for a replaceable parameter, we only need to let the file open routine know whether it's a literal or variable, and if a variable, where to get the name to open.