[antlr-interest] File modification and preservation of comments

Ciaran Treanor ciaran.treanor at gmail.com
Fri Aug 5 07:03:56 PDT 2005


Hi, I'm new to antlr and I was hoping to get a bit of a jumpstart from you guys.

I've got a file that's structured a bit like the following:

AAAA {
  name1 = value1
  name2 = value2
}

BBBB {
  name1 = value1a
  name2 = value2a
}

CCCC {
  A {
    ...
  }
  B  {
    ...
  }
}

(it's a bunch of blocks and sub-blocks)

I'm need to write a command-line tool that will allow a user to modify
the file (instead of having to edit the file in a text editor).

The tool might, for example, allow the user to issue a command that
would cause a new block to be added to the input file or change the
value of an attribute within the input file and then write that file
back to disk.

I'll also need to preserve any comments that may exist within the input file.

Can anyone provide me with some advice on how I should approch solving
this problem?

Thanks a million,
Ciaran


More information about the antlr-interest mailing list