Skip to content

[cling] Rewrite implementation of InputValidator::validate(); fixes ROOT-9202#8771

Merged
jalopezg-git merged 4 commits intoroot-project:masterfrom
jalopezg-git:cling-rewrite-inputvalidator
Sep 8, 2021
Merged

[cling] Rewrite implementation of InputValidator::validate(); fixes ROOT-9202#8771
jalopezg-git merged 4 commits intoroot-project:masterfrom
jalopezg-git:cling-rewrite-inputvalidator

Conversation

@jalopezg-git
Copy link
Copy Markdown
Contributor

@jalopezg-git jalopezg-git commented Jul 29, 2021

This pull request replaces the implementation of InputValidator::validate() by simpler, more maintainable code that also fixes JIRA issue ROOT-9202.

The previous implementation was unable to properly handle line continuation after ',' or '\'. Specifically, it skipped over non-punctuation tokens, entering continuation mode even if ',' or '' were not the last tokens in the input, e.g.

int a, b

or

int a \      b

caused cling to request more input, where it shouldn't.

Changes or fixes:

  • MetaLexer:
    • Return /* and */ as independent tokens.
    • Added ReadToEndOfLine() function (consume input until '\r', '\n', or EOF).
    • Added MetaLexer::RAII that saves the current lexing position and restores it on destruction.
    • Remove unused LexPunctuatorAndAdvance().
  • Rewrite of InputValidator::validate().

Checklist:

  • tested changes locally

Fixes ROOT-9202.

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@jalopezg-git
Copy link
Copy Markdown
Contributor Author

@Axel-Naumann, @vgvassilev, as I will be off in August, again feel free to merge this if, after the review, it can be merged right away.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-29T14:38:29.932Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory

Failing tests:

@jalopezg-git jalopezg-git force-pushed the cling-rewrite-inputvalidator branch from da769b9 to 30b1783 Compare July 30, 2021 09:44
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-30T09:46:24.300Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory

Failing tests:

Copy link
Copy Markdown
Member

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!

@jalopezg-git jalopezg-git force-pushed the cling-rewrite-inputvalidator branch from 30b1783 to ccbf00d Compare July 31, 2021 09:21
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

…Line()`

This commit includes the following changes to MetaLexer:
- Update `MetaLexer::Lex()` to return `/*` (tok::l_comment), `*/` (tok::r_comment),
and `<` (tok::less) as tokens.

- Added `MetaLexer::ReadToEndOfLine()` function: consume input until `\r` or `\n`.

- Added `MetaLexer::RAII`, a RAII object that saves/restores the current position.
Replace implementation of `InputValidator::validate()` by simpler, more
maintainable code that also fixes ROOT-9202.

The previous implementation was unable to properly handle line continuation
after ',' or '\'.  Specifically, it skipped over non-punctuation tokens,
entering continuation mode even if ',' or '\' were not the last tokens in the
input, e.g. `int a, b` or 'int a \      b'.

Fixes ROOT-9202.
@jalopezg-git jalopezg-git force-pushed the cling-rewrite-inputvalidator branch from ccbf00d to 79653e4 Compare July 31, 2021 09:34
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-31T09:35:16.144Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory

Failing tests:

Copy link
Copy Markdown
Member

@Axel-Naumann Axel-Naumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jalopezg-git
Copy link
Copy Markdown
Contributor Author

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

@jalopezg-git
Copy link
Copy Markdown
Contributor Author

@phsft-bot build just on mac11.0/cxx17

@jalopezg-git jalopezg-git reopened this Sep 8, 2021
@phsft-bot
Copy link
Copy Markdown

Starting build on mac11.0/cxx17
How to customize builds

@jalopezg-git jalopezg-git merged commit a6984fd into root-project:master Sep 8, 2021
@jalopezg-git jalopezg-git deleted the cling-rewrite-inputvalidator branch September 8, 2021 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants