Skip to content

Done with LS CAT WC PWD #3

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Done with LS CAT WC PWD #3

wants to merge 1 commit into from

Conversation

lectricas
Copy link
Owner

No description provided.

Copy link

@ottergottaott ottergottaott left a comment

Choose a reason for hiding this comment

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

нет комментариев, совсем

7 баллов

;

assignment : name=WORD '=' value=WORD #wordAssignment
| name=WORD '=' '$' value=WORD #variableAssignment

Choose a reason for hiding this comment

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

Странно, что присваивать можно только WORD и $WORD, а как же строки в кавычках?

String noQuotes = dqstr.substring(1, dqstr.length() - 1);

for (Map.Entry<String, String> entry : Environment.values.entrySet()) {
if (noQuotes.contains("$"+entry.getKey())) {

Choose a reason for hiding this comment

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

Пробелы вокруг операторов

String noQuotes = dqstr.substring(1, dqstr.length() - 1);

for (Map.Entry<String, String> entry : Environment.values.entrySet()) {
if (noQuotes.contains("$"+entry.getKey())) {

Choose a reason for hiding this comment

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

Пробелы вокруг операторов

@Test
public void testSimpleEcho() {
String expected = "hello\n";
String actual = Bash.runExternal("echo hello");

Choose a reason for hiding this comment

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

Это интеграционные тесты, нужно ещё юнит-тесты писать

@Test
public void testSimpleEcho() {
String expected = "hello\n";
String actual = Bash.runExternal("echo hello");

Choose a reason for hiding this comment

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

Это интеграционные тесты, нужно ещё юнит-тесты писать

String interpret(BashNode node) throws Exception {
if (node != null) {
if (node instanceof BashPipeline) {
result = interpret(((BashPipeline) node).left());

Choose a reason for hiding this comment

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

Тут бы хорошо подошёл switch, для этого значение какого-то enum лучше держать

try {
result = interpreter.interpret(rootNodeGood);
} catch (Exception e) {
// e.printStackTrace(); for debug

Choose a reason for hiding this comment

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

Не должно быть закомментированного кода

try {
result = interpreter.interpret(rootNodeGood);
} catch (Exception e) {
// e.printStackTrace(); for debug

Choose a reason for hiding this comment

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

Не должно быть закомментированного кода

result = interpreter.interpret(rootNodeGood);
} catch (Exception e) {
// e.printStackTrace(); for debug
result = e + "\n";

Choose a reason for hiding this comment

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

А почему игнорируется исключение и тупо stdout пишется?

result = interpreter.interpret(rootNodeGood);
} catch (Exception e) {
// e.printStackTrace(); for debug
result = e + "\n";

Choose a reason for hiding this comment

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

А почему игнорируется исключение и тупо stdout пишется?

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