-
Notifications
You must be signed in to change notification settings - Fork 28
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
Support an integer type annotation argument #267
Conversation
src/Nirum/Parser.hs
Outdated
v <- many digitChar | ||
case readMaybe v of | ||
Just i -> return $ AInt i | ||
Nothing -> fail "digit expected" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could define a more general parser to take one or more digits and returns Integer
, i.e., integer :: Parser Integer
, and then make this annotationArgumentValue
to utilize that.
@@ -20,7 +23,11 @@ import Nirum.Constructs (Construct (toCode)) | |||
import Nirum.Constructs.Docs | |||
import Nirum.Constructs.Identifier (Identifier) | |||
|
|||
type AnnotationArgumentSet = M.Map Identifier T.Text | |||
data AnnotationArgument = AText T.Text | |||
| AInt Int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e01f299
to
54224af
Compare
Checklist 🤔
|
CHANGES.md
Outdated
@@ -125,7 +125,14 @@ To be released. | |||
import iso (country as iso-country); | |||
import types (country); | |||
~~~~~~~~ | |||
- Support an integer type annotation argument. [[#178], [#267]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the past tense.
cdac2fa
to
7941023
Compare
Codecov Report
@@ Coverage Diff @@
## master #267 +/- ##
==========================================
- Coverage 76.14% 76.08% -0.06%
==========================================
Files 33 33
Lines 2452 2467 +15
Branches 131 132 +1
==========================================
+ Hits 1867 1877 +10
- Misses 454 458 +4
- Partials 131 132 +1
Continue to review full report at Codecov.
|
7941023
to
e1498ef
Compare
Support an integer type annotation argument which is one of the features that listed on #178. Since this is the blocker issue of #206, we can add constraints for integer types(
int32
,int64
,bigint
) after merging this PR.However, I should create
fixture.datetime.datetime-service
, because all types except for a method ofservice
couldn't compile the annotation. We have to compile the annotation of the unboxed type first to do #206.Review, please :) @dahlia @Kroisse @AiOO.