[antlr-interest] Filtering using ANTLR

Vara Prasad merupo at yahoo.com
Thu May 17 07:55:31 PDT 2007


Hi All,
  I am some what new to ANTLR.
  I would like to know how to use filtering using
ANTLR.I saw example provided in examples,but i did not
get much out of that.
  Currently am writing java parser using ANTLR(2.7.7).
  I am parsing  large text file and get desired
contents based on rules that i defined in my grammar
file. 
  Any help/suggestions will be greately appreciated.

Thanks In Advance,
-Prasad

example:
 I've following content in my input file for my parser
i would like to extract only following segment. 

crypto
 ip-address-pool 22.0.0.0 255.255.0.0
exit

Input file content:
===================

interface ethernet 13/1
 ip address 31.1.1.77 255.255.0.0
 next-hop common 31.1.1.88
  shaping-class unc
   egress-queue unc-green
   egress-queue unc-yellow
  exit
  shaping-class mgw
   egress-queue mgw-green
   egress-queue mgw-yellow
  exit
  shaping-class ggw
   egress-queue ggw-green
   egress-queue ggw-yellow
  exit
  shaping-class default
   egress-queue DefaultEgressQueue
  exit
 exit
exit
clock
 timezone -5
 sntp server 72.1.1.29
 sntp interval 1 hours
 time-sync sntp
exit
crypto
 ip-address-pool 22.0.0.0 255.255.0.0
exit
high-availability
 no auto takeover
 node Primary
  interface ha-2 ip address 10.6.2.53
  interface ha-1 ip address 1.1.1.53
 exit
 node Secondary
  interface ha-2 ip address 10.6.2.52
  interface ha-1 ip address 1.1.1.52
 exit
 interface group Public
  interface ethernet 15/1
  interface ethernet 1/1
 exit
 interface group Private
  interface ethernet 13/1
  interface ethernet 3/1
 exit
exit 


 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front


More information about the antlr-interest mailing list