نسخ السجلات المسماة وتعديلها
لبات 0.7.0 · الإصدار الحالي
مصدر مورّد كامل وتجهيز ونتائج مفحوصة لـلبات 0.7.0.
محتويات الصفحة
الغرض والتجهيز
المتصفح والمضيف الأصلي، لبات 0.7.0. يفحص الحقول واستقلال النسخة المتداخلة وحمولة نتيجة سجل. يطبع 3 tokens بالحالة 0.
اقرأ المرجع الحالي. لا تلزم وحدة مصدر أو مكتبة خارجية.
المصدر العربي
يفتح هذا المصدر الكامل المورّد مسودة جديدة. جهز المدخلات والملفات المعلنة في تلك المسودة ثم اختر التشغيل صراحة.
التنفيذ: المتصفح والمضيف الأصلي · لبات 0.7.0
- لا يتطلب معرفة سابقة لفتحه وفحصه.
الإدخال: لا يحتاج إلى أسطر إدخال.
سجل رمز { نوع: ص64, متن: نص, سطر: ص64, عمود: ص64 }
سجل حالة_محلل { رموز: قائمة<رمز>, مؤشر: ص64 }
دالة رمز_الحالة(حالة: حالة_محلل) -> رمز {
أرجع حالة::رموز[حالة::مؤشر].
}
دالة ابدأ_الرئيسية() -> ص64 {
دع زائد: رمز = رمز { نوع: 1, متن: "+" , سطر: 2, عمود: 7 }.
إذا (زائد::نوع لا يطابق 1) { أرجع 1. }
إذا (زائد::متن لا يطابق "+") { أرجع 2. }
إذا (زائد::سطر لا يطابق 2) { أرجع 3. }
إذا (زائد::عمود لا يطابق 7) { أرجع 4. }
متغير حالة: حالة_محلل = حالة_محلل { رموز: [زائد], مؤشر: 0 }.
إذا (رمز_الحالة(حالة)::متن لا يطابق "+") { أرجع 5. }
متغير منقولة: حالة_محلل = حالة.
منقولة::مؤشر = 1.
إذا (حالة::مؤشر لا يطابق 0) { أرجع 6. }
إذا (منقولة::مؤشر لا يطابق 1) { أرجع 7. }
منقولة::رموز[0]::عمود = 9.
إذا (حالة::رموز[0]::عمود لا يطابق 7) { أرجع 8. }
إذا (منقولة::رموز[0]::عمود لا يطابق 9) { أرجع 9. }
دع موجود: نتيجة<رمز> = نجاح(زائد).
إذا (موجود::نجاح) {
إذا (موجود::قيمة::سطر لا يطابق 2) { أرجع 10. }
} وإلا {
أرجع 11.
}
اطبع("3 tokens").
أرجع 0.
}
النتائج المتوقعة
{
"browser": {
"check": "success",
"class": "success",
"output": "3 tokens",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "3 tokens"
}
}المصدر الإنجليزي
يفتح هذا المصدر الكامل المورّد مسودة جديدة. جهز المدخلات والملفات المعلنة في تلك المسودة ثم اختر التشغيل صراحة.
التنفيذ: المتصفح والمضيف الأصلي · لبات 0.7.0
- لا يتطلب معرفة سابقة لفتحه وفحصه.
الإدخال: لا يحتاج إلى أسطر إدخال.
record code { type_name: i64, text: string, line: i64, column: i64 }
record parser_state { codes: list<code>, index: i64 }
fn status_code(status: parser_state) -> code {
return status::codes[status::index];
}
fn start_main() -> i64 {
let increment: code = code { type_name: 1, text: "+" , line: 2, column: 7 };
if (increment::type_name not match 1) { return 1; }
if (increment::text not match "+") { return 2; }
if (increment::line not match 2) { return 3; }
if (increment::column not match 7) { return 4; }
var status: parser_state = parser_state { codes: [increment], index: 0 };
if (status_code(status)::text not match "+") { return 5; }
var moved: parser_state = status;
moved::index = 1;
if (status::index not match 0) { return 6; }
if (moved::index not match 1) { return 7; }
moved::codes[0]::column = 9;
if (status::codes[0]::column not match 7) { return 8; }
if (moved::codes[0]::column not match 9) { return 9; }
let exists: result<code> = success(increment);
if (exists::ok) {
if (exists::value::line not match 2) { return 10; }
} else {
return 11;
}
print("3 tokens");
return 0;
}
النتائج المتوقعة
{
"browser": {
"check": "success",
"class": "success",
"output": "3 tokens",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "3 tokens"
}
}المصدر المختلط
يفتح هذا المصدر الكامل المورّد مسودة جديدة. جهز المدخلات والملفات المعلنة في تلك المسودة ثم اختر التشغيل صراحة.
التنفيذ: المتصفح والمضيف الأصلي · لبات 0.7.0
- لا يتطلب معرفة سابقة لفتحه وفحصه.
الإدخال: لا يحتاج إلى أسطر إدخال.
record Token { kind: ص64, text: نص, line: ص64, column: i64 }
سجل ParserState { tokens: قائمة<Token>, cursor: ص64 }
fn token_at(state: ParserState) -> Token {
return state::tokens[state::cursor];
}
fn ابدأ_الرئيسية() -> ص64 {
دع plus: Token = Token { kind: 1, text: "+", line: 2, column: 7 }.
if (plus::kind not match 1) { return 1; }
إذا (plus::text not match "+") { أرجع 2. }
if (plus::line not match 2) { return 3; }
إذا (plus::column not match 7) { أرجع 4. }
var state: ParserState = ParserState { tokens: [plus], cursor: 0 };
إذا (token_at(state)::text not match "+") { أرجع 5. }
var moved: ParserState = state.
moved::cursor = 1.
if (state::cursor not match 0) { return 6; }
إذا (moved::cursor not match 1) { أرجع 7. }
moved::tokens[0]::column = 9.
if (state::tokens[0]::column not match 7) { return 8; }
إذا (moved::tokens[0]::column not match 9) { أرجع 9. }
let found: نتيجة<Token> = success(plus).
if (found::نجاح) {
إذا (found::value::line not match 2) { أرجع 10. }
} وإلا {
return 11;
}
print("3 tokens");
return 0;
}
النتائج المتوقعة
{
"browser": {
"check": "success",
"class": "success",
"output": "3 tokens",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "3 tokens"
}
}افحص النتيجة
تعرض بطاقات المصدر مدخلات الفهرس ونتائجه الدقيقة. لا يترجم تغيير اللغة المصدر المورّد. يحفظ التنزيل بايتات المصدر الأصلية.