|
2003-11-13
| ||
| 06:07 | • Ticket [219275ffff] Compiler support for custom preprocessors written in Tcl... artifact: b2b78e7092 user: dgp | |
|
2001-06-26
| ||
| 05:35 | • Ticket [219275ffff]: 1 change artifact: e4898ea1f2 user: dkf | |
|
2001-04-04
| ||
| 04:43 | • Ticket [219275ffff]: 1 change artifact: c792d98e13 user: dgp | |
|
2001-01-31
| ||
| 17:58 | • Ticket [219275ffff]: 5 changes artifact: 882a2b98fc user: dkf | |
|
2000-12-10
| ||
| 10:09 | • Ticket [219275ffff]: 1 change artifact: 7a361e5b3c user: hobbs | |
|
2000-10-26
| ||
| 05:09 | • New ticket [219275ffff]. artifact: 993159f8e3 user: nobody | |
Compiler support for custom preprocessors written in Tcl
Deleted219275ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 23 years ago
Descriptionplain2000-10-26 05:09:44
OriginalBugID: 1709 RFE Version: 8.0.5 SubmitDate: '1999-04-05' LastModified: '1999-04-05' Severity: LOW Status: UnAssn Submitter: pat ChangedBy: pat OS: All OSVersion: NA Machine: NA FixedDate: '2000-10-25' FixedInVersion: NA ClosedDate: '2000-10-25' Name: Alexandre FERRIEUX email: [email protected] Support: None Synopsis: Compiler support for custom preprocessors written in Tcl DesiredBehavior: A modification of the bytecode-compiler that would allow people to add their own preprocessing step, even written in Tcl. Obvious application: bang-comments. Proponents of the approach could test it out for themselves. Explanation: the idea would be to give a '<<'-like capability to Tcl commands (now it is restricted to child processes), so that we could hand *any* kind of text garbage in-line to an arbitrary Tcl command: inlinedata -until EOFEOFEOF myproc hey boys this is unrestricted {{{{{{{ text]]]]]]] ! EOFEOFEOF The example above would call myproc with the text as a single string argument. The key is that 'inlinedata' has to be known by the compiler, so that it takes the new delimiter syntax into account immediately. Of course, this can only happen if the stream is being compiled as code at this point, so it's necessarily at toplevel of a script file or of an evalled (uplevelled) string; however it is very flexible since it allows any kind of preprocessing to be written and tested in pure Tcl ! For example, the bang comment: proc nobangs s { regsub -all "\n\[ \t\]*!\[^\n\]*" \n$s "" s uplevel $s } inlinedata nobangs ;# without -until, goes to end of current script ! Ha, this one works: }}} ! Just as a #. No big deal proc butthisone {} { ! is more }}}}} ! impressive indeed ]]]] puts yes } Notice also that the natural restriction of the scope allows to avoid many backward compatibility problems (especially ominous in the bang case), since the preprocessing can be done on a per-script or even per-procedure basis. Comments: This idea has already been posted in the kilometer-long braces-in-comment thread, but Jeff Hobbs pointed out that it was off-topic there and could easily be overlooked...
hobbs Ticket [219275ffff]: 1 change
[History diff]2000-12-10 10:09:07
dkfplain2001-01-31 17:58:13
This can now be done in pure Tcl by writing a procedure that updates the name of the loaded file, [read]s in the script to process, performs the processing, and then passes it to [eval] or [uplevel #0].
dgp Ticket [219275ffff]: 1 change
[History diff]2001-04-04 04:43:27
dkf Ticket [219275ffff]: 1 change
[History diff]2001-06-26 05:35:42
dgp Ticket [219275ffff]: 1 change
[History diff]2003-11-13 06:07:33
Log in (anonymous is fine) to add a comment.