Skip to content

Commit

Permalink
Updated some library doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mcfriend99 committed Aug 19, 2023
1 parent 52566d2 commit dbf8d6e
Show file tree
Hide file tree
Showing 15 changed files with 300 additions and 273 deletions.
2 changes: 1 addition & 1 deletion libs/ast/interface.b
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ParseResult {
if self._results.length() > 0 {
if instance_of(self._results.last(), defn.DocDefn) and
instance_of(item, decl.Decl) {
item.doc = '${self._results.pop().data}\n'.replace('/^\s*[*]\s?(.*)\\n/m', '$1\n').trim()
item.doc = '${self._results.pop().data}\n'.replace('/^\s*[*]\s*(.*)\\n/mU', '$1\n').trim()
}
}
self._results.append(item)
Expand Down
11 changes: 11 additions & 0 deletions libs/ast/parser.b
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ class Parser {
*/
_consume(type, message) {
if self._check(type) return self._advance()

if !self._is_at_end()
message += ' on line ${self._peek().line}'
else message += ' at end of file'

die ParseException(self._peek(), message)
}

Expand Down Expand Up @@ -187,13 +192,15 @@ class Parser {
* completes index access expressions
*/
_finish_index(callee) {
self._ignore_newline()
var args = [self._expression()]

if self._match(COMMA) {
self._ignore_newline()
args.append(self._expression())
}

self._ignore_newline()
self._consume(RBRACKET, "']' expected at end of indexer")
return IndexExpr(args)
}
Expand Down Expand Up @@ -533,7 +540,9 @@ class Parser {

if !self._check(RBRACE) {
do {
while self._match(DOC) {}
self._ignore_newline()
while self._match(DOC) {}

if !self._check(RBRACE) {
var auto_value
Expand Down Expand Up @@ -570,7 +579,9 @@ class Parser {

if !self._check(RBRACKET) {
do {
while self._match(DOC) {}
self._ignore_newline()
while self._match(DOC) {}

if !self._check(RBRACKET) {
items.append(self._expression())
Expand Down
1 change: 1 addition & 0 deletions libs/date.b
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ def from_jd(jdate) {
* Returns a new `Date` instance representing the given system date or the current date if no argument is specified.
* @return Date
* @note all arguments are optional
* @default
*/
def date(year, month, day, hour, minute, seconds) {
return Date(year, month, day, hour, minute, seconds)
Expand Down
8 changes: 4 additions & 4 deletions libs/html/tags.b
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* Tags which contain arbitary non-parsed content
* For example: <script> JavaScript should not be parsed
* For example: `<script>` JavaScript should not be parsed
*
* @readonly
* @type list
Expand All @@ -11,7 +11,7 @@ var childless_tags = ['style', 'script', 'template']
/**
* Tags which auto-close because they cannot be nested
* For example: <p>Outer<p>Inner is <p>Outer</p><p>Inner</p>
* For example: `<p>Outer<p>Inner is <p>Outer</p><p>Inner</p>`
*
* @readonly
* @type list
Expand All @@ -24,7 +24,7 @@ var closing_tags = [
/**
* Closing tags which have ancestor tags which may exist within
* them which prevent the closing tag from auto-closing.
* For example: in <li><ul><li></ul></li>, the top-level <li>
* For example: in `<li><ul><li></ul></li>`, the top-level `<li>`
* should not auto-close.
*
* @readonly
Expand All @@ -43,7 +43,7 @@ var tag_ancestors = {
/**
* Tags which do not need the closing tag
* For example: <img> does not need </img>
* For example: `<img>` does not need `</img>`
*
* @readonly
* @type list
Expand Down
1 change: 1 addition & 0 deletions libs/mail/imap.b
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ class Imap {
* to the constructor.
*
* @return {Imap}
* @default
*/
def imap(options) {
if options != nil and !is_dict(options)
Expand Down
1 change: 1 addition & 0 deletions libs/mail/message.b
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class Message {
* Returns a new instance of {Message}.
*
* @return {Message}
* @default
*/
def message() {
return Message()
Expand Down
1 change: 1 addition & 0 deletions libs/mail/pop3.b
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class POP3 {
* to the constructor.
*
* @return {POP3}
* @default
*/
def pop3(options) {
if options != nil and !is_dict(options)
Expand Down
42 changes: 13 additions & 29 deletions libs/process.b
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ var cpu_count = _process.cpu_count
class PagedValue {

/**
* PagedValue()
* @param bool? executable
* @param bool? private
* @constructor
*/
PagedValue(executable, private) {
Expand All @@ -83,8 +84,6 @@ class PagedValue {
}

/**
* lock()
*
* Locks the PagedValue and disallows updating the value.
*/
lock() {
Expand All @@ -94,8 +93,6 @@ class PagedValue {
}

/**
* unlock()
*
* Unlocks the PagedValue to allow for updating the value.
*/
unlock() {
Expand All @@ -105,8 +102,6 @@ class PagedValue {
}

/**
* is_locked()
*
* Returns `true` if the PagedValue is locked for updating or `false` otherwise.
*
* @return boolean
Expand Down Expand Up @@ -181,11 +176,10 @@ class PagedValue {
}

/**
* set(value: boolean | number | string | list | dictionary)
*
* Sets the value of the PagedValue to the given value. It returns the number of
* bytes written or `false` if the PagedValue is in an invalid state.
*
* @param {boolean|number|string|list|dictionary} value
* @return number | boolean
*/
set(value) {
Expand All @@ -210,11 +204,10 @@ class PagedValue {
}

/**
* locked_set(value: boolean | number | string | list | dictionary)
*
* Locks the PagedValue for writing then sets the value to the given value and unlocks it.
* It returns the number of bytes written or `false` if the PagedValue is in an invalid state.
*
* @param {boolean|number|string|list|dictionary} value
* @return number | boolean
*/
locked_set(value) {
Expand All @@ -228,8 +221,6 @@ class PagedValue {
}

/**
* get()
*
* Returns the value stored in the PagedValue or `nil` if no value has been set.
*
* @return any
Expand Down Expand Up @@ -275,9 +266,8 @@ class PagedValue {
}

/**
* raw_pointer()
*
* Returns the pointer to the raw memory paged location pointed to by the object.
*
* @return ptr
*/
raw_pointer() {
Expand Down Expand Up @@ -311,6 +301,9 @@ class Process {
* The function passed to a process must accept at least one parameter which
* will be passed the instance of the process itself and at most two parameters
* if the process was intitalized with a PagedValue.
*
* @param function fn
* @param {PageValue?} paged
* @constructor
*/
Process(fn, paged) {
Expand All @@ -330,8 +323,6 @@ class Process {
}

/**
* id()
*
* Returns the ID of the process or `-1` if the process is in an invalid
* state or has not been started.
*
Expand All @@ -345,9 +336,8 @@ class Process {
}

/**
* on_complete(fn: function)
*
* Adds a new listener to be called when the process finishes execution.
* @param function fn
*/
on_complete(fn) {
if !is_function(fn)
Expand All @@ -356,8 +346,6 @@ class Process {
}

/**
* start()
*
* Starts/runs the process. This function returns `true` or `false` if the
* process is in an invalid state.
*
Expand Down Expand Up @@ -395,8 +383,6 @@ class Process {
}

/**
* await()
*
* Awaits for the process to finish running and returns it's exit code or `-1`
* if the process is in an invalid state.
*
Expand All @@ -412,8 +398,6 @@ class Process {
}

/**
* is_alive()
*
* Returns `true` if the process is running or `false` if not.
*
* @return boolean
Expand All @@ -423,8 +407,6 @@ class Process {
}

/**
* kill()
*
* Kills the running process. Returns `true` if the process was successfully
* killed or `false` otherwise.
*
Expand All @@ -439,14 +421,16 @@ class Process {
}

/**
* process(fn: function [, paged: PagedValue])
*
* Creates a new instance of Process for the function _`fn`_. This
* constructor accepts an optional PagedValue.
*
* The function passed to a process must accept at least one parameter which
* will be passed the instance of the process itself and at most two parameters
* if the process was intitalized with a PagedValue.
*
* @param function fn
* @param {PageValue?} paged
* @default
*/
def process(fn, paged) {
return Process(fn, paged)
Expand Down
Loading

0 comments on commit dbf8d6e

Please sign in to comment.