Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Change grammar #52

wants to merge 9 commits into from

Conversation

MinimaJack
Copy link
Contributor

Add Tokenizer support to work properly with InputStreams.

Add Tokenizer support to work properly with InputStreams.

Signed-off-by: Evgeniy <minimajack@gmail.com>
Signed-off-by: Evgeniy <minimajack@gmail.com>
Signed-off-by: Evgeniy <minimajack@gmail.com>
Signed-off-by: Evgeniy <minimajack@gmail.com>
@@ -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: Честная регулярка
Copy link
Member

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;
Copy link
Member

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.*;
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

можешь пояснить вот этот момент? можно прям комментарием со ссылкой на какой-нибудь javaDoc или статью, если есть.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Evgeniy <minimajack@gmail.com>
Signed-off-by: Evgeniy <minimajack@gmail.com>
Signed-off-by: Evgeniy <minimajack@gmail.com>
Signed-off-by: Evgeniy <minimajack@gmail.com>
Signed-off-by: Evgeniy <minimajack@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants