-
Notifications
You must be signed in to change notification settings - Fork 10
/
test_yaml.F90
47 lines (41 loc) · 1.58 KB
/
test_yaml.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
! -----------------------------------------------------------------------------
! This file is part of Fortran-YAML: a lightweight YAML parser written in
! object-oriented Fortran.
!
! Official repository: https://github.com/BoldingBruggeman/fortran-yaml
!
! Copyright 2013-2016 Bolding & Bruggeman ApS.
!
! This is free software: you can redistribute it and/or modify it under
! the terms of the GNU General Public License as published by the Free Software
! Foundation (https://www.gnu.org/licenses/gpl.html). It is distributed in the
! hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
! A copy of the license is provided in the COPYING file.
! -----------------------------------------------------------------------------
program test_yaml
use yaml_version, only: yaml_commit_id=>git_commit_id, &
yaml_branch_name=>git_branch_name
use yaml_types
use yaml
use, intrinsic :: iso_fortran_env
character(error_length) :: error
character(256) :: path
class (type_node),pointer :: root
write(*,*)
write(*,*) 'YAML version: ',yaml_commit_id,' (',yaml_branch_name,' branch)'
write(*,*)
call get_command_argument(1, path)
if (path=='') then
write (*,*) 'ERROR: path to YAML file not provided.'
stop 2
end if
root => parse(path,unit=100,error=error)
if (error/='') then
write (*,*) 'PARSE ERROR: '//trim(error)
stop 1
end if
call root%dump(unit=output_unit,indent=0)
call root%finalize()
deallocate(root)
end program