Skip to content

Commit ab256aa

Browse files
authored
Merge pull request #297 from Shad7ows/main
تعديل ملف إرشادات اللغة
2 parents db25249 + 010e3e8 commit ab256aa

14 files changed

Lines changed: 392 additions & 81 deletions

File tree

documents/إرشادات إستعمال ألف.md

Lines changed: 283 additions & 33 deletions
Large diffs are not rendered by default.

documents/ما الجديد.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,11 +730,11 @@
730730
# ['السلام', ' عليكم', ' ورحمة, الله']
731731
```
732732

733-
15- إضافة دالة اقسم() للنص حيث تقوم بتقسيم النص إلى ثلاث اجزاء بالنسبة للمعامل الممرر.
733+
15- إضافة دالة قسم() للنص حيث تقوم بتقسيم النص إلى ثلاث اجزاء بالنسبة للمعامل الممرر.
734734
مثال:
735735
```
736736
نص = "ملف.لاحقة"
737-
اطبع(نص.اقسم("."))
737+
اطبع(نص.قسم("."))
738738
# ('ملف', '.', 'لاحقة')
739739
```
740740

examples/شريط_التقدم.alif

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
الوقت.غفوة(0.07)
99
اطبع()
1010

11-
اطبع("جاري تحميل الملف ...")
11+
اطبع("جاري تحميل الملف ...")
1212
شريط_التقدم(السابقة="التقدم:", اللاحقة="اكتمل", الطول=51)
1313
اطبع("إكتمل التحميل بنجاح.")

source/AlifCore/Include/Core/AlifCore_SymTable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class SymTableEntry { // 89
8787
unsigned compInlined : 1;
8888
unsigned compIterTarget : 1;
8989
unsigned canSeeClassScope : 1;
90+
unsigned hasDocstring : 1;
9091

9192
AlifIntT compIterExpr{};
9293
AlifSourceLocation loc{};

source/AlifCore/Include/Main/Code.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ class AlifCodeObject ALIFCODE_DEF(1); // 140
123123

124124
#define CO_NO_MONITORING_EVENTS 0x2000000
125125

126+
#define CO_HAS_DOCSTRING 0x4000000 // 180
126127

127128

128129
#define MAXBLOCKS 21
129130

130-
extern AlifTypeObject _alifCodeType_; // 179
131+
extern AlifTypeObject _alifCodeType_; // 189
131132
#define ALIFCODE_CHECK(_op) ALIF_IS_TYPE((_op), &_alifCodeType_)
132133

133134

source/AlifCore/Include/Main/FrozenModules/GetPath.h

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -241,32 +241,32 @@ const unsigned char _ALIF_M__GetPath[] = {
241241
99,1,0,0,0,0,0,0,0,1,0,0,0,4,0,0,
242242
0,7,0,0,0,115,108,0,0,0,92,0,92,1,149,0,
243243
80,0,37,0,0,0,0,0,0,0,95,42,0,0,87,1,
244-
0,0,0,0,0,0,0,0,81,1,81,0,48,2,79,1,
244+
0,0,0,0,0,0,0,0,81,1,81,0,48,2,79,0,
245245
23,0,103,8,81,2,16,0,49,0,0,0,0,0,0,0,
246246
49,1,0,0,0,0,0,0,37,0,0,0,0,0,0,0,
247247
95,2,0,0,80,0,33,0,87,3,0,0,0,0,0,0,
248248
0,0,80,0,49,1,0,0,0,0,0,0,106,0,72,49,
249-
0,0,79,0,33,0,40,2,0,0,0,78,99,1,0,0,
250-
0,0,0,0,0,0,0,0,0,7,0,0,0,51,0,0,
251-
0,115,74,0,0,0,58,2,32,0,29,0,149,0,81,0,
252-
16,0,67,23,0,0,107,1,80,2,31,0,87,1,0,0,
253-
0,0,0,0,0,0,80,3,81,1,49,2,0,0,0,0,
254-
0,0,49,1,0,0,0,0,0,0,115,0,149,5,29,0,
255-
72,25,0,0,9,0,29,0,79,0,33,0,51,3,100,1,
256-
40,1,0,0,0,78,40,1,0,0,0,117,17,0,0,0,
257-
216,182,217,133,95,216,167,217,132,217,133,216,179,216,167,216,
258-
177,40,4,0,0,0,117,2,0,0,0,46,48,117,2,0,
259-
0,0,216,182,117,10,0,0,0,216,167,216,174,216,170,216,
260-
168,216,177,117,10,0,0,0,216,179,216,167,216,168,217,130,
261-
216,169,115,4,0,0,0,32,32,128,128,117,16,0,0,0,
262-
60,216,172,216,177,216,175,32,71,101,116,80,97,116,104,62,
263-
117,9,0,0,0,60,103,101,110,101,120,112,114,62,117,38,
264-
0,0,0,216,168,216,173,216,171,95,216,170,216,181,216,167,
265-
216,185,216,175,217,138,46,60,108,111,99,97,108,115,62,46,
266-
60,103,101,110,101,120,112,114,62,34,0,0,0,115,35,0,
267-
0,0,248,233,0,128,0,208,22,95,210,84,94,200,66,145,
268-
122,212,34,51,176,74,192,2,211,34,67,215,23,68,208,23,
269-
68,211,84,94,249,115,4,0,0,0,131,32,35,1,40,2,
249+
0,0,79,1,33,0,40,2,0,0,0,99,1,0,0,0,
250+
0,0,0,0,0,0,0,0,7,0,0,0,51,0,0,0,
251+
115,74,0,0,0,58,2,32,0,29,0,149,0,81,0,16,
252+
0,67,23,0,0,107,1,80,2,31,0,87,1,0,0,0,
253+
0,0,0,0,0,80,3,81,1,49,2,0,0,0,0,0,
254+
0,49,1,0,0,0,0,0,0,115,0,149,5,29,0,72,
255+
25,0,0,9,0,29,0,79,0,33,0,51,3,100,1,40,
256+
1,0,0,0,78,40,1,0,0,0,117,17,0,0,0,216,
257+
182,217,133,95,216,167,217,132,217,133,216,179,216,167,216,177,
258+
40,4,0,0,0,117,2,0,0,0,46,48,117,2,0,0,
259+
0,216,182,117,10,0,0,0,216,167,216,174,216,170,216,168,
260+
216,177,117,10,0,0,0,216,179,216,167,216,168,217,130,216,
261+
169,115,4,0,0,0,32,32,128,128,117,16,0,0,0,60,
262+
216,172,216,177,216,175,32,71,101,116,80,97,116,104,62,117,
263+
9,0,0,0,60,103,101,110,101,120,112,114,62,117,38,0,
264+
0,0,216,168,216,173,216,171,95,216,170,216,181,216,167,216,
265+
185,216,175,217,138,46,60,108,111,99,97,108,115,62,46,60,
266+
103,101,110,101,120,112,114,62,34,0,0,0,115,35,0,0,
267+
0,248,233,0,128,0,208,22,95,210,84,94,200,66,145,122,
268+
212,34,51,176,74,192,2,211,34,67,215,23,68,208,23,68,
269+
211,84,94,249,115,4,0,0,0,131,32,35,1,78,40,2,
270270
0,0,0,117,13,0,0,0,216,170,216,173,217,130,217,130,
271271
95,216,167,217,138,117,19,0,0,0,216,167,216,179,217,133,
272272
95,216,167,217,132,217,133,216,172,217,132,216,175,40,3,0,

source/AlifCore/Objects/ActionHelpers.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,9 @@ ExprTy alifParserEngine_collectCallSeqs(AlifParser* _p, ASDLExprSeq* _a, ASDLSeq
788788
if (stars) totalLen += ASDL_SEQ_LEN(stars);
789789

790790
ASDLExprSeq* args = alifNew_exprSeq(totalLen, _astMem);
791+
if (args == nullptr) {
792+
return nullptr;
793+
}
791794

792795
AlifSizeT i = 0;
793796
for (i = 0; i < argsLen; i++) {
@@ -895,6 +898,9 @@ static ASDLExprSeq* unpackTopLevel_joinedStrs(AlifParser* _p, ASDLExprSeq* _rawE
895898
}
896899

897900
ASDLExprSeq* expressions = alifNew_exprSeq(reqSize, _p->astMem);
901+
if (expressions == nullptr) {
902+
return nullptr;
903+
}
898904

899905
AlifSizeT rawIndex{}, reqIndex = 0;
900906
for (rawIndex = 0; rawIndex < rawSize; rawIndex++) {

source/AlifCore/Objects/AlifCompile.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,8 @@ static AlifIntT compute_codeFlags(AlifCompiler* _c) {
12951295
flags |= CO_VARARGS;
12961296
if (ste->varKeywords)
12971297
flags |= CO_VARKEYWORDS;
1298+
if (ste->hasDocstring)
1299+
flags |= CO_HAS_DOCSTRING;
12981300
}
12991301

13001302
if (ste->coroutine and !ste->generator) {

source/AlifCore/Objects/Codegen.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,37 +1229,36 @@ static AlifIntT codegen_functionBody(AlifCompiler* _c, StmtTy _s,
12291229
RETURN_IF_ERROR(
12301230
codegen_enterScope(_c, name, scopeType, (void*)_s, _firstLineNo, nullptr, &umd));
12311231

1232-
AlifSizeT first_instr = 0;
1232+
AlifSizeT firstInstr = 0;
12331233
AlifObject* docstring = alifAST_getDocString(body);
12341234
if (docstring) {
1235-
first_instr = 1;
1235+
firstInstr = 1;
12361236
/* add docstring */
12371237
//docstring = _alifCompile_cleanDoc(docstring);
12381238
//if (docstring == nullptr) {
12391239
// compiler_exitScope(_c);
12401240
// return ERROR;
12411241
//}
1242+
AlifSizeT idx = _alifCompiler_addConst(_c, docstring);
1243+
ALIF_DECREF(docstring);
1244+
RETURN_IF_ERROR_IN_SCOPE(_c, idx < 0 ? ERROR : SUCCESS);
12421245
}
12431246

1244-
AlifSizeT idx = _alifCompiler_addConst(_c, docstring ? docstring : ALIF_NONE);
1245-
ALIF_XDECREF(docstring);
1246-
RETURN_IF_ERROR_IN_SCOPE(_c, idx < 0 ? ERROR : SUCCESS);
1247-
12481247
NEW_JUMP_TARGET_LABEL(_c, start);
12491248
USE_LABEL(_c, start);
12501249
SymTableEntry* ste = SYMTABLE_ENTRY(_c);
1251-
bool add_stopiteration_handler = ste->coroutine or ste->generator;
1252-
if (add_stopiteration_handler) {
1250+
bool addStopIterationHandler = ste->coroutine or ste->generator;
1251+
if (addStopIterationHandler) {
12531252
RETURN_IF_ERROR(
12541253
_alifCompiler_pushFBlock(_c, _noLocation_,
12551254
AlifCompileFBlockType::Compiler_FBlock_Stop_Iteration,
12561255
start, NO_LABEL, nullptr));
12571256
}
12581257

1259-
for (AlifSizeT i = first_instr; i < ASDL_SEQ_LEN(body); i++) {
1258+
for (AlifSizeT i = firstInstr; i < ASDL_SEQ_LEN(body); i++) {
12601259
VISIT_IN_SCOPE(_c, Stmt, (StmtTy)ASDL_SEQ_GET(body, i));
12611260
}
1262-
if (add_stopiteration_handler) {
1261+
if (addStopIterationHandler) {
12631262
RETURN_IF_ERROR_IN_SCOPE(_c, codegen_wrapInStopIterationHandler(_c));
12641263
_alifCompiler_popFBlock(_c, AlifCompileFBlockType::Compiler_FBlock_Stop_Iteration, start);
12651264
}

source/AlifCore/Objects/FuncObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ AlifObject* alifFunction_newWithQualName(AlifObject* _code,
100100

101101
AlifObject* consts = codeObj->consts;
102102
AlifObject* doc{};
103-
if (alifTuple_size(consts) >= 1) {
103+
if (codeObj->flags & CO_HAS_DOCSTRING) {
104104
doc = alifTuple_getItem(consts, 0);
105105
if (!ALIFUSTR_CHECK(doc)) {
106106
doc = ALIF_NONE;

0 commit comments

Comments
 (0)