beautypg.com

Chapter 2: values, 1 literals, Chapter 2 – Teledyne LeCroy LeCroy Analyzers File Based Decoding Manual User Manual

Page 9: Values, Table 2.1 examples of string literals

background image

File-based Decoding User Manual

Chapter 2: Values

LeCroy Corporation

3

Chapter 2: Values

There are five value types that may be manipulated by a script: integers, strings, lists,
raw bytes, and null. CSL is not a strongly typed language. Value types need not be
pre-declared. Literals, variables and constants can take on any of the five value types,
and the types can be reassigned dynamically.

2.1 Literals

Literals are data that remain unchanged when the program is compiled. Literals are a way
of expressing hard-coded data in a script.

Integers

Integer literals represent numeric values with no fractions or decimal points.
Hexadecimal, octal, decimal, and binary notation are supported:

Hexadecimal numbers must be preceded by 0x: 0x2A, 0x54, 0xFFFFFF01

Octal numbers must begin with 0: 0775, 017, 0400

Decimal numbers are written as usual: 24, 1256, 2

Binary numbers are denoted with 0b: 0b01101100, 0b01, 0b100000

Strings

String literals are used to represent text. A string consists of zero or more characters and
can include numbers, letters, spaces, and punctuation. An empty string ("") contains
no characters and evaluates to false in an expression, whereas a non-empty string
evaluates to true. Double quotes surround a string, and some standard backslash (

\

)

escape sequences are supported.

String

Represented Text

"Quote: \"This is a string

literal.\""

Quote: "This is a string literal."

"256"

256

**Note that this does not represent the

integer 256, but only the characters that
make up the number.

"abcd!$%&*"

abcd!$%&*

"June 26, 2001"

June 26, 2001

"[ 1, 2, 3 ]"

[ 1, 2, 3 ]

Table 2.1 Examples of String Literals