-
Notifications
You must be signed in to change notification settings - Fork 16
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
Change grammar #52
base: master
Are you sure you want to change the base?
Change grammar #52
Conversation
Add Tokenizer support to work properly with InputStreams. Signed-off-by: Evgeniy <[email protected]>
Signed-off-by: Evgeniy <[email protected]>
Signed-off-by: Evgeniy <[email protected]>
Signed-off-by: Evgeniy <[email protected]>
src/main/antlr/BSLLexer.g4
Outdated
@@ -72,7 +72,7 @@ FALSE : 'ЛОЖЬ' | 'FALSE'; | |||
UNDEFINED : 'НЕОПРЕДЕЛЕНО' | 'UNDEFINED'; | |||
NULL : 'NULL'; | |||
DECIMAL: DIGIT+; | |||
DATETIME: SQUOTE(~['\n\r])*SQUOTE?; // TODO: Честная регулярка | |||
DATETIME: SQUOTE (DIGIT DIGIT DIGIT DIGIT DIGIT DIGIT DIGIT DIGIT )(DIGIT DIGIT DIGIT DIGIT DIGIT DIGIT)? SQUOTE?; // TODO: Честная регулярка |
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.
Честная регулярка несколько сложнее. там допустимы сторонние символы.
https://github.com/1c-syntax/1c-syntax/blob/master/1c.YAML-tmLanguage#L696
import org.apache.commons.io.IOUtils; | ||
import org.codehaus.plexus.util.IOUtil; |
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.
лишняя зависимость
import org.antlr.v4.runtime.ConsoleErrorListener; | ||
import org.antlr.v4.runtime.Lexer; | ||
import org.antlr.v4.runtime.Token; | ||
import org.antlr.v4.runtime.*; |
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.
star-import в целом не приветствуется.
ps. да, я помню про код стайл и гайдлайны
@@ -78,23 +80,17 @@ protected Tokenizer(String content, Lexer lexer) { | |||
private BSLParser.FileContext computeAST() { | |||
BSLParser parser = new BSLParser(getTokenStream()); | |||
parser.removeErrorListener(ConsoleErrorListener.INSTANCE); | |||
try { | |||
parser.getInterpreter().setPredictionMode(PredictionMode.SLL); |
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.
можешь пояснить вот этот момент? можно прям комментарием со ссылкой на какой-нибудь javaDoc или статью, если есть.
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.
Signed-off-by: Evgeniy <[email protected]>
Signed-off-by: Evgeniy <[email protected]>
Signed-off-by: Evgeniy <[email protected]>
Signed-off-by: Evgeniy <[email protected]>
Signed-off-by: Evgeniy <[email protected]>
Add Tokenizer support to work properly with InputStreams.