Browse Source

fix AGL/AMSL token handling

master
Marc 11 years ago
parent
commit
f08381b5f7
  1. 18
      grammar/OpenAir.g
  2. 10
      grammar/OpenAirWalker.g

18
grammar/OpenAir.g

@ -25,10 +25,6 @@ tokens {
FLEVEL : 'FL' '0'..'9'+
;
ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
;
COORDS
: '0'..'9'+ ' '* ':' ' '* '0'..'9'+ ' '* (':'|'.') ' '* '0'..'9'+ ' '* ('N'|'S'|'n'|'s')
' '* '0'..'9'+ ' '* ':' ' '* '0'..'9'+ ' '* (':'|'.') ' '* '0'..'9'+ ' '* ('E'|'W'|'e'|'w')
@ -46,7 +42,13 @@ FLOAT
AN_NAME
: 'AN' ~('\n'|'\r')* '\r'? '\n'
;
AGL : ('AGL')|('ASFC');
AMSL: ('ASL')|('AMSL');
ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
;
COMMENT
: '//' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
| '*' ~('\n'|'\r')* '\r'? '\n' {$channel=HIDDEN;}
@ -95,10 +97,8 @@ frag_alti
altitude_specif
:
frag_alti 'AGL' -> ^(ALTI frag_alti 'AGL')
| frag_alti 'ASFC' -> ^(ALTI frag_alti 'AGL')
| frag_alti 'AMSL' -> ^(ALTI frag_alti 'AMSL')
| frag_alti 'ASL' -> ^(ALTI frag_alti 'AMSL')
frag_alti AGL -> ^(ALTI frag_alti AGL)
| frag_alti AMSL -> ^(ALTI frag_alti AMSL)
| FLEVEL -> ^(ALTI FLEVEL)
| 'UNL' -> ^(ALTI 'UNL')
| 'GND' -> ^(ALTI 'SFC')

10
grammar/OpenAirWalker.g

@ -85,11 +85,11 @@ altitude_specif returns [altispecif]
$altispecif = {}
}
:
^(ALTI frag_alti (r='AGL'|r='AMSL')
{
$altispecif['basealti']=$frag_alti.absalti
$altispecif['ref'] = $r.text
})
^(ALTI frag_alti {
$altispecif['basealti']=$frag_alti.absalti
} (AGL {$altispecif['ref'] = 'AGL'} |
AMSL {$altispecif['ref']='AMSL'})
)
| ^(ALTI 'SFC' {$altispecif['fromground'] = True})
| ^(ALTI FLEVEL {$altispecif['flevel']=int($FLEVEL.text[2:])})
| ^(ALTI 'UNL' {$altispecif['nolimit']=True})

Loading…
Cancel
Save