Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,13 @@ To import a package directly from a TWINPACK file (instead of using TWINSERV), f
- navigate to the References section
- select the 'Available Packages' button
![image](Images/d9f1e4d9-1805-47e5-93aa-251151b4e914.png)

- press the 'Import from file...' button:

![image](Images/e35d5955-9e70-4d6e-abd7-748558da75ba.png)



- choose the TWINPACK file you want to import, and then it should appear in the references list (ticked):

![image](Images/4e4b8e4d-2a1c-42e5-8f4b-5a9b3f523ee8.png)
- Save the `Settings` and if needed restart the compiler

<br>
<br>

- Save the `Settings` and if needed restart the compiler

Now you're ready to use the package! In the example shown above I added a reference to the CSharpishStringFormater package, and I can now confirm that I can access components from the package in my code:

Expand Down
5 changes: 0 additions & 5 deletions docs/IDE/Project Explorer.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ permalink: /tB/IDE/Project/Explorer
![Folder](Images/Folder.png "Folder") ImportedTypeLibraries
![Folder](Images/Folder.png "Folder") Miscellaneous
![Folder](Images/Folder.png "Folder") Packages
<!-- ![Folder](Images/Folder.png "Folder") VB -->
<!-- ![Folder](Images/Folder.png "Folder") VBA -->
<!-- ![Folder](Images/Folder.png "Folder") VBComDlg -->
<!-- ![Folder](Images/Folder.png "Folder") VBRUN -->
<!-- ![Folder](Images/Folder.png "Folder") WinNativeCommonCtls -->
![Folder](Images/Folder.png "Folder") References
![Folder](Images/Folder.png "Folder") Resources
![Folder](Images/Folder.png "Folder") Sources
Expand Down
2 changes: 1 addition & 1 deletion docs/Reference/VBA/Information/VarPtr.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Syntax: **VarPtr(** *Var* **)**

The returned address is the storage location of *Var* itself --- the same place the runtime would write to for an assignment. For a numeric or fixed-length type the value of the variable lives at that address; for a **String** or **Variant** the value at the address is the variable's BSTR pointer or **VARIANT** descriptor.

Pass the result to an API function that needs a raw address, or pass it to one of the [**GetMem*** / **PutMem***](../HiddenModule/) helpers to read or write the underlying bytes. The pointer is valid only for as long as *Var* is alive in its scope; locals, arguments, and elements of expanded arrays can move when their owning frame or array is reallocated.
Pass the result to an API function that needs a raw address, or pass it to one of the [**GetMem**\* / **PutMem**\*](../HiddenModule/) helpers to read or write the underlying bytes. The pointer is valid only for as long as *Var* is alive in its scope; locals, arguments, and elements of expanded arrays can move when their owning frame or array is reallocated.

### Example

Expand Down
2 changes: 1 addition & 1 deletion docs/Reference/WinServicesLib/ServiceManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Opens the SCM with `SC_MANAGER_CONNECT Or SC_MANAGER_CREATE_SERVICE`, calls `Cre
> [!IMPORTANT]
> [**Install**](#install) writes to the SCM database, which requires administrator rights. The usual pattern is to call it once from an elevated installer, not from the application's normal startup path. Running from within the twinBASIC IDE typically fails --- the IDE is rarely elevated.

Raises run-time error 5 with a descriptive message on permission failure (*"Unable to open the Service manager..."*) or unrecoverable create failure (*"CreateServiceW() failed with error code <N>"*).
Raises run-time error 5 with a descriptive message on permission failure (`"Unable to open the Service manager..."`) or unrecoverable create failure (`"CreateServiceW() failed with error code <N>"`).

### ReportStatus
{: .no_toc }
Expand Down
45 changes: 38 additions & 7 deletions docs/_plugins/twinbasic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ def self.builtins
id = /[a-z_]\w*/i

state :whitespace do
rule %r/_[ \t]*\n/, Punctuation::LineContinuation
# Line continuation absorbs the next line's leading whitespace
# into the same LineContinuation token -- semantically the `_`
# plus trailing space, newline, and the continuing line's
# indent are one continuation unit, and folding them all into
# a single span keeps rendering consistent with the other
# states (`:attrargs`, `:dotted`, etc.) that already used the
# `_[ \t]*\n[ \t]*` form.
rule %r/_[ \t]*\n[ \t]*/, Punctuation::LineContinuation
rule %r/\n/, Text, :bol
rule %r/[^\S\n]+/, Text
rule %r/rem\b.*?$/i, Comment::Single
Expand Down Expand Up @@ -228,20 +235,41 @@ def self.builtins
rule(//) { pop! }
end

# The :dim / :funcname / :typename / :typename_ext / :namespace /
# :end states each consume one or more identifiers that follow a
# specific opener keyword (Dim, Function, Class, Module, End, ...)
# and then pop back to :root. The original mixin :whitespace rule
# pushed :bol on `\n`, leaving the state on the stack so the next
# line's first identifier was mis-classified -- e.g.
#
# Module MyModule
# Option Private Module
# End Module
#
# tokenised the second `Module` as Keyword + push :namespace, then
# `\n` pushed :bol, popping back to :namespace for the next line.
# The next line's `End` then matched the :namespace identifier rule
# and rendered as Name::Namespace (`nn`) instead of Keyword (`k`).
# The fix: drop mixin :whitespace, add non-newline whitespace plus
# the `_[ \t]*\n` line continuation, and let `\n` fall through to
# the empty-match `(//) { pop! }` so each state pops at end-of-line.
state :dim do
mixin :whitespace
rule %r/_[ \t]*\n[ \t]*/, Punctuation::LineContinuation
rule %r/[^\S\n]+/, Text
rule %r/#{id}[%&@!#$]?/, Name::Variable, :pop!
rule(//) { pop! }
end

state :funcname do
mixin :whitespace
rule %r/_[ \t]*\n[ \t]*/, Punctuation::LineContinuation
rule %r/[^\S\n]+/, Text
rule %r/#{id}[%&@!#$]?/, Name::Function, :pop!
rule(//) { pop! }
end

state :typename do
mixin :whitespace
rule %r/_[ \t]*\n[ \t]*/, Punctuation::LineContinuation
rule %r/[^\S\n]+/, Text
rule id do |m|
token Name::Class
goto :typename_ext
Expand All @@ -250,7 +278,8 @@ def self.builtins
end

state :typename_ext do
mixin :whitespace
rule %r/_[ \t]*\n[ \t]*/, Punctuation::LineContinuation
rule %r/[^\S\n]+/, Text
rule %r/(Extends|As)\b/i do |m|
token Keyword
goto :typename
Expand All @@ -259,13 +288,15 @@ def self.builtins
end

state :namespace do
mixin :whitespace
rule %r/_[ \t]*\n[ \t]*/, Punctuation::LineContinuation
rule %r/[^\S\n]+/, Text
rule %r/#{id}([.]#{id})*/, Name::Namespace, :pop!
rule(//) { pop! }
end

state :end do
mixin :whitespace
rule %r/_[ \t]*\n[ \t]*/, Punctuation::LineContinuation
rule %r/[^\S\n]+/, Text
rule %r/(Function|Sub|Property|Class|CoClass|Structure|Enum|Module|Namespace|Type|Interface|Select|If|With)\b/i,
Keyword, :pop!
rule(//) { pop! }
Expand Down
Loading