Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grammar GramaticaEnvolventesExternas;
- @members {
- String stringTemp;
- int valorElevacaoInferior = 200;
- int valorElevacaoSuperior = 400;
- int valorDiferencaElevacaoInferior = 130;
- int valorDiferencaElevacaoSuperior = 350;
- int valorDistanciaPeInferior = 1;
- int valorDistanciaPeSuperior = 4;
- int valorDistanciaAutomovelInferior = 10;
- int valorDistanciaAutomovelSuperior = 85;
- int valorTempoViagemPeInferior = 10;
- int valorTempoViagemPeSuperior = 40;
- int valorTempoViagemAutomovelInferior = 25;
- int valorTempoViagemAutomovelSuperior = 70;
- }
- inicial returns [String return_value] : VALOR_NUMERICO WS tipoOptional {$return_value = $tipoOptional.return_value;};
- tipoOptional returns [String return_value] : elevacao
- {stringTemp = $elevacao.return_value;
- if (stringTemp != null) {
- $return_value = $elevacao.return_value;
- }}
- | diferenca_elevacao
- {stringTemp = $diferenca_elevacao.return_value;
- if (stringTemp != null) {
- $return_value = $diferenca_elevacao.return_value;
- }}
- | distancia_pe
- {stringTemp = $distancia_pe.return_value;
- if (stringTemp != null) {
- $return_value = $distancia_pe.return_value;
- }}
- | distancia_automovel
- {stringTemp = $distancia_automovel.return_value;
- if (stringTemp != null) {
- $return_value = $distancia_automovel.return_value;
- }}
- | tempo_viagem_pe
- {stringTemp = $tempo_viagem_pe.return_value;
- if (stringTemp != null) {
- $return_value = $tempo_viagem_pe.return_value;
- }}
- | tempo_viagem_automovel
- {stringTemp = $tempo_viagem_automovel.return_value;
- if (stringTemp != null) {
- $return_value = $tempo_viagem_automovel.return_value;
- }};
- elevacao returns [String return_value] : 'elevacao' {
- if (VALOR_NUMERICO < valorElevacaoInferior) {
- $return_value = "Baixo";
- } else if (VALOR_NUMERICO > valorElevacaoSuperior) {
- $return_value = "Alto";
- } else {
- $return_value = "Medio";
- }
- };
- diferenca_elevacao returns [String return_value] : 'diferencaElevacao' {
- if (VALOR_NUMERICO < valorDiferencaElevacaoInferior) {
- $return_value = "Baixo";
- } else if (VALOR_NUMERICO > valorDiferencaElevacaoSuperior) {
- $return_value = "Alto";
- } else {
- $return_value = "Medio";
- }
- };
- distancia_pe returns [String return_value] : 'distanciaPe' {
- if (VALOR_NUMERICO < valorDistanciaPeInferior) {
- ((Distancia_peContext)_localctx).return_value = "Baixo";
- } else if (VALOR_NUMERICO > valorDistanciaPeSuperior) {
- ((Distancia_peContext)_localctx).return_value = "Alto";
- } else {
- ((Distancia_peContext)_localctx).return_value = "Medio";
- }
- };
- distancia_automovel returns [String return_value] : 'distanciaAutomovel' {
- if (VALOR_NUMERICO < valorDistanciaAutomovelInferior) {
- $return_value = "Baixo";
- } else if (VALOR_NUMERICO > valorDistanciaAutomovelSuperior) {
- $return_value = "Alto";
- } else {
- $return_value = "Medio";
- }
- };
- tempo_viagem_pe returns [String return_value] : 'tempoViagemPe' {
- if (VALOR_NUMERICO < valorTempoViagemPeInferior) {
- $return_value = "Baixo";
- } else if (VALOR_NUMERICO > valorTempoViagemPeSuperior) {
- $return_value = "Alto";
- } else {
- $return_value = "Medio";
- }
- };
- tempo_viagem_automovel returns [String return_value] : 'tempoViagemAutomovel' {
- if (VALOR_NUMERICO < valorTempoViagemAutomovelInferior) {
- $return_value = "Baixo";
- } else if (VALOR_NUMERICO > valorTempoViagemAutomovelSuperior) {
- $return_value = "Alto";
- } else {
- $return_value = "Medio";
- }
- };
- VALOR_NUMERICO : [0-9]+'.'[0-9]+ | [0-9]+;
- WS: (' ' | '\t')+;
- NL: '\r'? '\n';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement