Open Pharap opened 4 years ago
Yea, Sorry about this late reply It does seem a little overkill to include an entire c++ File parser...Though It would be good to make such a library independent of this ?
It does seem a little overkill to include an entire c++ File parser...
If we were talking about nearly any other language I'd say it's a reasonable thing to do, but C++ is a context-sensitive language, which complicates matters.
Making a parser that parses a certain subset of C++ probably wouldn't be too bad, but we'd have to decide what that subset would be.
As things stand I put that in the "nice to have" bubble rather than the "necessary" bubble.
Though It would be good to make such a library independent of this ?
If there's a chance that more tools like this (in particular ones needing to read arrays from .h
files) are going to be needed in the future then perhaps.
Remembering what @filmote said about map loading taking a while, a quick-and-dirty solution might be to pass
RegexOptions.Compiled
to themapLoadRegex
's constructor.This should internally cause the regex to be compiled to .Net bytecode, which should make it run faster. The downside is that it will increase program startup time, but that might be an acceptable tradeoff if compiling the regex improves map load times.
More info about
RegexOptions.Compiled
:The proper solution for reading C++ code files is to use a proper parser instead of using regular expressions, but I don't think it's worth doing that at the moment.