Skip to content

Commit

Permalink
FEAT: doc-strings allowed now in function's spec block.
Browse files Browse the repository at this point in the history
Usage
-----

Possible places where doc-strings can be placed are:

    func [
        [attributes]
        "<function purpose>"
        argument [type!] "<argument description>"
        ...
        return: [type!] "<returned value description>"
    ]
  • Loading branch information
dockimbel committed Oct 21, 2012
1 parent 61db9f5 commit b7f46ea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion red-system/compiler.r
Expand Up @@ -1011,18 +1011,21 @@ system-dialect: make-profilable context [
unless catch [
parse specs [
pos: opt [into attribs] ;-- functions attributes
pos: copy args any [pos: word! into type-def] ;-- arguments definition
pos: opt string!
pos: copy args any [pos: word! into type-def opt string!] ;-- arguments definition
pos: opt [ ;-- return type definition
set value set-word! (
rule: pick reduce [[into type-spec] fail] value = return-def
) rule
opt string!
]
pos: opt [/local copy locs some [pos: word! opt [into type-spec]]] ;-- local variables definition
]
][
throw-error rejoin ["invalid definition for function " name ": " mold pos]
]
if block? args [
remove-each s args [string? s]
foreach [name type] args [
if enum-id? name [
throw-warning ["function's argument redeclares enumeration:" name]
Expand Down Expand Up @@ -1205,6 +1208,9 @@ system-dialect: make-profilable context [
if ns-path [name: ns-prefix name]
check-func-name name
check-specs name specs: pc/2
specs: copy specs
remove-each s specs [string? s]

type: 'native
cc: 'stdcall ;-- default calling convention

Expand Down

0 comments on commit b7f46ea

Please sign in to comment.