Skip to content

Grammar basics

Tomasz Lemiech edited this page Oct 18, 2021 · 5 revisions

RTLSDR-Airband's configuration is a bunch of variables and values assigned to them:

some_integer_variable = 5;
floating_point_variable = -3.5;
string_variable = "this is text";
boolean_variable = true;

That's all about scalar variables. But there are also compound variables - lists and groups. List is an ordered sequence of values of any scalar type, enclosed in parentheses:

my_list = ( 5, 10, 15, "text" );

A group is an unordered set of named variables and their values:

my_group: {
  integer_variable = 0;
  text_variable = "some text";
  boolean_variable = false;
};
another_group: {
  integer_variable = -5;
  list_variable = ( 0, 1, 2 );
};

Lists can contain groups as their elements:

a_list_of_groups_and_scalars = (
  a_scalar = -1;
  group1: {
    some_var = 3;
  },
  group2: {
    another_var = "hello";
    one_more = 10;
  }
);

Groups inside lists can be anonymous, ie. their names might be ommitted:

a_list_of_groups = (
# no group name before opening brace
  {
    some_var = 3;
    some_bool = true;
  },
# no group name here as well
  {
    another_var = "hello"; /* some comment here */
    one_more = 10;
//  this_var_is_commented_out = 0;
  }
);

This is how hierarchical configuration structure is built. A few things to note:

  • A colon : may be used instead of equal sign = basically anywhere,
  • There must be a semicolon ; at the end of each variable assignment (scalar or compound),
  • List elements must be separated with commas,
  • There must be no comma after the last element of the list (ie. before the closing parenthesis),
  • The amount of white spaces and newlines is unimportant.
  • Three types of comments are allowed:
    • Script-style comments. All text beginning with a ‘#’ character to the end of the line is ignored.
    • C-style comments. All text, including line breaks, between a starting /* sequence and an ending */ sequence is ignored.
    • C++-style comments. All text beginning with a // sequence to the end of the line is ignored.

Now let's head on to General configuration file structure.

Clone this wiki locally