Browse Source

tree walker. builds, but not tested.

master
Marc 11 years ago
parent
commit
bec1eca1e7
  1. 2
      build-parser.sh
  2. 69
      grammar/OpenAirWalker.g

2
build-parser.sh

@ -17,4 +17,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
mkdir -p python/generated
cd grammar && java -jar /home/marc/local/stow/antlr3.3/antlr-3.3-complete.jar -o ../python/generated/ OpenAir.g && cd -
cd grammar && java -jar /home/marc/local/stow/antlr3.3/antlr-3.3-complete.jar -o ../python/generated/ OpenAir.g && java -jar /home/marc/local/stow/antlr3.3/antlr-3.3-complete.jar -o ../python/generated/ OpenAirWalker.g && cd -

69
grammar/OpenAirWalker.g

@ -0,0 +1,69 @@
tree grammar OpenAirWalker;
options {
tokenVocab=OpenAir;
ASTLabelType=CommonTree;
backtrack=true;
memoize=true;
output=AST;
language=Python;
}
oair_file
: ^(ZONES zone+)
;
zone
: ^(ZONE aclass name ceiling floor ^(GEOMETRY geometry))
;
aclass : ^(CLASS ('A'|'C'|'CTR'|'D'|'E'|'GP'|'P'|'Q'|'R'|'W'))
;
name : ^(NAME AN_NAME)
;
ceiling : altitude_specif
;
floor : altitude_specif
;
frag_alti
: ^(BASE_ALTI INT ('F'|'M'))
;
altitude_specif
:
^(ALTI frag_alti ('AGL'|'AMSL'|'SFC'))
| ^(ALTI frag_alti? 'SFC')
| ^(ALTI FLEVEL)
| ^(ALTI 'UNL')
;
geometry
:
(single_point | circle_arc)*
| circle
;
single_point
: COORDS
;
circle_direction
: ('+'|'-')
;
circle_center
: COORDS
;
circle_arc
: ^(CIRCLE_ARC circle_center COORDS COORDS circle_direction?)
;
circle
:
^(CIRCLE circle_center (INT | FLOAT))
;
Loading…
Cancel
Save