new_lexer_from_string Subroutine

public subroutine new_lexer_from_string(lexer, string)

Create a new instance of a lexer by reading from a string.

Arguments

Type IntentOptional Attributes Name
type(toml_lexer), intent(out) :: lexer

Instance of the lexer

character(kind=tfc, len=*), intent(in) :: string

String to read from


Source Code

subroutine new_lexer_from_string(lexer, string)
   !> Instance of the lexer
   type(toml_lexer), intent(out) :: lexer
   !> String to read from
   character(*, tfc), intent(in) :: string

   integer :: length

   length = len(string)
   lexer%pos = 0
   lexer%buffer = 0
   allocate(character(length) :: lexer%chunk)
   lexer%chunk(:length) = string
   call resize(lexer%stack)
end subroutine new_lexer_from_string