Copy and update named records
ASPL 0.7.0 · Current release
Complete supplied source, preparation, and checked ASPL 0.7.0 outcomes.
On this page
Purpose and preparation
Browser and native, ASPL 0.7.0. Checks fields, nested copy independence, and a record result payload. Prints 3 tokens with status 0.
See the current reference. No source module or external library is required.
Arabic source
This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.
Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
سجل رمز { نوع: ص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.
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "3 tokens",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "3 tokens"
}
}English source
This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.
Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
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;
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "3 tokens",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "3 tokens"
}
}Mixed source
This supplied complete source opens a new draft. Prepare the declared inputs/files in that draft, then select Run explicitly.
Execution: Browser and native · ASPL 0.7.0
- No prior knowledge is required to open and check it.
Input: No input lines are required.
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;
}
Expected outcomes
{
"browser": {
"check": "success",
"class": "success",
"output": "3 tokens",
"processStatus": 0
},
"native": {
"check": 0,
"status": 0,
"output": "3 tokens"
}
}Check the result
The source cards show the catalog's exact inputs and outcomes. Locale changes do not translate the supplied source. Download retains original source bytes.