[antlr-interest] How can I define a token from a directory content ?
Markus
grey_earl at web.de
Fri Sep 19 06:49:12 PDT 2008
> Hi,
>
> I'm currently using Antlr3 to develop a command line tool.
> One of this command consists in executing the content of a command file.
> The associated rule will look like this:
>
> execFileRule: EXEC FILENAME;
>
> My problem is that possible values for "FILENAME" can not be given in a
> static manner (i.e.: FILENAME: "file1.txt" | "file2.txt" | "file3.txt";),
> as they depend on the content of a specific directory at the moment the
> command is entered.
>
> How can I manage this ?
>
> Thanks,
> Helene
You can use a generic IDENTIFIER token and then check with either a predicate
or in a verification (read: tree grammar) pass that the generic IDENTIFIER
token corresponds to a real filename.
Markus
More information about the antlr-interest
mailing list