Menu ▾ ▴

SyntaxVariable

Brad Lanam

Wiki Home
Syntax

Syntax: Variables

Integers
.set ival 555;
Single Quoted

No escapes are implemented.

.set junk 'string value';

Unless you are embedding a variable, it is recommended that single quoted strings always be used as they are more efficient.

Double Quoted

Single-character escapes are recognized (bfnrtv"). A backslash before any other character will return that character. Octal, hex and unicode escapes are not recognized.

.set junk "my stuff";

Double quoted strings may contain embedded variables.

.set j "string value";
.set k "c-compiler: ${CC}";
.set l "home: $ENV{HOME}";
.set a 1;
.set b1 c;
.set m "b${a}: ${b${a}}";
Path Names

Path names may be left unquoted in many (but not all) cases. Path names with embedded spaces must be quoted.

.check_size int64_t {
  .header stdint.h;
  .header /opt/local/include/stuff.h;
}
Values

Variable values are enclosed with braces ${...}. Variables names may contain other variables.

.set aaa 123;
.set bbb ${aaa};
.set b 2;
.set d2 5;
.set stuff ${d${b}};
Environment variables
.set home $ENV{HOME};

Lists

.set n [1 2 3 5];
.set o ['a' 'b' 'c'];

Dictionaries

Dictionaries are name value pairs.

.set p [[ 'a' 1 'b' 2 ]];

Wiki Home
Syntax


Related

Wiki: Home
Wiki: Syntax
Wiki: SyntaxStmtPrint
Wiki: SyntaxStmtSet