Conversation
…testing and deploying.
… syntax error in Jenkins.
…larative pipeline syntax.
…ion, removed -X from mvn build, not ssh ing into server for deployment yet.
|
Can you do a rebase to pick up the latest changes? |
…PREPROD are the same until we use live db, which then will become an environmental secret.
Updated issue templates for issue creation, added request form for requesting access to live servers.
Update issue templates <- creating new issue templates for the future issues.
martin-bucinskas
left a comment
There was a problem hiding this comment.
Please review feedback and push the updated code.
| @@ -24,15 +23,13 @@ public static ArrayList<Token> lex(String input) { | |||
| StringBuffer tokenPatternsBuffer = new StringBuffer(); | |||
There was a problem hiding this comment.
Consider changing this to StringBuilder instead of StringBuffer as it will provide better performance.
| WALK("walk"), RUN("run"), DIRECTION("North|South|East|West"); | ||
| public final String pattern; | ||
|
|
||
| private TokenType(String pattern) { |
There was a problem hiding this comment.
Redundant private modifier as constructor without a modifier is already a private constructor.
| continue; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This line and above line indicate something wrongly indented. Check your loop start and end to see if you forgot to indent something.
| ArrayList<Token> tokens = Lexer.lex(inputTest); | ||
| String output = ""; | ||
| for (Token token : tokens) | ||
| output += token.type + " "; |
There was a problem hiding this comment.
Instead of output += token.type + " "; you could use StringBuilder to append strings together and to get the final output you can do sb.toString(). Looks a bit cleaner when dealing with string concatenation.
| @@ -41,10 +38,9 @@ public static ArrayList<Token> lex(String input) { | |||
| } else if (matcher.group(TokenType.DIRECTION.name()) != null) { | |||
| tokens.add(new Token(TokenType.DIRECTION, matcher.group(TokenType.DIRECTION.name()))); | |||
| continue; | |||
There was a problem hiding this comment.
End of loop and end of if statements there is no need to have continue here.
Description
A lexer is a type of tokenizer that adds a context to the tokens such as the type of token extracted.
A token is composed of data and type, so we have a "Token" class with these attributes
In the "TokenType" enum, we can find our Tokens type like WALK for walk , DIRECTION for North/South etc. To make this tokens we need regular expression(regex).
In the "Lexer" class, the "lex" returns a list of Token objects. This method splits the user's input after space and checks if there is a match with a token from TokenType.
Motivation and Context
Transform the user's input in a list of tokens
How Has This Been Tested?
There are 2 tests: testOutputToken(), which tests if the list of tokens contains a specific token and
testOutputNumberOfWords(), which tests if the number of tokens is equal with the number of tokens words.
Types of changes
Checklist: