sod
5 years agotest/test.sod: Add a licensing notice.
Mark Wooding [Sat, 7 Jul 2018 13:55:53 +0000 (14:55 +0100)]
test/test.sod: Add a licensing notice.

5 years agosrc/class-output.lisp: Generate more general class-object macros.
Mark Wooding [Fri, 6 Jul 2018 23:08:11 +0000 (00:08 +0100)]
src/class-output.lisp: Generate more general class-object macros.

We need a macro picking out the most specific class in each of the
metaclass's chains.  If the root metaclass is the most specific class in
its chain then the existing `Foo__class' macro will do for one of these.

5 years agosrc/module-{proto,impl}.lisp, etc.: Don't output erroneous modules.
Mark Wooding [Fri, 6 Jul 2018 22:58:45 +0000 (23:58 +0100)]
src/module-{proto,impl}.lisp, etc.: Don't output erroneous modules.

Add a new reader `module-errors' which reports the number of errors
found while processing the module.  Notice (but decline to handle)
errors while loading modules.  And, in the front-end, don't try to
output erroneous modules.

This fixes an annoying problem where errors are reported and cause
`make' to fail, and then a subsequent `make' apparently succeeds,
possibly with bogus C code.

5 years agosrc/class-finalize-{proto,impl}.lisp: Check class slot initializers.
Mark Wooding [Fri, 6 Jul 2018 22:55:33 +0000 (23:55 +0100)]
src/class-finalize-{proto,impl}.lisp: Check class slot initializers.

User-defined class slots must have initializers, or we get very sad
during output.  Builtin slots mustn't have initializers, or (in
practice) they'll be ignored in favour of the builtin magic.

Introduce a new function `check-class-initializer', as part of the class
finalization sanity-check protocol, which verifies that class slots are
initialized -- or not -- as required.

5 years agosrc/class-finalize-impl.lisp (clos-tiebreaker): Search from the right end.
Mark Wooding [Sat, 7 Jul 2018 13:41:55 +0000 (14:41 +0100)]
src/class-finalize-impl.lisp (clos-tiebreaker): Search from the right end.

The docstring clearly says that we take the candidate whose direct
subclass is rightmost in the SO-FAR list, but the code searches SO-FAR
from the left and takes the first match.  As far as I can make out, this
has always been wrong: the earliest version of `merge-lists' builds the
output list in order, and the earliest version of `clos-tiebreaker'
searched from the left anyway.

Just reverse the list before scanning.

5 years agosrc/class-finalize-impl.lisp (check-sod-class): Remove `w/del' wrapper.
Mark Wooding [Fri, 6 Jul 2018 22:52:47 +0000 (23:52 +0100)]
src/class-finalize-impl.lisp (check-sod-class): Remove `w/del' wrapper.

The around method on `finalize-sod-class' has already set the error
location, so remove the extra wrapper here.  Everything moves over two
spaces again, and Git makes a proper mess of the diff.  I've reflowed
some of the error messages by hand.

5 years agosrc/class-finalize-impl.lisp (check-sod-class): Fix indentation.
Mark Wooding [Fri, 6 Jul 2018 22:50:47 +0000 (23:50 +0100)]
src/class-finalize-impl.lisp (check-sod-class): Fix indentation.

A lot of it was two spaces further over than it should have been.

5 years agosrc/: Make `find-class-initializer' be a proper part of the interface.
Mark Wooding [Fri, 6 Jul 2018 22:36:21 +0000 (23:36 +0100)]
src/: Make `find-class-initializer' be a proper part of the interface.

5 years agosrc/: Guess the metaclass early, unless we're explicitly bootstrapping.
Mark Wooding [Fri, 6 Jul 2018 22:18:01 +0000 (23:18 +0100)]
src/: Guess the metaclass early, unless we're explicitly bootstrapping.

Otherwise we hit unbound-slot errors if we try to resolve class
initializers.

Introduce an internal property `%bootstrapping' to tell the class
initialization machinery to leave the metaclass slot alone, and use this
in `bootstrap-classes'.  Otherwise, have the `sod-class'
`shared-initialize' method go off and call `guess-metaclass'
immediately.

