1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

multiple languages support via file extension or #lang header

From scripts/compile pushed default assumption of #:from as 'scheme down
into system/base/compile where filename and first line can be used to
deduce intended "from" language.  If first line of a file is of the form
  #lang ecmascript
then the file is assumed consist of source language "ecmascript".

* module/scripts/compile.scm (compile): changed default #:from to #f
  from 'scheme

* module/system/base/compile.scm(lang-from-port, %file-extension-map,
  add-lang-extension, lang-extension-for): added global
  %file-extension-map with accessor lang-extension-for and updater
  add-lang-extension.  Also, added lang-from-port to parse  first line,
  looking for #lang.

* test-suite/tests.scm: added "load-lang" test.

* test-suite/Makefile.am(SCM_TESTS): added tests/load-lang.test
This commit is contained in:
Matt Wette 2022-02-13 14:43:29 -08:00 committed by Arne Babenhauserheide
parent ff165ec904
commit a12ca2b999
4 changed files with 108 additions and 6 deletions

View file

@ -209,7 +209,7 @@ There is NO WARRANTY, to the extent permitted by law.~%"))
(('optimizations . opts) opts)
(_ '())))
options)))
(from (or (assoc-ref options 'from) 'scheme))
(from (assoc-ref options 'from))
(to (or (assoc-ref options 'to) 'bytecode))
(target (or (assoc-ref options 'target) %host-type))
(input-files (assoc-ref options 'input-files))