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

WIP: refactor scanner and reader #2371

Closed
wants to merge 16 commits into from

Conversation

fingolfin
Copy link
Member

This is currently based on #2040, so that PR should be merged first.

Also, I have not yet fully rewritten the float and integer literal scanning (to avoid the S_PARTIAL* states); or rather, I had changes for that, but decided to start from scratch with this PR, in an attempt to make the change more incremental, and hence easier to review, at least when looking at it commit-by-commit.

However, I wanted to get this out now, to (a) see what the full test suite makes of it, and (b) to give people an early chance to spot issues and leave comments (though of course most likely nobody will have time to do that ;-).

One thing on which everybody can comment:The commit "scanner: remove GetCleanedChar" is a bit experimental, as it changes user visible behaviour; what do people think about this in terms of how "bad" it is? To illustrate, before the change, you might see this:

gap> 12.34\56;
Syntax error: Badly formed number
12.34\56;
     ^

after:

gap> 12.34\56;
Syntax error: Badly Formed Number
12.34\56;
    ^
Error, Variable: '56' must have a value
not in any function at *stdin*:1

To me, this is acceptable if this allow us to gain substantially simpler code, but I wonder if there are other reasons for the existence and use of GetCleanedChar in the float parser that I missed? Perhaps @stevelinton has some thought on this?

@fingolfin fingolfin added do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) topic: kernel release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Apr 18, 2018
@codecov
Copy link

codecov bot commented Apr 18, 2018

Codecov Report

Merging #2371 into master will increase coverage by 0.02%.
The diff coverage is 88.41%.

@@            Coverage Diff             @@
##           master    #2371      +/-   ##
==========================================
+ Coverage   73.69%   73.71%   +0.02%     
==========================================
  Files         484      484              
  Lines      245670   245524     -146     
==========================================
- Hits       181042   180985      -57     
+ Misses      64628    64539      -89
Impacted Files Coverage Δ
src/code.c 93.37% <ø> (ø) ⬆️
src/stats.c 87.17% <ø> (-0.02%) ⬇️
src/scanner.h 100% <ø> (ø) ⬆️
src/io.c 72.83% <100%> (+0.11%) ⬆️
src/streams.c 72.65% <52.94%> (-0.08%) ⬇️
src/intrprtr.c 94.1% <90%> (-0.1%) ⬇️
src/scanner.c 93.53% <91.3%> (+3.62%) ⬆️
src/read.c 94.5% <98.68%> (+4.94%) ⬆️
src/gasman.c 85.47% <0%> (-0.19%) ⬇️
... and 2 more

Parsing float literals that start with a dot, like `.123`, is
implemented using a hack, where the reader tells the scanner that it
should look for a number expression (normally, the scanner never changes
the state of the reader, except for parsing long integers and float
literals).

We change the way this is done to make it stand out more. Further
benefits from the change are that we can get rid of S_PARTIALFLOAT1,
simplifying the intricate state machine for parsing. Moreover,
STATE(Symbol) now is read-only in the reader.
... and not in ClearError
@fingolfin fingolfin changed the title WIP: refactor scanner and reader; simplify parsing of long string/float/integer literals WIP: refactor scanner and reader Apr 22, 2018
@fingolfin
Copy link
Member Author

This has been superseded by various other PRs, most recently PR #2467

@fingolfin fingolfin closed this May 15, 2018
@fingolfin fingolfin deleted the mh/scanner-value branch May 18, 2018 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge PRs which are not yet ready to be merged (e.g. submitted for discussion, or test results) release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant