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] Fix minus literal #557

Closed
wants to merge 4 commits into from
Closed

[WIP] Fix minus literal #557

wants to merge 4 commits into from

Conversation

hachi8833
Copy link
Member

@hachi8833 hachi8833 commented Dec 31, 2017

To close #379 and to fix:

Currently -1.class or -1.0.class works, but I'm wondering how deep-duplicated operators like --+- -++-- - or 1 + + - + 1.

  • duplicated minus operator with spaces like 1- - - 1 works.
  • duplicated plus operator (or mixed) with spaces like 1+ ++ -- +1 does not work well.

I guess the implementation should be more simplified.

Looks like I'm catching cold and will be back soon.

@ghost ghost assigned hachi8833 Dec 31, 2017
@ghost ghost added the in progress label Dec 31, 2017
return true
}

p -= 1

Choose a reason for hiding this comment

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

should replace p -= 1 with p--

@codecov
Copy link

codecov bot commented Dec 31, 2017

Codecov Report

Merging #557 into master will decrease coverage by 0.28%.
The diff coverage is 27.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #557      +/-   ##
==========================================
- Coverage   82.68%   82.39%   -0.29%     
==========================================
  Files          53       53              
  Lines        7001     7045      +44     
==========================================
+ Hits         5789     5805      +16     
- Misses        967      992      +25     
- Partials      245      248       +3
Impacted Files Coverage Δ
compiler/token/token.go 100% <ø> (ø) ⬆️
compiler/parser/expression_parsing.go 53.43% <ø> (+1.05%) ⬆️
compiler/lexer/lexer.go 83.89% <27.11%> (-11.59%) ⬇️
compiler/parser/data_type_parsing.go 78.26% <0%> (+14.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 744712a...a5f141b. Read the comment docs.

@hachi8833
Copy link
Member Author

Updated the PR and fixed most issues. I believe the PR has been simplified than the initial one.

The remaining issues are related with ;:

» a=1; +a
#» 2 # invalid: should be 1

FYI: current master is also affected by the issue.

}
}

func (l *Lexer) isUnary() bool {
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be a helper function that receives an rune argument just like isIdentifier, instead of a lexer's function. We should change either its behavior or its name for the consistency.

Copy link
Member Author

Choose a reason for hiding this comment

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

First I thought as that. But this helper function goes backward the lexer so *Lexer is needed.
Passing *Lexer via argument might be ineffective.
I will change the function name to checkUnary().

@hachi8833 hachi8833 mentioned this pull request Jan 2, 2018
@hachi8833
Copy link
Member Author

#526 has been resolved by #569.
Thus I close this PR and then I will create a new PR based on #569.

@hachi8833 hachi8833 closed this Jan 11, 2018
@ghost ghost removed the in progress label Jan 11, 2018
@st0012 st0012 deleted the fix_minus_literal branch January 15, 2018 11:41
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.

Implement Primitive Data Type - Float
3 participants