Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added verbose alternatives to every relational operator and also for the logical "not". |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
852a0cc8150b30c046b1c4e43a68f182 |
User & Date: | emanuel.angelo@gmail.com 2012-10-08 00:14:19.000 |
Context
2012-10-08
| ||
00:28 | Updated the lists for bugs and tasks to do. check-in: 96fdb2bfc8 user: emanuel.angelo@gmail.com tags: trunk | |
00:14 | Added verbose alternatives to every relational operator and also for the logical "not". check-in: 852a0cc815 user: emanuel.angelo@gmail.com tags: trunk | |
2012-10-07
| ||
23:05 | Bug fixed: Parenthesis around logical "and" and logical "or". check-in: 5b8b878593 user: emanuel.angelo@gmail.com tags: trunk | |
Changes
Changes to grammars/pt.grammar.
︙ | ︙ | |||
88 89 90 91 92 93 94 95 96 97 98 | }; } return result; } ComparisonOperator "operador de comparação" = ">=" / ">" / "<=" / "<" / "==" | > > > > > > > > | > | > | | > > | > > > > > | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | }; } return result; } ComparisonOperator "operador de comparação" = ">=" / "for maior ou igual a" / "é maior ou igual a" / ">" / "for maior que" / "é maior que" / "<=" / "for menor ou igual a" / "é menor ou igual a" / "<" / "for menor que" / "é menor que" / "==" / "for igual a" / "é igual a" / "igual a" / "for" / "é" / "!=" / "for diferente de" / "é diferente de" / "diferente de" / "não for" / "não é" UnitaryExpression "expressão unitária" = op:(NotOperator / "-") _ operand:(UnitaryExpression / primary) { return { type: "unaryop", operator: op, arg: operand } } / primary NotOperator "operador de negação" = "não for verdade que" / "não é verdade que" / "não" LogicalAndExpression "expressão lógica 'e'" = head:ComparisonExpression tail:(ws+ "e" ws+ ComparisonExpression)* { var result = head; for (var i = 0; i < tail.length; i++) { result = { |
︙ | ︙ |
Changes to interpreter.js.
︙ | ︙ | |||
32 33 34 35 36 37 38 | "attribution": function(node) { vars[node.name] = EvalNode[node.value.type](node.value) return vars[node.name] }, "unaryop": function(node) { var arg = EvalNode[node.arg.type](node.arg) | | > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | "attribution": function(node) { vars[node.name] = EvalNode[node.value.type](node.value) return vars[node.name] }, "unaryop": function(node) { var arg = EvalNode[node.arg.type](node.arg) if (node.operator === "não é verdade que" || node.operator === "não for verdade que" || node.operator === "não") { return !arg; } else if (node.operator === "-") { return -arg } }, |
︙ | ︙ | |||
61 62 63 64 65 66 67 | } else if (node.operator === "^") { return left ^ right } else if (node.operator === "%") { return left % right } | | > > | > > | > > | > > | | | > > > > | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | } else if (node.operator === "^") { return left ^ right } else if (node.operator === "%") { return left % right } else if (node.operator === "<=" || node.operator === "for menor ou igual a" || node.operator === "é menor ou igual a") { return left <= right } else if (node.operator === ">=" || node.operator === "for maior ou igual a" || node.operator === "é maior ou igual a") { return left >= right } else if (node.operator === "<" || node.operator === "for menor que" || node.operator === "é menor que") { return left < right } else if (node.operator === ">" || node.operator === "for maior que" || node.operator === "é maior que") { return left > right } else if (node.operator === "==" || node.operator === "for igual a" || node.operator === "é igual a" || node.operator === "igual a" || node.operator === "for" || node.operator === "é") { return left == right } else if (node.operator === "!=" || node.operator === "for diferente de" || node.operator === "é diferente de" || node.operator === "diferente de" || node.operator === "não for" || node.operator === "não é") { return left != right } else if (node.operator === "e") { return left && right } else if (node.operator === "ou") { return left || right |
︙ | ︙ |
Changes to parser.js.
︙ | ︙ | |||
50 51 52 53 54 55 56 57 58 59 60 61 62 63 | "MultiplicativeExpression": parse_MultiplicativeExpression, "MultiplicativeOperator": parse_MultiplicativeOperator, "AdditiveExpression": parse_AdditiveExpression, "AdditiveOperator": parse_AdditiveOperator, "ComparisonExpression": parse_ComparisonExpression, "ComparisonOperator": parse_ComparisonOperator, "UnitaryExpression": parse_UnitaryExpression, "LogicalAndExpression": parse_LogicalAndExpression, "LogicalOrExpression": parse_LogicalOrExpression, "primary": parse_primary, "identifier": parse_identifier, "literal": parse_literal, "integer": parse_integer, "real": parse_real, | > | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | "MultiplicativeExpression": parse_MultiplicativeExpression, "MultiplicativeOperator": parse_MultiplicativeOperator, "AdditiveExpression": parse_AdditiveExpression, "AdditiveOperator": parse_AdditiveOperator, "ComparisonExpression": parse_ComparisonExpression, "ComparisonOperator": parse_ComparisonOperator, "UnitaryExpression": parse_UnitaryExpression, "NotOperator": parse_NotOperator, "LogicalAndExpression": parse_LogicalAndExpression, "LogicalOrExpression": parse_LogicalOrExpression, "primary": parse_primary, "identifier": parse_identifier, "literal": parse_literal, "integer": parse_integer, "real": parse_real, |
︙ | ︙ | |||
867 868 869 870 871 872 873 | } else { result0 = null; if (reportFailures === 0) { matchFailed("\">=\""); } } if (result0 === null) { | > > > > > > > > > > > > > > > > > > > > | | | | | | | > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | > > > > > > > > > > | | | | | | | > > > > > > > > > > | | | | | | | | | | | | | | > > > | > > > > > > > | | | | | > > > > > > > > > > > > > > > > > > > > > > | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | } else { result0 = null; if (reportFailures === 0) { matchFailed("\">=\""); } } if (result0 === null) { if (input.substr(pos, 20) === "for maior ou igual a") { result0 = "for maior ou igual a"; pos += 20; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"for maior ou igual a\""); } } if (result0 === null) { if (input.substr(pos, 18) === "\xE9 maior ou igual a") { result0 = "\xE9 maior ou igual a"; pos += 18; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"\\xE9 maior ou igual a\""); } } if (result0 === null) { if (input.charCodeAt(pos) === 62) { result0 = ">"; pos++; } else { result0 = null; if (reportFailures === 0) { matchFailed("\">\""); } } if (result0 === null) { if (input.substr(pos, 13) === "for maior que") { result0 = "for maior que"; pos += 13; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"for maior que\""); } } if (result0 === null) { if (input.substr(pos, 11) === "\xE9 maior que") { result0 = "\xE9 maior que"; pos += 11; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"\\xE9 maior que\""); } } if (result0 === null) { if (input.substr(pos, 2) === "<=") { result0 = "<="; pos += 2; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"<=\""); } } if (result0 === null) { if (input.substr(pos, 20) === "for menor ou igual a") { result0 = "for menor ou igual a"; pos += 20; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"for menor ou igual a\""); } } if (result0 === null) { if (input.substr(pos, 18) === "\xE9 menor ou igual a") { result0 = "\xE9 menor ou igual a"; pos += 18; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"\\xE9 menor ou igual a\""); } } if (result0 === null) { if (input.charCodeAt(pos) === 60) { result0 = "<"; pos++; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"<\""); } } if (result0 === null) { if (input.substr(pos, 13) === "for menor que") { result0 = "for menor que"; pos += 13; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"for menor que\""); } } if (result0 === null) { if (input.substr(pos, 11) === "\xE9 menor que") { result0 = "\xE9 menor que"; pos += 11; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"\\xE9 menor que\""); } } if (result0 === null) { if (input.substr(pos, 2) === "==") { result0 = "=="; pos += 2; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"==\""); } } if (result0 === null) { if (input.substr(pos, 11) === "for igual a") { result0 = "for igual a"; pos += 11; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"for igual a\""); } } if (result0 === null) { if (input.substr(pos, 9) === "\xE9 igual a") { result0 = "\xE9 igual a"; pos += 9; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"\\xE9 igual a\""); } } if (result0 === null) { if (input.substr(pos, 7) === "igual a") { result0 = "igual a"; pos += 7; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"igual a\""); } } if (result0 === null) { if (input.substr(pos, 3) === "for") { result0 = "for"; pos += 3; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"for\""); } } if (result0 === null) { if (input.charCodeAt(pos) === 233) { result0 = "\xE9"; pos++; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"\\xE9\""); } } if (result0 === null) { if (input.substr(pos, 2) === "!=") { result0 = "!="; pos += 2; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"!=\""); } } if (result0 === null) { if (input.substr(pos, 16) === "for diferente de") { result0 = "for diferente de"; pos += 16; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"for diferente de\""); } } if (result0 === null) { if (input.substr(pos, 14) === "\xE9 diferente de") { result0 = "\xE9 diferente de"; pos += 14; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"\\xE9 diferente de\""); } } if (result0 === null) { if (input.substr(pos, 12) === "diferente de") { result0 = "diferente de"; pos += 12; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"diferente de\""); } } if (result0 === null) { if (input.substr(pos, 7) === "n\xE3o for") { result0 = "n\xE3o for"; pos += 7; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"n\\xE3o for\""); } } if (result0 === null) { if (input.substr(pos, 5) === "n\xE3o \xE9") { result0 = "n\xE3o \xE9"; pos += 5; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"n\\xE3o \\xE9\""); } } } } } } } } } } } } } } } } } } } |
︙ | ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | function parse_UnitaryExpression() { var result0, result1, result2; var pos0, pos1; reportFailures++; pos0 = pos; pos1 = pos; | < < < < | < < < < | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | function parse_UnitaryExpression() { var result0, result1, result2; var pos0, pos1; reportFailures++; pos0 = pos; pos1 = pos; result0 = parse_NotOperator(); if (result0 === null) { if (input.charCodeAt(pos) === 45) { result0 = "-"; pos++; } else { result0 = null; if (reportFailures === 0) { |
︙ | ︙ | |||
1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 | } reportFailures--; if (reportFailures === 0 && result0 === null) { matchFailed("express\xE3o unit\xE1ria"); } return result0; } function parse_LogicalAndExpression() { var result0, result1, result2, result3, result4, result5; var pos0, pos1, pos2; reportFailures++; pos0 = pos; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | } reportFailures--; if (reportFailures === 0 && result0 === null) { matchFailed("express\xE3o unit\xE1ria"); } return result0; } function parse_NotOperator() { var result0; reportFailures++; if (input.substr(pos, 19) === "n\xE3o for verdade que") { result0 = "n\xE3o for verdade que"; pos += 19; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"n\\xE3o for verdade que\""); } } if (result0 === null) { if (input.substr(pos, 17) === "n\xE3o \xE9 verdade que") { result0 = "n\xE3o \xE9 verdade que"; pos += 17; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"n\\xE3o \\xE9 verdade que\""); } } if (result0 === null) { if (input.substr(pos, 3) === "n\xE3o") { result0 = "n\xE3o"; pos += 3; } else { result0 = null; if (reportFailures === 0) { matchFailed("\"n\\xE3o\""); } } } } reportFailures--; if (reportFailures === 0 && result0 === null) { matchFailed("operador de nega\xE7\xE3o"); } return result0; } function parse_LogicalAndExpression() { var result0, result1, result2, result3, result4, result5; var pos0, pos1, pos2; reportFailures++; pos0 = pos; |
︙ | ︙ |