Skip to content

Commit

Permalink
major crash fix for if
Browse files Browse the repository at this point in the history
  • Loading branch information
marsalad committed Oct 15, 2017
1 parent d4e45a2 commit bde613f
Show file tree
Hide file tree
Showing 17 changed files with 1,040 additions and 758 deletions.
Binary file modified Transpiler.jar
Binary file not shown.
8 changes: 4 additions & 4 deletions langs/Java8.g4
Original file line number Diff line number Diff line change
Expand Up @@ -793,15 +793,15 @@ statementExpression
;

ifThenStatement
: 'si' '(' expression ')' statement
: 'if' '(' expression ')' statement
;

ifThenElseStatement
: 'si' '(' expression ')' statementNoShortIf 'else' statement
: 'if' '(' expression ')' statementNoShortIf 'else' statement
;

ifThenElseStatementNoShortIf
: 'si' '(' expression ')' statementNoShortIf 'else' statementNoShortIf
: 'if' '(' expression ')' statementNoShortIf 'else' statementNoShortIf
;

assertStatement
Expand Down Expand Up @@ -1366,7 +1366,7 @@ FINAL : 'final';
FINALLY : 'finally';
FLOAT : 'float';
FOR : 'for';
IF : 'si';
IF : 'if';
GOTO : 'goto';
IMPLEMENTS : 'implements';
IMPORT : 'import';
Expand Down
2 changes: 1 addition & 1 deletion langs/italian.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ throws=getta
toString=inStringa
version=versione
wait=aspettare
write=scrivi
write=scrivi
34 changes: 34 additions & 0 deletions tests/frenchTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
importer java.util.*;

publique classe frenchTest {
publique statique vide main(String[] args) jette Exception {

char val = '!';
double newVar;
double[] arr = nouveau double[10];
si (val < 100) {
newVar = 5.0;
} sinon si (val == 100) {
newVar = 3.5;
} sinon {
newVar = 0;
}

pour (int i = 0; i < arr.longuer; i++) {
int j = 0;
pendtque (j < i) {
arr[i] += newVar;
j++;
}
si (i == 7) {
casser;
}
}

booleen testVal = (1 == 1);
if (null != null) {
System.out.imprimerln(arr);
}

}
}
35 changes: 35 additions & 0 deletions tests/italianTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import java.util.*;

pubblico categ italianTest {
pubblico statico vuoto main(String[] args) getta Exception {

grafia val = '!';
sosia newVar;
sosia[] arr = nuovo sosia[10];
se (val < 100) {
newVar = 5.0;
} altro se (val == 100) {
newVar = 3.5;
} altro {
newVar = 0;
}

// this is a loop in a loop
per (int i = 0; i < arr.lunghezza; i++) {
int j = 0;
mentre (j < i) {
arr[i] += newVar;
j++;
}
se (i == 7) {
rompere;
}
}

booleano testVal = (1 == 1);
se (nullo != nullo) {
System.out.stampareRiga(arr);
}

}
}
35 changes: 35 additions & 0 deletions tests/koreanTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
임포트 java.util.*;

퍼블릭 클래스 koreanTest {
퍼블릭 스태틱 보이드 main(String[] args) 쓰로우즈 Exception {

캐릭터 val = '!';
더블 newVar;
더블[] arr = 뉴 더블[10];
이프 (val < 100) {
newVar = 5.0;
} 아니면 이프 (val == 100) {
newVar = 3.5;
} 아니면 {
newVar = 0;
}

// this is a loop in a loop
포 (인트 i = 0; i < arr.길이; i++) {
인트 j = 0;
와일 (j < i) {
arr[i] += newVar;
j++;
}
이프 (i == 7) {
스톱;
}
}

부울 testVal = (1 == 1);
이프 (널 != 널) {
System.out.줄을인쇄하다(arr);
}

}
}
35 changes: 35 additions & 0 deletions tests/mandarinTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
进口 java.util.*;

公共 类 mandarinTest {
公共 静态 void main(String[] args) 抛出 Exception {

焦炭 val = '!';
双 newVar;
双[] arr = 新 双[10];
如果 (val < 100) {
newVar = 5.0;
} 否则 如果 (val == 100) {
newVar = 3.5;
} 否则 {
newVar = 0;
}

// this is a loop in a loop
对于 (整数 i = 0; i < arr.长度; i++) {
整数 j = 0;
同时 (j < i) {
arr[i] += newVar;
j++;
}
如果 (i == 7) {
打破;
}
}

布尔 testVal = (1 == 1);
如果 (空 != 空) {
System.out.打印行(arr);
}

}
}
35 changes: 35 additions & 0 deletions tests/polishTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import java.util.*;

