Parse strings and files
One single-pass tokenizer; files read in chunks, over 2 GiB too; UTF-8, UTF-16, UTF-32 and Latin-1 sources. Tolerant: the first problem is reported with its line.
Parsing
Read, query, edit and write XML from modern Fortran: a DOM for documents, an index for huge files, a streaming parser with your own callbacks, a writer for any size. Pure Fortran 2008, one module: use foxy.
Read the settings of a case file, case.xml (the input of the tutorial), as numbers:
program read_number
use foxy
implicit none
type(xml_file) :: doc
real(R8P) :: dt
integer(I4P) :: steps
logical :: adaptive
call doc%parse(filename='case.xml')
call doc%get_content(id=doc%find(path='case/time/dt'), value=dt)
call doc%get_content(id=doc%find(path='case/time/steps'), value=steps)
call doc%get_content(id=doc%find(path='case/time/adaptive'), value=adaptive)
print '(ES10.3,1X,I0,1X,L1)', dt, steps, adaptive
endprogram read_number$ read_number
1.000E-03 500 TStart with the tutorial, or look up a task in the cookbook.
fx, a small command line tool built on FoXy, on the files of the tutorial: the outline of a case file, a value read as a number, a path expression, a regular expression, a malformed file, and a UTF-16 file streamed through a handler.
The whole tool is one program: tour.f90.