Move `guess-metaclass' back into `class-make-impl.lisp' and fix up the
documentation stubs.

This partially reverts 981b6fb624186a54320cea34e53e16276aee2bdb.

5 years agosrc/class-make-impl.lisp: Fix docstring: `metaclass' is left unbound.
Mark Wooding [Fri, 6 Jul 2018 22:32:40 +0000 (23:32 +0100)]
src/class-make-impl.lisp: Fix docstring: `metaclass' is left unbound.

This was changed back in 981b6fb624186a54320cea34e53e16276aee2bdb.

5 years agosrc/pset-impl.lisp: Introduce a property type for booleans.
Mark Wooding [Fri, 6 Jul 2018 22:23:45 +0000 (23:23 +0100)]
src/pset-impl.lisp: Introduce a property type for booleans.

5 years agosrc/parser/floc-proto.lisp: Associate restarts when resignalling.
Mark Wooding [Sat, 7 Jul 2018 13:38:28 +0000 (14:38 +0100)]
src/parser/floc-proto.lisp: Associate restarts when resignalling.

`with-default-error-location*' catches conditions and maybe resignals
versions of them with error location information.  But the new
conditions don't have the same restarts associated with them, so
functions like `muffle-warning' will fail.

Fixing this is a little fiddly, but a general solution is possible.

5 years agosrc/final.lisp: Add a new function for testing property-set parsing.
Mark Wooding [Fri, 6 Jul 2018 23:06:53 +0000 (00:06 +0100)]
src/final.lisp: Add a new function for testing property-set parsing.

5 years agosrc/final.lisp (test-parse-c-type): Abstract out the tedious setup stage.
Mark Wooding [Fri, 6 Jul 2018 23:06:15 +0000 (00:06 +0100)]
src/final.lisp (test-parse-c-type): Abstract out the tedious setup stage.

5 years agosrc/pset-{proto,impl}.lisp: Move `string-to-symbol' to implementation.
Mark Wooding [Fri, 6 Jul 2018 22:28:12 +0000 (23:28 +0100)]
src/pset-{proto,impl}.lisp: Move `string-to-symbol' to implementation.

It's not used by anything else, and it's really weirdly shaped.

5 years agosrc/pset-proto.lisp: Export `default-slot-from-property'.
Mark Wooding [Sat, 7 Jul 2018 13:53:53 +0000 (14:53 +0100)]
src/pset-proto.lisp: Export `default-slot-from-property'.

This is really useful for extensions defining new metaobjects.  It was
already documented as an external symbol, but not actually exported.

5 years agodoc/sod.sty: Make spacing in `\lit' be more even.
Mark Wooding [Fri, 22 Jun 2018 01:18:45 +0000 (02:18 +0100)]
doc/sod.sty: Make spacing in `\lit' be more even.

5 years agodoc/sod.tex: Don't print the `Index' header in uppercase.
Mark Wooding [Thu, 21 Jun 2018 19:31:08 +0000 (20:31 +0100)]
doc/sod.tex: Don't print the `Index' header in uppercase.

Silliness from the `idxlayout' package which took ages to track down.

5 years agodoc/: Some minor tweaks and corrections.
Mark Wooding [Thu, 21 Jun 2018 18:43:51 +0000 (19:43 +0100)]
doc/: Some minor tweaks and corrections.

5 years agodoc/sod.tex: Capture `\label' from inside `\part{...}' title.
Mark Wooding [Thu, 21 Jun 2018 18:42:49 +0000 (19:42 +0100)]
doc/sod.tex: Capture `\label' from inside `\part{...}' title.

Otherwise we capture the wrong page number because `\part' implicitly
flushes two pages.

5 years agodoc/structures.tex, lib/sod-structs.3: Fix description of class pointers.
Mark Wooding [Sat, 9 Jun 2018 02:52:37 +0000 (03:52 +0100)]
doc/structures.tex, lib/sod-structs.3: Fix description of class pointers.

There's really only one in the vtable for each metaclass chain, and
the types of the pointers vary as we descend the superclass graph.

5 years agodoc/intro.tex: Strengthen the argument about C++ a bit.
Mark Wooding [Sat, 9 Jun 2018 02:49:35 +0000 (03:49 +0100)]
doc/intro.tex: Strengthen the argument about C++ a bit.

5 years agodoc/: Fix various unfortunate garblings.
Mark Wooding [Sat, 9 Jun 2018 02:49:16 +0000 (03:49 +0100)]
doc/: Fix various unfortunate garblings.

5 years agodoc/concepts.tex: Fix description of standard method combination.
Mark Wooding [Sat, 9 Jun 2018 02:48:03 +0000 (03:48 +0100)]
doc/concepts.tex: Fix description of standard method combination.

5 years agodoc/concepts.tex: Typeset method rôle names as identifiers.
Mark Wooding [Sat, 9 Jun 2018 02:44:40 +0000 (03:44 +0100)]
doc/concepts.tex: Typeset method rôle names as identifiers.

5 years agodoc/: Consistently write `rôle', rather than `role', in prose.
Mark Wooding [Sat, 9 Jun 2018 02:43:41 +0000 (03:43 +0100)]
doc/: Consistently write `rôle', rather than `role', in prose.

Obviously there's no diacritic in identifiers.

5 years agoMerge branches 'mdw/doc-reorg' and 'mdw/parser-fixes'
Mark Wooding [Fri, 8 Jun 2018 19:09:02 +0000 (20:09 +0100)]
Merge branches 'mdw/doc-reorg' and 'mdw/parser-fixes'

* mdw/doc-reorg: (34 commits)
  doc/refintro.tex, src/sod-module.5: Fix slightly garbled text.
  doc/syntax.tex: Delete (wrong) duplicate rule for <argument-declarator>.
  doc/syntax.tex: Consistently use baseline-level ellipses in syntax.
  doc/concepts.tex: Fix a rather distant demonstrative.
  test/: Add a simple rational-number class.
  src/method-impl.lisp: Initialize `suppliedp' flags properly.
  src/class-output.lisp: Fix missing parentheses around `me' in message macros.
  doc/concepts.tex: Fix garbled fragment ordering rules.
  doc/runtime.tex: Fix name of `SOD_XCHAIN' macro.
  doc/structures.tex, lib/sod-structs.3: Fix in-chain ichain exemplar.
  src/optparse.lisp: Indent a line correctly.
  test/test.sod: Abbreviate the T1 class nicknames.
  src/method-impl.lisp: Mark `sod__obj' as ignorable in effective methods.
  src/method-aggregate.lisp: Allow useful behaviour if no primary methods.
  doc/intro.tex: Begin a (rather extensive) comparison with C++.
  doc/Makefile.am, doc/sod.tex: Actually include the stub intro.
  doc/intro.tex: Fix erroneous `\manpage' to correct `\man'.
  doc/concepts.tex: Include diagram of standard method combination.
  doc/Makefile.am: Enable `\nonstopmode' in TeX processing.
  doc/Makefile.am: Abstract out repeated TeX arguments into a variable.
  ...

* mdw/parser-fixes: (97 commits)
  src/class-finalize.lisp: Improve reporting of CPL construction errors.
  src/class-finalize-impl.lisp: Move error reporting to `merge-class-lists'.
  src/class-finalize-impl.lisp (clos-cpl, dylan-cpl): Improve formatting.
  src/class-finalize-impl.lisp (clos-tiebreaker): Refactor.
  src/class-finalize.lisp (merge-class-lists): Zap pointless `:present' arg.
  src/module-impl.lisp (c-fragment): Fix docstring formatting.
  src/module-parse.lisp: Improve error recovery for core class items.
  src/module-parse.lisp: Abstract out `parse-maybe-dotted-name'.
  src/module-parse.lisp: Use `quote', not `list', to make constant lists.
  src/module-parse.lisp: Use `dotted-name', not `dotted-identifier'.
  src/module-parse.lisp: Catch errors during class-item construction.
  src/module-parse.lisp: Factor out slot and maybe-initializer creation.
  src/module-parse.lisp: Improve error recovery for `class' item framing.
  src/class-utilities.lisp: Permit `temporary-name' objects as class names.
  src/class-utilities.lisp: Improve reporting of multiple root classes.
  src/module-parse.lisp: Improve error recovery for `initarg' class-items.
  src/module-parse.lisp: Improve error recovery for `lisp' items.
  src/module-parse.lisp: Improve error recovery for `load' and `import' items.
  src/module-parse.lisp: Improve error recovery for `test' items.
  src/module-parse.lisp: Improve error recovery for `code' items.
  ...

5 years agodoc/refintro.tex, src/sod-module.5: Fix slightly garbled text.
Mark Wooding [Wed, 16 May 2018 09:09:02 +0000 (10:09 +0100)]
doc/refintro.tex, src/sod-module.5: Fix slightly garbled text.

5 years agodoc/syntax.tex: Delete (wrong) duplicate rule for <argument-declarator>.
Mark Wooding [Wed, 16 May 2018 09:08:16 +0000 (10:08 +0100)]
doc/syntax.tex: Delete (wrong) duplicate rule for <argument-declarator>.

5 years agodoc/syntax.tex: Consistently use baseline-level ellipses in syntax.
Mark Wooding [Wed, 16 May 2018 09:07:06 +0000 (10:07 +0100)]
doc/syntax.tex: Consistently use baseline-level ellipses in syntax.

5 years agodoc/concepts.tex: Fix a rather distant demonstrative.
Mark Wooding [Wed, 16 May 2018 01:12:05 +0000 (02:12 +0100)]
doc/concepts.tex: Fix a rather distant demonstrative.

5 years agotest/: Add a simple rational-number class.
Mark Wooding [Tue, 15 May 2018 10:44:56 +0000 (11:44 +0100)]
test/: Add a simple rational-number class.

This found a surprising number of bugs.  I wasn't even intending for it
to be a test, but it seems to work well as one.

5 years agosrc/method-impl.lisp: Initialize `suppliedp' flags properly.
Mark Wooding [Tue, 15 May 2018 10:39:03 +0000 (11:39 +0100)]
src/method-impl.lisp: Initialize `suppliedp' flags properly.

More foolishness.  The standalone C library gets this right,
embarrassingly enough.

5 years agosrc/class-output.lisp: Fix missing parentheses around `me' in message macros.
Mark Wooding [Tue, 15 May 2018 10:04:53 +0000 (11:04 +0100)]
src/class-output.lisp: Fix missing parentheses around `me' in message macros.

What was I thinking?

5 years agodoc/concepts.tex: Fix garbled fragment ordering rules.
Mark Wooding [Tue, 15 May 2018 09:49:05 +0000 (10:49 +0100)]
doc/concepts.tex: Fix garbled fragment ordering rules.

5 years agodoc/runtime.tex: Fix name of `SOD_XCHAIN' macro.
Mark Wooding [Tue, 15 May 2018 09:48:23 +0000 (10:48 +0100)]
doc/runtime.tex: Fix name of `SOD_XCHAIN' macro.

The index entry was right, but the synopsis showed the wrong name.

5 years agodoc/structures.tex, lib/sod-structs.3: Fix in-chain ichain exemplar.
Mark Wooding [Tue, 15 May 2018 09:46:00 +0000 (10:46 +0100)]
doc/structures.tex, lib/sod-structs.3: Fix in-chain ichain exemplar.

The general ichain structure is for some superclass on the same chain,
but not necessarily the chain head.  The later prose already has this
right, but the synopsis at the beginning of the section didn't.

5 years agosrc/optparse.lisp: Indent a line correctly.
Mark Wooding [Tue, 15 May 2018 09:45:35 +0000 (10:45 +0100)]
src/optparse.lisp: Indent a line correctly.

5 years agotest/test.sod: Abbreviate the T1 class nicknames.
Mark Wooding [Wed, 2 Aug 2017 19:53:31 +0000 (20:53 +0100)]
test/test.sod: Abbreviate the T1 class nicknames.

They don't actually need to have `t1' in them.

5 years agosrc/method-impl.lisp: Mark `sod__obj' as ignorable in effective methods.
Mark Wooding [Wed, 2 Aug 2017 11:25:34 +0000 (12:25 +0100)]
src/method-impl.lisp: Mark `sod__obj' as ignorable in effective methods.

Very trivial effective methods don't need this, and the warnings are
annoying.

5 years agosrc/method-aggregate.lisp: Allow useful behaviour if no primary methods.
Mark Wooding [Wed, 2 Aug 2017 10:00:39 +0000 (11:00 +0100)]
src/method-aggregate.lisp: Allow useful behaviour if no primary methods.

Many aggregating combinations have obvious things to do even if they
have no primary methods; e.g., `progn' should do nothing, and
combinations based on operators with identity should return that
identity.  This actually covers all of them except `min' and `max'.

5 years agodoc/intro.tex: Begin a (rather extensive) comparison with C++.
Mark Wooding [Wed, 2 Aug 2017 09:59:28 +0000 (10:59 +0100)]
doc/intro.tex: Begin a (rather extensive) comparison with C++.

I think this doesn't fit well here, but these things need saying
somewhere.

5 years agodoc/Makefile.am, doc/sod.tex: Actually include the stub intro.
Mark Wooding [Wed, 2 Aug 2017 09:58:56 +0000 (10:58 +0100)]
doc/Makefile.am, doc/sod.tex: Actually include the stub intro.

5 years agodoc/intro.tex: Fix erroneous `\manpage' to correct `\man'.
Mark Wooding [Wed, 2 Aug 2017 09:58:11 +0000 (10:58 +0100)]
doc/intro.tex: Fix erroneous `\manpage' to correct `\man'.

5 years agodoc/concepts.tex: Include diagram of standard method combination.
Mark Wooding [Wed, 2 Aug 2017 09:57:31 +0000 (10:57 +0100)]
doc/concepts.tex: Include diagram of standard method combination.

5 years agodoc/Makefile.am: Enable `\nonstopmode' in TeX processing.
Mark Wooding [Wed, 2 Aug 2017 09:56:29 +0000 (10:56 +0100)]
doc/Makefile.am: Enable `\nonstopmode' in TeX processing.

Now the build doesn't grind to a halt because I've upset TeX again.

5 years agodoc/Makefile.am: Abstract out repeated TeX arguments into a variable.
Mark Wooding [Wed, 2 Aug 2017 09:55:51 +0000 (10:55 +0100)]
doc/Makefile.am: Abstract out repeated TeX arguments into a variable.

5 years agodoc/structures.tex: Fix variable reuse in keyword-args message signature.
Mark Wooding [Wed, 2 Aug 2017 09:52:35 +0000 (10:52 +0100)]
doc/structures.tex: Fix variable reuse in keyword-args message signature.

I had `m' as both the message name and the total number of arguments.

5 years agodoc/concepts.tex: Warn about allocating resources in init methods.
Mark Wooding [Wed, 2 Aug 2017 09:52:06 +0000 (10:52 +0100)]
doc/concepts.tex: Warn about allocating resources in init methods.

5 years agodoc/concepts.tex: Fix missing superclass in a code example.
Mark Wooding [Wed, 2 Aug 2017 09:51:22 +0000 (10:51 +0100)]
doc/concepts.tex: Fix missing superclass in a code example.

5 years agodoc/concepts.tex: Fix copy-and-paste fail in `Destruction' section.
Mark Wooding [Wed, 2 Aug 2017 09:50:40 +0000 (10:50 +0100)]
doc/concepts.tex: Fix copy-and-paste fail in `Destruction' section.

5 years agodoc/concepts.tex: Update `Slot initializers', about class initialization.
Mark Wooding [Wed, 2 Aug 2017 09:48:54 +0000 (10:48 +0100)]
doc/concepts.tex: Update `Slot initializers', about class initialization.

The old initialization function has been replaced by a message.

5 years agodoc/concepts.tex: A number of minor fixes.
Mark Wooding [Wed, 2 Aug 2017 09:44:02 +0000 (10:44 +0100)]
doc/concepts.tex: A number of minor fixes.

  * Insert a missing paren.

  * Insert missing space after `\Cplusplus'.

  * Hyphenate `pointer-to-class-type' in the description of conversions,
    because it's easy to mis-associate otherwise.

  * Fix erroneous (probably copy-and-paste) `upcast' to `downcast'.

  * Improve wording about failing downcasts.

5 years agosrc/optparse.lisp: Use low-level slot accessor in `option' printer.
Mark Wooding [Wed, 2 Aug 2017 09:41:05 +0000 (10:41 +0100)]
src/optparse.lisp: Use low-level slot accessor in `option' printer.

If I try to use the access wrapper, I get compiler warnings about how
the previous use of the function wasn't inlined; but if I declare the
wrapper earlier then it might not inline anything.  The printer is
rarely used, so this isn't a bad place to be.

5 years agosrc/class-make-impl.lisp: Introduce property to choose initarg class.
Mark Wooding [Wed, 2 Aug 2017 09:40:14 +0000 (10:40 +0100)]
src/class-make-impl.lisp: Introduce property to choose initarg class.

This is now uniform, at least.

5 years agodoc/syntax.tex: Describe the built-in properties for objects.
Mark Wooding [Wed, 2 Aug 2017 09:32:40 +0000 (10:32 +0100)]
doc/syntax.tex: Describe the built-in properties for objects.

All a bit rough, but at least there's a place to write this stuff down
now.

5 years agodoc/syntax.tex: Give cross-ref to (stub) metaclass section.
Mark Wooding [Wed, 2 Aug 2017 09:31:36 +0000 (10:31 +0100)]
doc/syntax.tex: Give cross-ref to (stub) metaclass section.

Fixes a fixme.

5 years agoVarious, style: Generally prefer `: ' over ` : '.
Mark Wooding [Wed, 2 Aug 2017 09:29:28 +0000 (10:29 +0100)]
Various, style: Generally prefer `: ' over ` : '.

Before subclass lists, output constraints, and bitfield widths.  Retain
` : ' in conditional expressions to match ` ? ' which I don't want to
change, at least for now.

5 years agodoc/: Work in progress.
Mark Wooding [Mon, 14 Dec 2015 17:51:53 +0000 (17:51 +0000)]
doc/: Work in progress.

5 years agodoc/refintro.tex: Introduction to reference section.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
doc/refintro.tex: Introduction to reference section.

This is the start of a major reorganization of the reference material.

5 years agodoc/stdmeth.tex: A TikZ diagram of the standard method combination.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
doc/stdmeth.tex: A TikZ diagram of the standard method combination.

For safekeeping.  Remove the old (Lisp-specific) SVG version now that we
don't need it any more.

5 years agosrc/class-finalize.lisp: Improve reporting of CPL construction errors.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-finalize.lisp: Improve reporting of CPL construction errors.

Introduce `report-class-list-merge-error' to report problems properly.

5 years agosrc/class-finalize-impl.lisp: Move error reporting to `merge-class-lists'.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-finalize-impl.lisp: Move error reporting to `merge-class-lists'.

This means that `merge-class-lists' now needs a CLASS argument, hence
the noise.

5 years agosrc/class-finalize-impl.lisp (clos-cpl, dylan-cpl): Improve formatting.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-finalize-impl.lisp (clos-cpl, dylan-cpl): Improve formatting.

  * In `clos-cpl', distinguish the `class' argument to the outer
    function from the lambda-bound `c'.  This makes the lambda short
    enough to un-miser the `merge-class-lists' call.

  * in `dylan-cpl', hoist the `cpls' calculation into the `let', to
    match `c3-cpl' below.  Again, this lets us un-miser.

5 years agosrc/class-finalize-impl.lisp (clos-tiebreaker): Refactor.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-finalize-impl.lisp (clos-tiebreaker): Refactor.

An early exit is cleaner than assignment and a nil check.

5 years agosrc/class-finalize.lisp (merge-class-lists): Zap pointless `:present' arg.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-finalize.lisp (merge-class-lists): Zap pointless `:present' arg.

Since we don't actually print the `inconsistent-merge-error' anyway,
fiddling with the presentation of the items doesn't do anything.

5 years agosrc/module-impl.lisp (c-fragment): Fix docstring formatting.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-impl.lisp (c-fragment): Fix docstring formatting.

