I've recently introduced a class making parsing string inputs much safer
and simpler. Please see xpcom/ds/Tokenizer.h. It's simplification of a
lexical analyzer and it successfully hides boundary checks on the input
buffer from consumers. From now on this simple parser class should be
used instead of any complicated strstr/strchr/Find/Substring unreadable
and dangerous constructions.
Tokenizer is simply constructed with a string. It then automatically
cuts and converts the input for you to words, numbers, white spaces and
special characters as you read it, be it a simple while loop or a
complex recursive descent.
For details and examples see my post at
http://www.janbambas.cz/string-parsing-made-simple-with-mozillatokenizer/
It's brand new, any suggestions on its API greatly welcomed :)
Cheers
-hb-
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform