1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

18 commits

Author SHA1 Message Date
Robin Templeton
e4464967f7 read nil/t as #nil/#t
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/lexer.scm (lex): Update to handle #nil / #t.
2016-03-25 12:00:11 -07:00
Robin Templeton
707376055c elisp updates
(Best-ability ChangeLog annotation added by Christopher Allan Webber.)

* module/language/elisp/bindings.scm (get-lexical-binding)
  (get-function-binding): Use cadr instead of fluid-ref on slot.
  (with-fluids**): New procedure.
  (with-symbol-bindings, with-function-bindings): Use with-fluids**.
  Also stop using "make-fluid", use "(list #f #f)" instead as default
  lexical-bindings hashtable value.
  (with-lexical-bindings): Drop the error checking for invalid targets.

* module/language/elisp/boot.el (defun, save-excursion)
  (save-current-buffer, save-restriction, track-mouse, setq-default)
  (catch, condition-case): New macros.
  (omega, eval, gensym, interactive, autoload-do-load, fset, prin1)
  (backtrace-frame, backtrace, %set-eager-macroexpansion-mode): New functions.
  (null, consp, listp, car, cdr, make-symbol, signal): Wrap in eval-and-compile.
  (prog1, cond, or, while): Update to make use of gensym.
  (unwind-protect): Switch from funcall to %funcall.
  (%functionp): Rename from functionp.
  (%indirect-function): Update to use %functionp instead of functionp.
  Add check for if object is null, signaling void-function.  Instead of
  calling symbol-function directly, call via %funcall from the module
  "(language elisp runtime)".
  (fset): Significant additions and refactoring.
  (gload): Renamed from fload.
  (defvaralias, nthcdr, nth, eq): Move functions to a different location.
  (eq): Also stop using null.
  (dolist): Remove quasiquoting, build list manually.
  (random): Fix indentation.
  (progn, eval-when-compile, if, defconst, defvar, setq, let, flet)
  (labels, let*, function, defmacro, quote): Protect as special
  operators by raising error if invoked as a function.

* module/language/elisp/compile-tree-il.scm: Import "(ice-9 format)".
  Export compile-%function.
  (lexical-binding, handle-var-def, defun, valid-symbol-list-arg?)
  (process-options!): Remove.
  (reference-variable): Adjust functions passed to access-variable.
  (global?): Drop module parameter, use value-slot instead.
  (ensure-globals!, set-variable!, parse-body-1, parse-lambda-list)
  (compile-lambda, defconst, defvar, let, let*, compile-pair): Refactor.
  (reference-function): Use '(elisp-functions) instead of function-slot.
  (bind-lexically?): Drop module parameter, simplify.
  (make-dynlet): Switch from using make-primcall to make-call.
  (find-operator): Switch from using resolve-interface/resolve-module
  to using function-slot.
  (if, defconst, defvar, let, let*, flet, labels, guile-ref)
  (guile-private-ref, guile-primitive, defmacro, `, quote, %funcall)
  (%set-lexical-binding-mode): Add error checking.
  (setq): Pass in args to report-error.
  (function): Simplified, now calling %function.
  (%function): New function, based on prior "function".  Refactor, including
  adding support for matching against a closure.
  (%set-lexical-binding-mode): Switch from using fluid-set! to
  set-lexical-binding-mode.
  (special-operators): New variable.  Build from following for-each
  statement.
  (compile-tree-il): Drop call to "process-options!"

* module/language/elisp/lexer.scm: Import "(language elisp runtime)".
  (lex): Switch from using "list->string" to "make-lisp-string".

* module/language/elisp/runtime.scm: Use modules "(ice-9 format)",
  "(system base compile)".
  Remove from export list list, removing ensure-fluid!, symbol-fluid!,
  set-symbol-fluid!.  Add to export list ensure-dynamic!, symbol-name,
  symbol-plist, set-symbol-plist!, bind-symbol, symbol-desc, proclaim-symbol!
  special? emacs! unbound, lexical-binding?, set-lexical-binding-mode,
  log!, eval-elisp, local-eval-elisp, make-lisp-string, lisp-string?
  (make-list-string, lisp-string?) New function aliases.
  (value-slot-module, function-slot-module): Adjust module resolution.
  (nil_, t_): New variables.
  (ensure-fluid!, symbol-fluid, set-symbol-fluid!): Removed.
  (lexical-binding, unbound): New variables.
  (lexical-binding?, set-lexical-binding-mode, unbound, dynamic?)
  (make-dynamic, dynamic-ref, dynamic-set!, dynamic-unset!)
  (dynamic-bound?, dynamic-bind, ensure-present!, ensure-desc!)
  (schemify, symbol-name, symbol-desc, ensure-dynamic!, symbol-dynamic)
  (set-symbol-plist!, special?, proclaim-special!, emacs!, eval-elisp)
  (make-string): New procedures.
  (symbol-value): Use dynamic-ref! instead of fluid-ref!.
  (set-symbol-value!): Use dynamic-set! instead of fluid-set!.
  (symbol-function, set-symbol-function!, symbol-bound?)
  (symbol-fbound?, makunbound!, fmakunbound!): Refactor, including
  adjusting how module resolution is being done.

* module/language/elisp/spec.scm: Import module "(system vm vm)".
  Setup elisp-symbols, elisp-functions, elisp-plists.
  Use "set-default-vm-engine!" and "set-vm-engine!" to be set to
  'debug.
  (elisp): Comment out joiner.
2016-03-25 12:00:11 -07:00
Andy Wingo
14b9aa95e6 Fix order of evaluation in elisp lexer
* module/language/elisp/lexer.scm (lex): Use let*, to ensure that the
  port position is read before reading the next char.
2013-11-01 18:23:51 +01:00
BT Templeton
5199c059e8 sharpsign-colon for uninterned symbols
* module/language/elisp/lexer.sm (lex): Add support for `#:' syntax for
  uninterned symbols.
2012-02-03 18:53:51 -05:00
BT Templeton
03e00c5c9d emacs-compatible lexical binding
* module/language/elisp/bindings.scm (global?): New function.
* module/language/elisp/compile-tree-il.scm (lexical-binding): New
  variable.
  (bind-lexically?): If lexical binding is enabled, bind lexically
  unless a special binding exists.
  (compile-%set-lexical-binding-mode): New function.
* module/language/elisp/lexer.scm (lexical-binding-regexp): New
  variable.
  (lex): Return a `set-lexical-binding-mode!' token if a comment is
  found while reading the first line.
* module/language/elisp/parser.scm (get-expression): Add support for
  `set-lexical-binding-mode!' tokens.
* module/language/elisp/runtime/function-slot.scm: Import and re-export
  the `%set-lexical-binding-mode' special form.
* test-suite/tests/elisp-compiler.test
  ("Let and Let*")["lambda args inside lexical-let"]: Update.
2012-02-03 18:53:49 -05:00
Andy Wingo
6854c32480 core modules use (ice-9 binary-ports) instead of (rnrs io ports)
* module/language/assembly/compile-bytecode.scm:
* module/language/elisp/lexer.scm:
* module/web/request.scm:
* module/web/response.scm:
* module/web/server.scm:
* module/web/uri.scm: Use ice-9 binary-ports.
2011-02-18 16:01:25 +01:00
Brian Templeton
b7966c10ef support "#'" syntax for function expressions
* module/language/elisp/lexer.scm (lex):
* module/language/elisp/parser.scm (get-expression): Support sharpsign
  single-quote syntax as an abbreviation for `function' expressions.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:02 +01:00
Brian Templeton
1dfe593954 handle EOF correctly in parser and lexer
* module/language/elisp/lexer.scm (lex, get-lexer/1): Return a valid
  token at EOF.
* module/language/elisp/parser.scm (get-expression): Raise an error if
  EOF is reached.
  (read-elisp): If at EOF, return the EOF object instead of attempting
  to read an expression.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:02 +01:00
Brian Templeton
f4e5e4114d reindent
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/spec.scm: Reindent.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
c983a199d8 reformat comments
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm:
* module/language/elisp/runtime/value-slot.scm: Reformat comments.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Brian Templeton
abcf4a9e1d whitespace changes
* module/language/elisp/bindings.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/elisp/lexer.scm:
* module/language/elisp/parser.scm:
* module/language/elisp/runtime.scm:
* module/language/elisp/runtime/function-slot.scm:
* module/language/elisp/runtime/macro-slot.scm: Ensure that all
  top-level forms and comments are separated by exactly one newline.
  Remove blank lines in most procedure bodies. Delete trailing
  whitespace.

Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07 13:21:01 +01:00
Ludovic Courtès
eb80072df0 Change the Elisp compiler from GPLv2+ to LGPLv3+.
* module/language/elisp/bindings.scm, module/language/elisp/lexer.scm,
  module/language/elisp/parser.scm, module/language/elisp/runtime.scm,
  module/language/elisp/runtime/function-slot.scm,
  module/language/elisp/runtime/macro-slot.scm,
  module/language/elisp/runtime/value-slot.scm: Switch from GPLv2+ to
  LGPLv3+; fix copyright year.
2009-12-15 19:10:48 +01:00
Daniel Kraft
9a9f123144 Support circular structures in elisp reader.
* module/language/elisp/lexer.scm: Recognize circular markers.
* module/language/elisp/parser.scm: Handle them correctly.
* test-suite/tests/elisp-reader.test: Check circular structure parsing.
2009-08-27 18:49:29 +02:00
Daniel Kraft
98c2d75a15 Error in lexer when 'empty' symbol would have been read. 2009-08-26 22:03:01 +02:00
Daniel Kraft
e840cc6540 Parser for elisp and use it as reader.
* module/language/elisp/parser.scm: New parser file.
* module/language/elisp/lexer.scm: Fix lexer/1 and add unquote-splicing support.
* module/language/elisp/spec.scm: Use new elisp-reader.
* module/language/elisp/README: Document we've got a reader now.
* test-suite/tests/elisp-reader.test: Test the parser.
2009-08-26 21:36:37 +02:00
Daniel Kraft
ddb4364b1a get-lexer/1 for elisp that finishes after the first full expression is read.
* module/language/elisp/lexer.scm: Add get-lexer/1.
* test-suite/tests/elisp-reader.test: Test lexer/1.
2009-08-26 21:03:06 +02:00
Daniel Kraft
5b1ee3bef1 Character and string literal support for the elisp lexer.
* module/language/elisp/lexer.scm: Handle character and string literals.
* test-suite/tests/elisp-reader.test: Test it.
2009-08-26 19:48:06 +02:00
Daniel Kraft
25512a940b A first, rough lexer for elisp still missing some stuff.
* module/language/elisp/lexer.scm: New lexer file.
* test-suite/Makefile.am: Register elisp-reader.test as new test.
* test-suite/tests/elisp-reader.test: New test-case.
2009-08-26 14:32:48 +02:00