Skip to content

Commit

Permalink
fix report.tex end of line with CR LF
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelJuillard committed May 31, 2022
1 parent 5c67e7c commit 6041346
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/reporting/report.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ function modelprintout(modname::String, symboltable::SymbolTable, parameters_val
symbols = keys(symboltable)
open(modname*".mod") do io
for token in tokenize(io)
@show token
stringtoken = Tokens.untokenize(token)
@show stringtoken
kind = Tokens.kind(token)
if kind == Tokens.IDENTIFIER
if stringtoken == "model"
Expand All @@ -134,13 +136,21 @@ function modelprintout(modname::String, symboltable::SymbolTable, parameters_val
end
push!(elements, stringtoken)
elseif kind == Tokens.WHITESPACE
if '\n' in stringtoken
subelements = []
@show stringtoken
if occursin("\r\n", stringtoken)
subelements = split(stringtoken, "\r\n")
elseif '\n' in stringtoken
subelements = split(stringtoken, '\n')
end
@show subelements
if length(subelements) > 0
for (i, se) in enumerate(subelements)
if i == 1
continue
end
push!(elements, se)
@show elements
printfmt(out, "\\verb|{:4d}: {:s}|\\\\\n", linenumber, join(elements))
elements = []
linenumber += 1
Expand All @@ -149,6 +159,7 @@ function modelprintout(modname::String, symboltable::SymbolTable, parameters_val
push!(elements, stringtoken)
end
else
@show stringtoken
push!(elements, stringtoken)
end
end
Expand Down

0 comments on commit 6041346

Please sign in to comment.