publiczny klasa polishTest {
publiczny statyczny pustka main(String[] args) rzuca Exception {

litera val = '!';
podwojnie newVar;
podwojnie[] arr = nowy podwojnie[10];
gdyby (val < 100) {
newVar = 5.0;
} jeszcze gdyby (val == 100) {
newVar = 3.5;
} jeszcze {
newVar = 0;
}

// this is a loop in a loop
dla (calosc i = 0; i < arr.dlugosc; i++) {
calosc j = 0;
podczas (j < i) {
arr[i] += newVar;
j++;
}
gdyby (i == 7) {
przerwa;
}
}

boolean testVal = (1 == 1);
gdyby (nul != nul) {
System.out.wydrukujLn(arr);
}

}
}
35 changes: 35 additions & 0 deletions tests/portugueseTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
importar java.util.*;

publico classe portugueseTest {
publico estatico vazio main(String[] args) lances Exception {

carater val = '!';
duplo newVar;
duplo[] arr = novo duplo[10];
se (val < 100) {
newVar = 5.0;
} outro se (val == 100) {
newVar = 3.5;
} outro {
newVar = 0;
}

// this is a loop in a loop
para (inteiro i = 0; i < arr.comprimento; i++) {
inteiro j = 0;
enquanto (j < i) {
arr[i] += newVar;
j++;
}
se (i == 7) {
pausa;
}
}

boleano testVal = (1 == 1);
se (nulo != nulo) {
System.out.impressaoln(arr);
}

}
}
35 changes: 35 additions & 0 deletions tests/russianTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
включать java.util.*;

публичный класс russianTest {
публичный статический пустой main(String[] args) бросит Exception {

знак val = '!';
двойной newVar;
двойной[] arr = новый двойной[10];
если (val < 100) {
newVar = 5.0;
} иначе если (val == 100) {
newVar = 3.5;
} иначе {
newVar = 0;
}

// this is a loop in a loop
для (целый i = 0; i < arr.длина; i++) {
целый j = 0;
пока (j < i) {
arr[i] += newVar;
j++;
}
если (i == 7) {
прорыв;
}
}

логический testVal = (1 == 1);
если (нуль != нуль) {
System.out.ПринтСтр(arr);
}

}
}
35 changes: 35 additions & 0 deletions tests/spanishTest.cafe
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
importar java.util.*;

