Chapel: TOML Parser: Wrong line number in error message

Created on 10 Apr 2019  路  2Comments  路  Source: chapel-lang/chapel

While parsing a TOML file

toml_example.chpl

use TOML;

const tomlFile = open("example.toml", iomode.r);
const toml = parseToml(tomlFile);

example.toml

# This is a TOML document.

title = "Hello World"

[owner]
name = "Sanket Chaudhari"
dob = 2000-04-30 # Line no. 7

:arrow_up: is a valid TOML file but still Chapel TOML Parser has issues with dates #7104

Shows line number 5 even though its on line number 7. Since developer will seek the line number shown in the error message, Its expected to show
Line 7: Illegal Value -> 2000-04-30

$ chpl toml_example.chpl
$ ./toml_example
Line 5: Illegal Value -> 2000-04-30

Configuration

chpl --version

chpl version 1.20.0 pre-release (5177e24c7f)
Copyright (c) 2004-2019, Cray Inc.  (See LICENSE file for more details)

$CHPL_HOME/util/printchplenv --anonymize

CHPL_TARGET_PLATFORM: linux64
CHPL_TARGET_COMPILER: gnu
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: gmp
CHPL_HWLOC: hwloc
CHPL_REGEXP: re2
CHPL_AUX_FILESYS: none

gcc --version gcc (GCC) 8.2.1

Libraries / Modules easy / straightforward Bug user issue

Most helpful comment

@ben-albrecht Yes.. Actually New lines are getting stripped here, and it also it looks like it was not considered in parseLoop

All 2 comments

@sanket143 - Thanks for reporting. It's possible that the TOML parser is ignoring empty lines when reporting line numbers.

@ben-albrecht Yes.. Actually New lines are getting stripped here, and it also it looks like it was not considered in parseLoop

Was this page helpful?
0 / 5 - 0 ratings