-
Notifications
You must be signed in to change notification settings - Fork 6
Literals
VSL has a native string literal. Strings are of the String
class and have a simple internal representation as a UTF-8 byte sequence along with other stored information. A String is unicode aware but to avoid a performance hit, the String
class will only be unicode-aware when deemed necessary. Strings can be denoted with ""
or ''
however both are exactly the same. Strings support literal newlines within them.
For information on the ByteSequence
literal, see the C Interopability section
VSL natively supports regular expressions through the PCRE library. You'll need the PCRE library installed for code using regular expressions. Most linux/macOS computers should have this preinstalled but you may want to check it out specifically.
The syntax for a regular expression takes the regular expression code within forward-slashes followed by a series of flags:
let myRegex: Regex = /code/flags
You may want to visit the PCRE specification for more information on what PCRE regular expressions can do. Regular expressions are compiled at program startup unless you dynamically create a regular expression using Regex(compile:flags:)
. Here's a simple regex which matches all substrings within parenthesis:
let insideParens = /\([^)]+\)/g
- Introduction
- Installation
- VSL By Example
- Usage
- WASM (WebAssembly)
- The Basics
- Your First Program
- Syntax
- Concepts
- Modules
- Advanced Details
- Interop
- VSL Development
- Common Errors