tame/tamer/benches
Mike Gerwitz 41b41e02c1 tamer: Xirf::Text refinement
This teaches XIRF to optionally refine Text into RefinedText, which
determines whether the given SymbolId represents entirely whitespace.

This is something I've been putting off for some time, but now that I'm
parsing source language for NIR, it is necessary, in that we can only permit
whitespace Text nodes in certain contexts.

The idea is to capture the most common whitespace as preinterned
symbols.  Note that this heuristic ought to be determined from scanning a
codebase, which I haven't done yet; this is just an initial list.

The fallback is to look up the string associated with the SymbolId and
perform a linear scan, aborting on the first non-whitespace character.  This
combination of checks should be sufficiently performant for now considering
that this is only being run on source files, which really are not all that
large.  (They become large when template-expanded.)  I'll optimize further
if I notice it show up during profiling.

This also frees XIR itself from being concerned by Whitespace.  Initially I
had used quick-xml's whitespace trimming, but it messed up my span
calculations, and those were a pain in the ass to implement to begin with,
since I had to resort to pointer arithmetic.  I'd rather avoid tweaking it.

tameld will not check for whitespace, since it's not important---xmlo files,
if malformed, are the fault of the compiler; we can ignore text nodes except
in the context of code fragments, where they are never whitespace (unless
that's also a compiler bug).

Onward and yonward.

DEV-7145
2022-08-01 15:01:37 -04:00
..
asg.rs tamer: asg::Ident{Object=>}: Rename 2022-05-19 11:17:04 -04:00
asg_lower_xmle.rs tamer: Move Dim and {Sym=>}Dtype into num module 2022-05-19 10:39:21 -04:00
iter.rs tamer: iter::trip: Flatten Result 2022-05-20 16:08:16 -04:00
memchr.rs Copyright year update 2022 2022-05-03 14:14:29 -04:00
sym.rs Copyright year update 2022 2022-05-03 14:14:29 -04:00
xir.rs tamer: Xirf::Text refinement 2022-08-01 15:01:37 -04:00