publico clase spanishTest {
publico estatico vacio main(String[] args) lanza Exception {

cara val = '!';
doble newVar;
doble[] arr = nuevo doble[10];
si (val < 100) {
newVar = 5.0;
} entonces si (val == 100) {
newVar = 3.5;
} entonces {
newVar = 0;
}

// this is a loop in a loop
para (ent i = 0; i < arr.longitud; i++) {
ent j = 0;
mientras (j < i) {
arr[i] += newVar;
j++;
}
si (i == 7) {
inter;
}
}

booleano testVal = (1 == 1);
si (nulo != nulo) {
System.out.imprimirDentro(arr);
}

}
}
4 changes: 2 additions & 2 deletions transpiler/italianLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class italianLexer extends Lexer {
null, "'astratto'", "'affermare'", "'booleano'", "'rompere'", "'byte'",
"'caso'", "'cattur'", "'grafia'", "'categ'", "'const'", "'continua'",
"'predefin'", "'fare'", "'sosia'", "'altro'", "'enum'", "'estende'", "'finale'",
"'finalmente'", "'decimale'", "'per'", "'si'", "'vaia'", "'realizzare'",
"'finalmente'", "'decimale'", "'per'", "'se'", "'vaia'", "'realizzare'",
"'import'", "'esempiodi'", "'int'", "'interfaccia'", "'lungo'", "'nativo'",
"'nuovo'", "'pacchetto'", "'privato'", "'protetta'", "'pubblico'", "'ritorno'",
"'corto'", "'statico'", "'rigorosopg'", "'super'", "'passare'", "'sincronizzato'",
Expand Down Expand Up @@ -383,7 +383,7 @@ private boolean JavaLetterOrDigit_sempred(RuleContext _localctx, int predIndex)
"\u01c0\7f\2\2\u01c0\u01c1\7g\2\2\u01c1\u01c2\7e\2\2\u01c2\u01c3\7k\2\2"+
"\u01c3\u01c4\7o\2\2\u01c4\u01c5\7c\2\2\u01c5\u01c6\7n\2\2\u01c6\u01c7"+
"\7g\2\2\u01c7*\3\2\2\2\u01c8\u01c9\7r\2\2\u01c9\u01ca\7g\2\2\u01ca\u01cb"+
"\7t\2\2\u01cb,\3\2\2\2\u01cc\u01cd\7u\2\2\u01cd\u01ce\7k\2\2\u01ce.\3"+
"\7t\2\2\u01cb,\3\2\2\2\u01cc\u01cd\7u\2\2\u01cd\u01ce\7g\2\2\u01ce.\3"+
"\2\2\2\u01cf\u01d0\7x\2\2\u01d0\u01d1\7c\2\2\u01d1\u01d2\7k\2\2\u01d2"+
"\u01d3\7c\2\2\u01d3\60\3\2\2\2\u01d4\u01d5\7t\2\2\u01d5\u01d6\7g\2\2\u01d6"+
"\u01d7\7c\2\2\u01d7\u01d8\7n\2\2\u01d8\u01d9\7k\2\2\u01d9\u01da\7|\2\2"+
Expand Down
40 changes: 20 additions & 20 deletions transpiler/koreanLexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public class koreanLexer extends Lexer {
"'\uACC4\uC18D'", "'\uB514\uD3F4\uD2B8'", "'\uD558\uB2E4'", "'\uB354\uBE14'",
"'\uC544\uB2C8\uBA74'", "'\uC774\uB118'", "'\uC775\uC2A4\uD150\uB4DC'",
"'\uD30C\uC774\uB110'", "'\uD30C\uC774\uB110\uB9AC'", "'\uD50C\uB85C\uD2B8'",
"'\uD3EC'", "'si'", "'\uACE0\uD22C'", "'\uC784\uD50C\uB808\uBA58\uCE20'",
"'\uD3EC'", "'\uC774\uD504'", "'\uACE0\uD22C'", "'\uC784\uD50C\uB808\uBA58\uCE20'",
"'\uC784\uD3EC\uD2B8'", "'\uC778\uC2A4\uD134\uC2A4'", "'\uC778\uD2B8'",
"'\uC778\uD130\uD398\uC774\uC2A4'", "'\uB871'", "'\uB124\uC774\uD2F0\uBE0C'",
"'\uB274'", "'\uD328\uD0A4\uC9C0'", "'\uD504\uB77C\uC774\uBE57'", "'\uBCF4\uD638\uB41C'",
Expand Down Expand Up @@ -363,25 +363,25 @@ private boolean JavaLetterOrDigit_sempred(RuleContext _localctx, int predIndex)
"\u017a\7\uc776\2\2\u017a\u017b\7\ub112\2\2\u017b\u017c\7\ub9ae\2\2\u017c"+
"(\3\2\2\2\u017d\u017e\7\ud50e\2\2\u017e\u017f\7\ub85e\2\2\u017f\u0180"+
"\7\ud2ba\2\2\u0180*\3\2\2\2\u0181\u0182\7\ud3ee\2\2\u0182,\3\2\2\2\u0183"+
"\u0184\7u\2\2\u0184\u0185\7k\2\2\u0185.\3\2\2\2\u0186\u0187\7\uace2\2"+
"\2\u0187\u0188\7\ud22e\2\2\u0188\60\3\2\2\2\u0189\u018a\7\uc786\2\2\u018a"+
"\u018b\7\ud50e\2\2\u018b\u018c\7\ub80a\2\2\u018c\u018d\7\uba5a\2\2\u018d"+
"\u018e\7\uce22\2\2\u018e\62\3\2\2\2\u018f\u0190\7\uc786\2\2\u0190\u0191"+
"\7\ud3ee\2\2\u0191\u0192\7\ud2ba\2\2\u0192\64\3\2\2\2\u0193\u0194\7\uc77a"+
"\2\2\u0194\u0195\7\uc2a6\2\2\u0195\u0196\7\ud136\2\2\u0196\u0197\7\uc2a6"+
"\2\2\u0197\66\3\2\2\2\u0198\u0199\7\uc77a\2\2\u0199\u019a\7\ud2ba\2\2"+
"\u019a8\3\2\2\2\u019b\u019c\7\uc77a\2\2\u019c\u019d\7\ud132\2\2\u019d"+
"\u019e\7\ud39a\2\2\u019e\u019f\7\uc776\2\2\u019f\u01a0\7\uc2a6\2\2\u01a0"+
":\3\2\2\2\u01a1\u01a2\7\ub873\2\2\u01a2<\3\2\2\2\u01a3\u01a4\7\ub126\2"+
"\2\u01a4\u01a5\7\uc776\2\2\u01a5\u01a6\7\ud2f2\2\2\u01a6\u01a7\7\ube0e"+
"\2\2\u01a7>\3\2\2\2\u01a8\u01a9\7\ub276\2\2\u01a9@\3\2\2\2\u01aa\u01ab"+
"\7\ud32a\2\2\u01ab\u01ac\7\ud0a6\2\2\u01ac\u01ad\7\uc9c2\2\2\u01adB\3"+
"\2\2\2\u01ae\u01af\7\ud506\2\2\u01af\u01b0\7\ub77e\2\2\u01b0\u01b1\7\uc776"+
"\2\2\u01b1\u01b2\7\ube59\2\2\u01b2D\3\2\2\2\u01b3\u01b4\7\ubcf6\2\2\u01b4"+
"\u01b5\7\ud63a\2\2\u01b5\u01b6\7\ub41e\2\2\u01b6F\3\2\2\2\u01b7\u01b8"+
"\7\ud37e\2\2\u01b8\u01b9\7\ube16\2\2\u01b9\u01ba\7\ub9af\2\2\u01baH\3"+
"\2\2\2\u01bb\u01bc\7\ub9ae\2\2\u01bc\u01bd\7\ud136\2\2\u01bdJ\3\2\2\2"+
"\u01be\u01bf\7\uc1fe\2\2\u01bf\u01c0\7\ud2ba\2\2\u01c0L\3\2\2\2\u01c1"+
"\u0184\7\uc776\2\2\u0184\u0185\7\ud506\2\2\u0185.\3\2\2\2\u0186\u0187"+
"\7\uace2\2\2\u0187\u0188\7\ud22e\2\2\u0188\60\3\2\2\2\u0189\u018a\7\uc786"+
"\2\2\u018a\u018b\7\ud50e\2\2\u018b\u018c\7\ub80a\2\2\u018c\u018d\7\uba5a"+
"\2\2\u018d\u018e\7\uce22\2\2\u018e\62\3\2\2\2\u018f\u0190\7\uc786\2\2"+
"\u0190\u0191\7\ud3ee\2\2\u0191\u0192\7\ud2ba\2\2\u0192\64\3\2\2\2\u0193"+
"\u0194\7\uc77a\2\2\u0194\u0195\7\uc2a6\2\2\u0195\u0196\7\ud136\2\2\u0196"+
"\u0197\7\uc2a6\2\2\u0197\66\3\2\2\2\u0198\u0199\7\uc77a\2\2\u0199\u019a"+
"\7\ud2ba\2\2\u019a8\3\2\2\2\u019b\u019c\7\uc77a\2\2\u019c\u019d\7\ud132"+
"\2\2\u019d\u019e\7\ud39a\2\2\u019e\u019f\7\uc776\2\2\u019f\u01a0\7\uc2a6"+
"\2\2\u01a0:\3\2\2\2\u01a1\u01a2\7\ub873\2\2\u01a2<\3\2\2\2\u01a3\u01a4"+
"\7\ub126\2\2\u01a4\u01a5\7\uc776\2\2\u01a5\u01a6\7\ud2f2\2\2\u01a6\u01a7"+
"\7\ube0e\2\2\u01a7>\3\2\2\2\u01a8\u01a9\7\ub276\2\2\u01a9@\3\2\2\2\u01aa"+
"\u01ab\7\ud32a\2\2\u01ab\u01ac\7\ud0a6\2\2\u01ac\u01ad\7\uc9c2\2\2\u01ad"+
"B\3\2\2\2\u01ae\u01af\7\ud506\2\2\u01af\u01b0\7\ub77e\2\2\u01b0\u01b1"+
"\7\uc776\2\2\u01b1\u01b2\7\ube59\2\2\u01b2D\3\2\2\2\u01b3\u01b4\7\ubcf6"+
"\2\2\u01b4\u01b5\7\ud63a\2\2\u01b5\u01b6\7\ub41e\2\2\u01b6F\3\2\2\2\u01b7"+
"\u01b8\7\ud37e\2\2\u01b8\u01b9\7\ube16\2\2\u01b9\u01ba\7\ub9af\2\2\u01ba"+
"H\3\2\2\2\u01bb\u01bc\7\ub9ae\2\2\u01bc\u01bd\7\ud136\2\2\u01bdJ\3\2\2"+
"\2\u01be\u01bf\7\uc1fe\2\2\u01bf\u01c0\7\ud2ba\2\2\u01c0L\3\2\2\2\u01c1"+
"\u01c2\7\uc2a6\2\2\u01c2\u01c3\7\ud0de\2\2\u01c3\u01c4\7\ud2f3\2\2\u01c4"+
"N\3\2\2\2\u01c5\u01c6\7\uc2a6\2\2\u01c6\u01c7\7\ud2ba\2\2\u01c7\u01c8"+
"\7\ub9af\2\2\u01c8\u01c9\7h\2\2\u01c9\u01ca\7r\2\2\u01caP\3\2\2\2\u01cb"+
Expand Down
Loading

0 comments on commit bde613f

Please sign in to comment.