Skip to content

Update lfec and lfedoc - #228

Merged
rvirding merged 4 commits into
lfe:developfrom
yurrriq:patch-1
Apr 24, 2016
Merged

rvirding merged 4 commits into
lfe:developfrom
yurrriq:patch-1

Conversation

@yurrriq

@yurrriq yurrriq commented Apr 23, 2016

Copy link
Copy Markdown
Contributor

Add +no_docs to terms list per #227.

Add `+no_docs` to terms list per #227.
@yurrriq

yurrriq commented Apr 23, 2016

Copy link
Copy Markdown
Contributor Author

N.B. I'm working on this on my phone while I wait in line for a car wash and plan to include the lfedoc changes suggested in #227 before this is ready to go, so don't merge yet.

@rvirding

Copy link
Copy Markdown
Member

If you are adding to the options why not change them all to "LFE formats"? So add no-docs and convert the others.

yurrriq and others added 3 commits April 23, 2016 16:19
Convert all the compiler options to kebab case.
Fix forty-two?/1 and add another module, another-example.

Deliberately avoid (doc ...) in (defmodule another-module ...) and don't
include a docstring in divmod/2.
Move lfedoc to bin, make some general improvements and parse appropriate
lfe_comp:file/2 options. Notably, +to* options are ignored, since we
need to end up with a binary here.

Add lfedoc to the install make target too.
@yurrriq yurrriq changed the title [WIP] Update lfec and lfedoc Update lfec and lfedoc Apr 24, 2016
@yurrriq

yurrriq commented Apr 24, 2016 •

Copy link
Copy Markdown
Contributor Author

This should be good to go now. Feel free to clean up lfedoc as you see fit.

Example output:

$ lfedoc test/example.lfe
example
  This is an example module.
----------------------------------------------------------------------

add/2
 ((x y))
 Add `x` and `y`.


varargs/255
 (args)
 This is a varags macro.


forty-two?/2
 ((backquote (,x) (when (=:= x 42)))
  (backquote (,x) (when (< x 42)))
  (backquote (,x) (when (> x 42))))
 Return `'true` iff `x` is 42.


tricky/255
 ((x) (x y) (x y . z))
 This is a tricky varargs macro.


subtract/2
 ((x y))
 Subtract `y` from `x`.


matchfun/3
 ((x y z (when (call 'erlang '< x y) (call 'erlang '< y z)))
  (x y z (when (call 'erlang '> x y) (call 'erlang '> y z)))
  (x y z (when (call 'erlang '=:= x y) (call 'erlang '=:= y z)))
  (_ _ _))
 This is a function with pattern clauses.


$handle_undefined_function/2
 ((f as))


another-example
----------------------------------------------------------------------

divmod/2
 ((n d))


$handle_undefined_function/2
 ((f as))

@yurrriq

yurrriq commented Apr 24, 2016

Copy link
Copy Markdown
Contributor Author

Note the undesirable output for forty-two?, which is now defined:

(defmacro forty-two?
  "Return `'true` iff `x` is 42."
  (`(,x) (when (=:= x 42)) `'yes)
  (`(,x) (when (< x 42))   `'small)
  (`(,x) (when (> x 42))   `'big))

If you replace ``(,x)with(list x)`:

forty-two?/1
 ((x (when (=:= x 42))) (x (when (< x 42))) (x (when (> x 42))))
 Return `'true` iff `x` is 42.

@rvirding
rvirding merged commit 42bd850 into lfe:develop Apr 24, 2016
@yurrriq
yurrriq deleted the patch-1 branch April 24, 2016 18:07
oubiwann pushed a commit that referenced this pull request Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants