Done flights parsing?
This commit is contained in:
parent
d027ad2b21
commit
a617ddf11c
|
@ -45,12 +45,12 @@ static int scan(struct flights *const f,
|
||||||
re2c:define:YYGETCONDITION:naked = 1;
|
re2c:define:YYGETCONDITION:naked = 1;
|
||||||
re2c:define:YYSETCONDITION:naked = 1;
|
re2c:define:YYSETCONDITION:naked = 1;
|
||||||
|
|
||||||
//unix_control = [\x01-\x08\x0b-\x1f\x7f];
|
|
||||||
ws = [ \t];
|
ws = [ \t];
|
||||||
glyph = [^\x00-\x20\x7f]; // [^\x00\n\t ] + all weird
|
glyph = [^\x00-\x20\x7f]; // [^\x00\n\t ] + all weird
|
||||||
semitext = glyph \ ";";
|
semitext = glyph \ ";";
|
||||||
natural = [1-9][0-9]*;
|
natural = [1-9][0-9]*;
|
||||||
minutes = [0-5][0-9];
|
minutes = [0-5][0-9];
|
||||||
|
zero_natural = natural | "0";
|
||||||
airport = [A-Z0-9]{4,4};
|
airport = [A-Z0-9]{4,4};
|
||||||
*/
|
*/
|
||||||
for( ; ; ) { /*!re2c /**/
|
for( ; ; ) { /*!re2c /**/
|
||||||
|
@ -126,12 +126,12 @@ static int scan(struct flights *const f,
|
||||||
=> glider_remarks { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
=> glider_remarks { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
||||||
&flight->glider.instr_min)) { why = "instr time"; goto catch; }
|
&flight->glider.instr_min)) { why = "instr time"; goto catch; }
|
||||||
continue; }
|
continue; }
|
||||||
<glider_remarks> ws* @s0 glyph+ (ws+ glyph+)* @s1 "\n" => line
|
|
||||||
{ flight->glider.remarks.a = s0, flight->glider.remarks.b = s1;
|
|
||||||
flight = 0; line++; continue; }
|
|
||||||
<glider_remarks> ws* "\n" => line
|
<glider_remarks> ws* "\n" => line
|
||||||
{ flight->glider.remarks.a = flight->glider.remarks.b = 0;
|
{ flight->glider.remarks.a = flight->glider.remarks.b = 0;
|
||||||
flight = 0; line++; continue; }
|
flight = 0; line++; continue; }
|
||||||
|
<glider_remarks> ws* @s0 glyph+ (ws+ glyph+)* @s1 "\n" => line
|
||||||
|
{ flight->glider.remarks.a = s0, flight->glider.remarks.b = s1;
|
||||||
|
flight = 0; line++; continue; }
|
||||||
|
|
||||||
/* And this . . . */
|
/* And this . . . */
|
||||||
<line> "[flight]" :=> flight_type
|
<line> "[flight]" :=> flight_type
|
||||||
|
@ -179,16 +179,34 @@ static int scan(struct flights *const f,
|
||||||
flight->power.copilot.b = s1; continue; }
|
flight->power.copilot.b = s1; continue; }
|
||||||
<flight_dual> ws* ";" => flight_pilot
|
<flight_dual> ws* ";" => flight_pilot
|
||||||
{ flight->power.dual_min = 0; continue; }
|
{ flight->power.dual_min = 0; continue; }
|
||||||
<flight_dual> ws* @s0 natural? @s1 "." @t0 [0-9] @t1 "h" ws* ";"
|
<flight_dual> ws* @s0 zero_natural? @s1 "." @t0 [0-9] @t1 "h" ws* ";"
|
||||||
=> flight_pilot { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
=> flight_pilot { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
||||||
&flight->power.dual_min)) { why = "dual time"; goto catch; }
|
&flight->power.dual_min)) { why = "dual time"; goto catch; }
|
||||||
continue; }
|
continue; }
|
||||||
<flight_pilot> ws* ";" => flight_ifrsim
|
<flight_pilot> ws* ";" => flight_ifrsim
|
||||||
{ flight->power.pilot_min = 0; continue; }
|
{ flight->power.pilot_min = 0; continue; }
|
||||||
<flight_pilot> ws* @s0 natural? @s1 "." @t0 [0-9] @t1 "h" ws* ";"
|
<flight_pilot> ws* @s0 zero_natural? @s1 "." @t0 [0-9] @t1 "h" ws* ";"
|
||||||
=> flight_ifrsim { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
=> flight_ifrsim { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
||||||
&flight->power.pilot_min)) { why = "pilot time"; goto catch; }
|
&flight->power.pilot_min)) { why = "pilot time"; goto catch; }
|
||||||
continue; }
|
continue; }
|
||||||
|
<flight_ifrsim> ws* ";" => flight_ifr
|
||||||
|
{ flight->power.ifrsim_min = 0; continue; }
|
||||||
|
<flight_ifrsim> ws* @s0 zero_natural? @s1 "." @t0 [0-9] @t1 "h" ws* ";"
|
||||||
|
=> flight_ifr { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
||||||
|
&flight->power.ifrsim_min)) { why = "simulated ifr time";
|
||||||
|
goto catch; } continue; }
|
||||||
|
<flight_ifr> ws* ";" => flight_remarks
|
||||||
|
{ flight->power.ifr_min = 0; continue; }
|
||||||
|
<flight_ifr> ws* @s0 zero_natural? @s1 "." @t0 [0-9] @t1 "h" ws* ";"
|
||||||
|
=> flight_remarks { if(!pair_hours_to_minutes(s0, s1, t0, t1,
|
||||||
|
&flight->power.ifr_min)) { why = "pilot time"; goto catch; }
|
||||||
|
continue; }
|
||||||
|
<flight_remarks> ws* "\n" => line
|
||||||
|
{ flight->power.remarks.a = flight->power.remarks.b = 0;
|
||||||
|
flight = 0; line++; continue; }
|
||||||
|
<flight_remarks> ws* @s0 glyph+ (ws+ glyph+)* @s1 "\n" => line
|
||||||
|
{ flight->power.remarks.a = s0, flight->power.remarks.b = s1;
|
||||||
|
flight = 0; line++; continue; }
|
||||||
*/ }
|
*/ }
|
||||||
assert(0); /* Never gets here. */
|
assert(0); /* Never gets here. */
|
||||||
catch:
|
catch:
|
||||||
|
|
Loading…
Reference in New Issue