-
Notifications
You must be signed in to change notification settings - Fork 332
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
Shared token types #2100
base: develop
Are you sure you want to change the base?
Shared token types #2100
Conversation
Quality Gate passed for 'JPlag Plagiarism Detector'Issues Measures |
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.
A few thoughts, maybe we need to discuss this in a meeting.
Shared token types enable comparisons between languages | ||
|
||
Examples are given in a pseudo language similar to Java or Cpp | ||
|
||
# The Imperative paradigm | ||
|
||
## Variables |
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.
This might be a bit too detailed for the wiki, as the wiki is currently mostly user-focused and has some high-level info for developers. However, we do not even explain tokenization in detail. Maybe we should move this documentation elsewhere, e.g. to the language API.
METHOD("METHOD"), | ||
METHOD_END("METHOD_END"), |
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.
Are methods really that object-oriented? I would say no, as this token would correspond to any function/routine.
|
||
import de.jplag.TokenType; | ||
|
||
public enum ObjectOrientationTokens implements TokenType { |
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.
I would expect the tokens for classes, interfaces, and enums here or maybe in a separate enum for types.
|
||
import de.jplag.TokenType; | ||
|
||
public enum AnnotationTokenTypes implements TokenType { |
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.
I would try avoid token types with single tokens.
IF("IF"), | ||
ELSE("ELSE"), | ||
IF_END("IF_END"), | ||
SWITCH("SWITCH"), | ||
SWITCH_END("SWITCH_END"), | ||
CASE("CASE"), | ||
CASE_END("CASE_END"), | ||
LOOP("LOOP"), | ||
LOOP_END("LOOP_END"), | ||
GOTO("GOTO"), // TODO different context? | ||
BREAK("BREAK"), | ||
CONTINUE("CONTINUE"), |
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.
I would move those into a token type for control flow tokens.
FUNCTION_DEFINITION("FUNCTION_DEF"), | ||
FUNCTION_END("FUNCTION_END"), |
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.
Why differentiate from methods here? Do we have languages that distinguish methods and functions during tokenization?
Added shared token types and description for how they should be used