[antlr-interest] A tip to execute the "java.exe antlr.Tool" command from the Explorer

anthony_breneliere <abreneliere at telys.com> abreneliere at telys.com
Sat Jan 25 10:47:44 PST 2003


A tip to transform you grammar file with one doucle-click from the 
Windows Explorer : 

1. Ensure the java.exe is in the system32 directory (or change the 
sJavaDir init value in the script)

2. Ensure the %classpath% environment variable is correctly 
configured.

3. Save that script in a .vbs text file, then execute it !

----------------
Option Explicit

Dim oShell
Dim sJavaDir, sClassPath, sCommand

Set oShell = CreateObject("WScript.Shell")

sJavaDir = _
    oShell.ExpandEnvironmentStrings("%SystemRoot%") & "\System32" 

sClassPath = _
    oShell.ExpandEnvironmentStrings("%classpath%")

sCommand = sJavaDir & "\java.exe -cp " & sClassPath & _
    " antlr.Tool " & Chr(34) & "%1" & Chr(34)

oShell.RegWrite "HKCR\.g\shell\Command\", "Compile &ANTLR grammar" 
oShell.RegWrite "HKCR\.g\shell\Command\command\", sCommand
----------------

4. Right-click on a .g file to test if it works !

If the %classpath% env variable changes, just execute that script 
again.

Cordially,
Anthony




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list