Skip to content
Snippets Groups Projects
Unverified Commit 1a9f3be5 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

update running settings

parent 5c7f8b77
No related branches found
No related tags found
No related merge requests found
Pipeline #20 passed with warnings with stages
in 36 minutes and 1 second
......@@ -24,15 +24,16 @@ test-assignment:
stage: test
dependencies:
- build-jdk8
script: "java -cp chocopy-ref.jar:target/assignment.jar chocopy.ChocoPy --pass=.s --dir src/test/data/pa2/sample --test"
script:
- ./run.sh ass
test-positive-whole:
stage: test
dependencies:
- build-jdk8
script:
- java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=rs --out /tmp/out.o src/test/data/pa2/sample/ast_coverage.py
- diff /tmp/out.o src/test/data/pa2/sample/ast_coverage.py.ast.typed || echo 'Ignoring failed test...'
- ./run.sh type src/test/data/pa2/sample/ast_coverage.py /tmp/out.o
- diff /tmp/out.o src/test/data/pa2/sample/ast_coverage.py.ast.typed
allow_failure: true
code_quality:
......
run.sh 0 → 100755
#!/bin/bash
task="$1"
input="$2"
output="$3"
if [[ "$task" = parse ]]; then
java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=r --out "$output" "$input"
elif [[ "$task" = type ]]; then
java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=.s --out "$output" "$input"
elif [[ "$task" = ass ]]; then
java -cp "chocopy-ref.jar:target/assignment.jar" chocopy.ChocoPy --pass=.s --dir src/test/data/pa2/sample --test
fi
exit $?
......@@ -82,25 +82,25 @@ public class DeclarationAnalyzer extends AbstractNodeAnalyzer<SymbolType> {
case ">=":
case "<=":
if(left_type != ValueType.INT_TYPE || right_type != ValueType.INT_TYPE)
throw new RuntimeException("Syntax Error: operand should be INT");
node.setErrorMsg("Syntax Error: operand should be INT");
break;
case "and":
case "or":
if(left_type != ValueType.BOOL_TYPE || right_type != ValueType.BOOL_TYPE)
throw new RuntimeException("Syntax Error: operand should be BOOL");
node.setErrorMsg("Syntax Error: operand should be BOOL");
break;
case "+":
if(left_type != ValueType.INT_TYPE && left_type != ValueType.STR_TYPE && ! left_type.isListType())
throw new RuntimeException("Syntax Error: operand of + should be INT or STR or LIST");
node.setErrorMsg("Syntax Error: operand of + should be INT or STR or LIST");
// fallthrough
case "==":
case "!=":
case "is":
if(node.left.getInferredType() != node.right.getInferredType())
throw new RuntimeException("Syntax Error: binary operator operand type mismatch");
node.setErrorMsg("Syntax Error: binary operator operand type mismatch");
break;
default:
throw new RuntimeException("Syntax Error: binary operator operand type not supported.");
node.setErrorMsg("Syntax Error: binary operator operand type not supported.");
}
// Now set target type.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment