Guess if .r is R or REBOL

.r is the default extension used widely for both, R and REBOL. This
patch attempts to guess if .r is a REBOL file by looking for the
following very common REBOL code fragments:

- `REBOL`
- `: func [`
- `make object! [`
- `context [`

If any of those is found in a .r file, it is identified as a REBOL file.
Otherwise the language for a .r file is R.

Signed-off-by: Andreas Bolka <a@bolka.at>
This commit is contained in:
Andreas Bolka
2011-06-29 01:37:30 +02:00
parent 521bb9b9b2
commit 2707d1db67
4 changed files with 29 additions and 0 deletions

5
test/fixtures/hello-rebol.r vendored Normal file
View File

@@ -0,0 +1,5 @@
REBOL []
hello: func [] [
print "hello, world!"
]
hello