5 years agosrc/module-parse.lisp: Improve error recovery for core class items.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Improve error recovery for core class items.

5 years agosrc/module-parse.lisp: Abstract out `parse-maybe-dotted-name'.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Abstract out `parse-maybe-dotted-name'.

5 years agosrc/module-parse.lisp: Use `quote', not `list', to make constant lists.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Use `quote', not `list', to make constant lists.

5 years agosrc/module-parse.lisp: Use `dotted-name', not `dotted-identifier'.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Use `dotted-name', not `dotted-identifier'.

An identifier is a single token, and therefore can't be dotted.  I
appear to have gotten this one right everywhere else.

5 years agosrc/module-parse.lisp: Catch errors during class-item construction.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Catch errors during class-item construction.

These aren't worth failing the whole class construction over, but they
do mean that the individual class-item shouldn't be recorded.

This approach seems generally easier than reporting continuable errors
and then indicating failure in some other way, particularly in the case
of slots with initializers.

5 years agosrc/module-parse.lisp: Factor out slot and maybe-initializer creation.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Factor out slot and maybe-initializer creation.

5 years agosrc/module-parse.lisp: Improve error recovery for `class' item framing.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Improve error recovery for `class' item framing.

Cope with a failure to parse the class name (by inventing a synthetic
name) and/or superclass list (by forcing the use of `SodObject' as a
parent).

5 years agosrc/class-utilities.lisp: Permit `temporary-name' objects as class names.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-utilities.lisp: Permit `temporary-name' objects as class names.

This will be helpful in error recovery.  Classes and various related
objects must have names, but if we can't parse the user's choice of name
then we have to make one up.  The easy approach, to avoid conflicts with
the user's other choices, is to pick a name with funny characters in,
but that's properly rejected by the check here; but we can wrap the name
up in a `temporary-name' object to push it through without trouble.

5 years agosrc/class-utilities.lisp: Improve reporting of multiple root classes.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-utilities.lisp: Improve reporting of multiple root classes.

5 years agosrc/module-parse.lisp: Improve error recovery for `initarg' class-items.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Improve error recovery for `initarg' class-items.

5 years agosrc/module-parse.lisp: Improve error recovery for `lisp' items.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Improve error recovery for `lisp' items.

5 years agosrc/module-parse.lisp: Improve error recovery for `load' and `import' items.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Improve error recovery for `load' and `import' items.

5 years agosrc/module-parse.lisp: Improve error recovery for `test' items.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Improve error recovery for `test' items.

5 years agosrc/module-parse.lisp: Improve error recovery for `code' items.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
src/module-parse.lisp: Improve error recovery for `code' items.

5 years agosrc/module-parse.lisp: Improve error recovery for `typename' items.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
src/module-parse.lisp: Improve error recovery for `typename' items.

5 years agosrc/module-parse.lisp (`set'): Parse at least one property if no pset.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
src/module-parse.lisp (`set'): Parse at least one property if no pset.

Allow

[foo = "thing"] set;

and

set foo = "thing";

but not plain

set;

5 years agosrc/module-parse.lisp (read-module): Use requested pathname for location.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
src/module-parse.lisp (read-module): Use requested pathname for location.

The default behaviour for `charbuf-scanner' is to use the pathname from
its underlying stream; but (at least on some implementations) this is an
absolute pathname which is actually rather annoying in error messages.

Instead, arrange for `read-module' to attach the namestring of the
pathname it was given directly to the scanner.  This will be the correct
possibly-relative pathname to the module file, because `find-file' has
already done that part of the work, but it will be relative if that's
how it was specified on the command line, if it was found by merging
with a relative pathname in the `*module-dirs*' list, or if it was
imported by a name relative to a module with a relative pathname.

5 years agosrc/module-parse.lisp (read-module): Provide sensible default error-recovery.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp (read-module): Provide sensible default error-recovery.

By default, if there's an error parsing a module item, skip and consume
until the next `;' or `}'.  This actually seems to work quite well.

5 years agosrc/module-parse.lisp: Don't explicitly ask for default behaviour.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
src/module-parse.lisp: Don't explicitly ask for default behaviour.

  * Reporting the scanner position as the error location.

  * Setting at-least-one when parsing delimitered lists.

  * Keeping the terminator when skipping to one of several terminator
    tokens.

5 years agosrc/module-parse.lisp: Use newer syntax notation in the commentary.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
src/module-parse.lisp: Use newer syntax notation in the commentary.

5 years agosrc/module-parse.lisp: Some minor reformattings.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/module-parse.lisp: Some minor reformattings.

5 years agosrc/lexer-{proto,impl}.lisp: Add explicit recovery action to `error'.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/lexer-{proto,impl}.lisp: Add explicit recovery action to `error'.

This ends up being an `:action' keyword argument to
`parse-error-recover', and a macro body to the `error' parser macro.

5 years agosrc/lexer-{proto,impl}.lisp: Enhance `skip-until' to match token values.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/lexer-{proto,impl}.lisp: Enhance `skip-until' to match token values.

5 years agosrc/lexer-impl.lisp: Set default `:keep-end' in `%skip-until' function.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/lexer-impl.lisp: Set default `:keep-end' in `%skip-until' function.

The parser-macro set this correctly, but the function didn't.

5 years agosrc/lexer-impl.lisp: Rename internal `skip-until' function.
Mark Wooding [Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)]
src/lexer-impl.lisp: Rename internal `skip-until' function.

This shouldn't have leaked.

5 years agosrc/class-make-impl.lisp: Forbid slots with function types.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/class-make-impl.lisp: Forbid slots with function types.

Pointer-to-function type is fine, of course.

5 years agosrc/{c-types-impl,method-{proto,impl}}.lisp: Improve `merge-keyword-lists'.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/{c-types-impl,method-{proto,impl}}.lisp: Improve `merge-keyword-lists'.

  * Make the overall description of the merging site be a function (a)
    to report a file location and (b) to avoid formatting the thing if
    there isn't actually a problem.

  * Make the per-argument-list descriptions be functions so that they
    can report more than one message each.

  * Change `method-keyword-argument-lists' to report the inheritance
    path for methods involved in keyword argument conflicts.  Add an
    argument to thread through an `inheritance-path-reporter-state'
    object to make this work.

5 years agosrc/c-types-impl.lisp: Reorder `merge-keyword-lists' input lists.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/c-types-impl.lisp: Reorder `merge-keyword-lists' input lists.

Prepend the `what' argument to the front of each argument list, rather
than having a (LIST . WHAT) pair.  Also, internally to
`merge-keyword-lists', keep the entries in the hash table as
(WHAT . ARG) rather than the other way around.

5 years agosrc/method-impl.lisp (method-keyword-argument-lists): Check message type.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/method-impl.lisp (method-keyword-argument-lists): Check message type.

Check keyword arguments defined in the message as well as all of the
applicable methods.

5 years agosrc/method-impl.lisp (method-keyword-argument-lists): Zap pointless `let'.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/method-impl.lisp (method-keyword-argument-lists): Zap pointless `let'.

5 years agosrc/method-impl.lisp (method-keyword-argument-lists): Fix indentation.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/method-impl.lisp (method-keyword-argument-lists): Fix indentation.

5 years agosrc/{lexer-{proto,impl},parser/floc-proto}.lisp: Conditionify parse errors.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/{lexer-{proto,impl},parser/floc-proto}.lisp: Conditionify parse errors.

  * Introduce condition classes for parse errors.

  * Introduce `classify-condition' to describe the different reportable
    conditions to the user, and change `count-and-report-errors*' to use
    this rather than having special knowledge.  Now it pretty much just
    counts and prints.

  * Move the complicated error-message printing machinery from the
    `syntax-error' and `lexer-error' functions into the condition
    reporting functions.  (Now they don't actually need to be formatted
    until they're just about to be presented to a user.)

5 years agosrc/**/*.lisp: Use convenience functions to invoke restarts.
Mark Wooding [Sun, 26 Mar 2017 14:16:18 +0000 (15:16 +0100)]
src/**/*.lisp: Use convenience functions to invoke restarts.

Introduce a new function `noted' to invoke the `noted' restart.  Fiddle
other code to do the right thing.