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

Fix source locations with --no-preprocessor and add a virtual file system layer to the parser #2377

Merged
merged 5 commits into from
Jan 16, 2023

Conversation

quentin
Copy link
Member

@quentin quentin commented Dec 21, 2022

This change fixes source locations with --no-preprocessor and introduces a light virtual file system layer to the parser.

By default the parser sees the real file system (through RealFileSystem). But it is also possible to present any other object that implements the new FileSystem interface. For intance the OverlayFileSystem combines multiple stacked virtual file-system objects (à-la Docker).

Adds a test that demonstrate the use of vfs with the libsouffle.

The default virtual file system used by the parser is the real
file system. And it's possible to initialize the parser driver
with a different virtual file system.

The Overlay file system is a stack of virtual file systems.
Source location were off by one line.

The source location on the first line had an uninitialized column
number.

Error messages would point to the wrong column when the location is
after consecutive non-leading whitespaces.
@codecov
Copy link

codecov bot commented Dec 21, 2022

Codecov Report

Merging #2377 (92059a0) into master (251e8fd) will increase coverage by 0.11%.
The diff coverage is 84.87%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2377      +/-   ##
==========================================
+ Coverage   77.52%   77.64%   +0.11%     
==========================================
  Files         467      470       +3     
  Lines       30778    30966     +188     
==========================================
+ Hits        23862    24043     +181     
- Misses       6916     6923       +7     
Impacted Files Coverage Δ
src/parser/ParserDriver.h 100.00% <ø> (ø)
src/MainDriver.cpp 69.98% <60.00%> (-0.26%) ⬇️
src/parser/scanner.ll 78.01% <76.92%> (+5.49%) ⬆️
tests/libsouffle_interface/vfs_overlay_test.cpp 85.93% <85.93%> (ø)
src/parser/SrcLocation.cpp 91.86% <87.50%> (+7.24%) ⬆️
src/parser/VirtualFileSystem.cpp 88.37% <88.37%> (ø)
src/parser/ParserDriver.cpp 89.49% <88.52%> (-0.34%) ⬇️
src/parser/SrcLocation.h 100.00% <100.00%> (ø)
src/parser/VirtualFileSystem.h 100.00% <100.00%> (ø)
...ouffle/datastructure/ConcurrentInsertOnlyHashMap.h 88.18% <0.00%> (+0.78%) ⬆️
... and 2 more

@quentin quentin marked this pull request as ready for review December 26, 2022 10:02
Copy link
Collaborator

@XiaowenHu96 XiaowenHu96 left a comment

Choose a reason for hiding this comment

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

Looks good!

@quentin quentin merged commit 84878b9 into souffle-lang:master Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants