-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Adding some basic of F# #4042
base: master
Are you sure you want to change the base?
Adding some basic of F# #4042
Conversation
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.
Big thanks for the new grammar and welcome to ANTLR grammars!
But please fix the following things:
- Get rid of not needed parentheses
- Factor out common parts
- Split operators by whitespaces
|
||
WHITE_SPACE: [ \t\r\n]+ -> channel(HIDDEN) ; | ||
LINECOMMENT: '//' ~[\r\n]* -> channel(HIDDEN); | ||
BLOCKCOMMENT: ('(*' .*? '*)') -> channel(HIDDEN); |
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 get rid of not needed parentheses:
BLOCKCOMMENT: ('(*' .*? '*)') -> channel(HIDDEN); | |
BLOCKCOMMENT: '(*' .*? '*)' -> channel(HIDDEN); |
LINECOMMENT: '//' ~[\r\n]* -> channel(HIDDEN); | ||
BLOCKCOMMENT: ('(*' .*? '*)') -> channel(HIDDEN); | ||
|
||
INT: [0-9]+('uy'|'y'|'s'|'us'|'u'|'L')?; |
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 factor out common parts:
INT: [0-9]+('uy'|'y'|'s'|'us'|'u'|'L')?; | |
INT: [0-9]+ ('u' ('y' | 's')? | 'y' | 's' | 'L')?; |
|
||
FLOAT: [0-9]+'.'[0-9]+ ('f'|'m')?; | ||
|
||
INTERPOLATIONSIGN: '%s'|'%d'|'%f'|'%c'; |
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.
INTERPOLATIONSIGN: '%s'|'%d'|'%f'|'%c'; | |
INTERPOLATIONSIGN: '%' ('s' | 'd' | 'f' | 'c'); |
|
||
INTERPOLATIONSIGN: '%s'|'%d'|'%f'|'%c'; | ||
|
||
CHAR: '\''(~[\\']|'\\'['"nt\\]|'\\u'[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])'\''; |
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 split operators by whitespaces (exclusing parentheses):
CHAR: '\''(~[\\']|'\\'['"nt\\]|'\\u'[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])'\''; | |
CHAR: '\'' (~[\\'] | '\\' ['"nt\\] | '\\u' [0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) '\''; |
It improves grammar reading experience and fits other grammars' code-style.
|
||
INT: [0-9]+('uy'|'y'|'s'|'us'|'u'|'L')?; | ||
|
||
FLOAT: [0-9]+'.'[0-9]+ ('f'|'m')?; |
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.
FLOAT: [0-9]+'.'[0-9]+ ('f'|'m')?; | |
FLOAT: [0-9]+ '.' [0-9]+ ('f'|'m')?; |
|
||
of:OF; | ||
|
||
enum: (VERTICAL_LINE dotIentifier (equal|of) dotIentifier)+; |
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.
enum: (VERTICAL_LINE dotIentifier (equal|of) dotIentifier)+; | |
enum: (VERTICAL_LINE dotIentifier (equal | of) dotIentifier)+; |
|
||
with: WITH; | ||
|
||
record: OPEN_BRACE (((expression COLON dotIentifier) *)| (expression* with expression*)) CLOSE_BRACE; |
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.
record: OPEN_BRACE (((expression COLON dotIentifier) *)| (expression* with expression*)) CLOSE_BRACE; | |
record: OPEN_BRACE ((expression COLON dotIentifier)* | expression* with expression*) CLOSE_BRACE; |
with_get_set: (WITH ((private|internal|public)? GET UNIT EQUAL expression) | ||
(AND ((private|internal|public)? SET expression* EQUAL expression)?) | ||
| (WITH (private|internal|public)? expression* EQUAL expression)); |
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.
with_get_set: (WITH ((private|internal|public)? GET UNIT EQUAL expression) | |
(AND ((private|internal|public)? SET expression* EQUAL expression)?) | |
| (WITH (private|internal|public)? expression* EQUAL expression)); | |
with_get_set: WITH visibilityModifier? | |
( GET UNIT EQUAL expression AND (visibilityModifier? SET expression* EQUAL expression)? | |
| expression* EQUAL expression | |
) | |
; | |
visibilityModifier: private | internal | public; |
|
||
record: OPEN_BRACE (((expression COLON dotIentifier) *)| (expression* with expression*)) CLOSE_BRACE; | ||
|
||
of:OF; |
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.
of:OF; | |
of: OF; |
### Grammar for F# | ||
Maybe some troubles with handling tabulation. | ||
Maybe some troubles with defining classes. |
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.
### Grammar for F# | |
Maybe some troubles with handling tabulation. | |
Maybe some troubles with defining classes. | |
### Grammar for F# | |
Maybe some troubles with handling tabulation. | |
Maybe some troubles with defining classes. |
Adding F# grammar.