Interface CivlcTokenConstant


public interface CivlcTokenConstant
This class exports the constants for token types from CivlCParser. These are needed currently for transformers when they create new AST nodes and need to make up source object for them. Ultimately, this class will be got rid of when the transformers create intermediate files and generate source object from them. The token constants are just extracted from the ANTLR-generated parser using the following Perl script:
 open(FILE, "fields.txt") || die "could not open fields.txt";
 while (defined($line=)) {
   chomp($line);
   ($pre, $name, $num) = ($line =~ /^(\s*public\s*static\s*final\s*int\s*)(.*)=(.*)\;$/);
   # print "$pre $name $num\n";
   print "$pre","$name = CivlCParser.$name;\n";
 }
 close(FILE);
 
I thought this approach would be better than exporting the entire ANTLR-generated parser; I don't want other code in ABC or elsewhere tied so totally to the generated code. On the other hand, other code does need to access these constants.