Create a new instance of a lexer by reading from a file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(toml_lexer), | intent(out) | :: | lexer |
Instance of the lexer |
||
character(len=*), | intent(in) | :: | filename |
Name of the file to read from |
||
type(toml_error), | intent(out), | allocatable | :: | error |
Error code |
subroutine new_lexer_from_file(lexer, filename, error) !> Instance of the lexer type(toml_lexer), intent(out) :: lexer !> Name of the file to read from character(len=*), intent(in) :: filename !> Error code type(toml_error), allocatable, intent(out) :: error integer :: stat lexer%pos = 0 lexer%filename = filename call resize(lexer%stack) call read_whole_file(filename, lexer%chunk, stat) if (stat /= 0) then call make_error(error, "Could not open file '"//filename//"'") end if end subroutine new_lexer_from_file