Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOML Parser: Wrong line number in error message #12776

Closed
sanket143 opened this issue Apr 10, 2019 · 2 comments · Fixed by #12790
Closed

TOML Parser: Wrong line number in error message #12776

sanket143 opened this issue Apr 10, 2019 · 2 comments · Fixed by #12790

Comments

@sanket143
Copy link
Contributor

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

⬆️ 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

@ben-albrecht
Copy link
Member

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

@sanket143
Copy link
Contributor Author

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

ben-albrecht added a commit that referenced this issue Apr 15, 2019
TOML Parser: Added newline to linetokens

closes #12776 where newlines were not accounted for in the line number being reported in an error message.

[Contributed by @sanket143]
[Reviewed by @ben-albrecht]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants