| CARVIEW |
Select Language
HTTP/2 200
date: Mon, 29 Dec 2025 20:00:37 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"cfff57c3f4f8d6a076d2db2af5017de8"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com github.githubassets.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com marketplace-screenshots.githubusercontent.com/ copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com github.githubassets.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=qCkLhdAVzVRe0MPWTLRXXd9lCXIYAiaLLjcd0faBDeWVhXqFHNlu8%2BrnrrdE7eXDgegGS4yz7zHjaEL7Z2yY4cvj1GX2UfaGw0m%2FruaaChp2igkemqJ00V%2BGsWtu1%2BvlyuNo1HMJDDfRGByNxq3rDwLhpoGsKzhMVG7EXO5HRsUpasXPJMwdK%2BpQq%2BgL12eJo0A%2BhQtKNSf8tvoIlBpJLi8k0wJB2MSekNBg2Cf8%2BRJHP6ub9LaSvGcn5U1zc95MGnLVQlKP05w%2BoFlBgUmZdg%3D%3D--6l%2BhyebSrl7XbzH2--gLj8TMGSVVP5jJpJmwYgFw%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1203734311.1767038436; Path=/; Domain=github.com; Expires=Tue, 29 Dec 2026 20:00:36 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Tue, 29 Dec 2026 20:00:36 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C8D6:13ACF:66D7050:7B18E58:6952DDE4
Basic Token Types · cparse/cparse Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 72
Basic Token Types
Vinícius Garcia edited this page May 14, 2017
·
6 revisions
There are a few different token types. In this page we'll only illustrate which tokens are available and how to use and declare them.
There a is a total of 8 basic built-in types and they are given by the following enumeration:
enum tokType {
// Internal types:
NONE, OP, VAR,
// Base types:
// Note: The mask system accepts at most 29 (32-3) different base types.
STR, FUNC,
// Numerals:
NUM = 0x20, // Everything with the bit 0x20 set is a number.
REAL = 0x21, // == 0x20 + 0x1 => Real numbers.
INT = 0x22, // == 0x20 + 0x2 => Integral numbers.
BOOL = 0x23, // == 0x20 + 0x3 => Boolean Type.
// Complex types:
IT = 0x40, // Everything with the bit 0x40 set are iterators.
LIST = 0x41, // == 0x40 + 0x01 => Lists are iterators.
TUPLE = 0x42, // == 0x40 + 0x02 => Tuples are iterators.
STUPLE = 0x43, // == 0x40 + 0x03 => ArgTuples are iterators.
MAP = 0x44, // == 0x40 + 0x04 => Maps are Iterators
// References are internal tokens used by the calculator:
REF = 0x80,
// Mask used when defining operations:
ANY_TYPE = 0xFF
};The types: OP, VAR, NUM, IT, STUPLE and REF are unlikely to be used by normal users. So they will not be explained here. As for the others a short description follows:
packToken none1 = packToken::None;
packToken none2 = calculator::calculate("my_var = None");The None type is the default return type of any function, and is used to denote "Nothing" or a "Null value".
packToken str1 = "normal string";
packToken str2 = calculator::calculate("my_var = 'string'");This type is sightly more complex.
To better understand it you should read the tutorial on how to add new functions.
packToken myFunc(TokenMap scope) {
// my code
}
int main() {
packToken f1 = CppFunction(&my_func, {"arg_name1", "arg_name2"}, "my_func");
}packToken real1 = 10.0;
packToken real2 = calculator::calculate("my_var = 10.0");packToken int1 = 10;
packToken int2 = calculator::calculate("my_var = 10");packToken bool1 = true;
packToken bool2 = calculator::calculate("my_var = True");packToken list1 = TokenList();
packToken list2 = calculator::calculate("my_var = list(1,2,3)");
packToken list3 = calculator::calculate("my_var = [1,2,3]");packToken tuple1 = Tuple();
packToken tuple2 = calculator::calculate("my_var = (1,2,3)");packToken map1 = TokenMap();
packToken map2 = calculator::calculate("my_var = map('a': 1, 'b': 2, 'c': 3)");
packToken map3 = calculator::calculate("my_var = {'a': 1, 'b': 2, 'c': 3}");
You can’t perform that action at this time.