calvincannon / cfeditor

Automatically exported from code.google.com/p/cfeditor
0 stars 0 forks source link

bundle highlighting #1

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Body highlight is ok, but bundle is not.

Original issue reported on code.google.com by olegdulov on 24 Aug 2010 at 7:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Promise bundles - a collection of promises. Classes are defined in bundles.

* Declarations of promise bundles in the form:
bundle TYPE name  # matches TYPE to running agent
{
}
where
- bundle is a keyword
- TYPE is an agent-type: {agent, server, monitor, knowledge}
- name is an identifier (string variable)

Bundles serve two purposes: 
1. they allow us to collect related promises under a single heading, like a 
subroutine, 
2. and they allow to mix configuration for different parts of cfengine in the 
same file. 

The type of a bundle is the name of the component of cfengine for which it is 
intended. For instance, we can make a self-contained example agent-server 
configuration by labelling the bundles:

     bundle agent testbundle{
     files:

       "/home/mark/tmp/testcopy"

         comment      => "Throwaway example...",
         copy_from    => mycopy("/home/mark/LapTop/words","127.0.0.1"),
         perms        => system,
         depth_search => recurse("inf");

     }
     #
     bundle server access_rules{
     access:

       "/home/mark/LapTop"

         admit   => { "127.0.0.1" };
     }

Original comment by olegdulov on 27 Jan 2011 at 11:28

GoogleCodeExporter commented 8 years ago
The following structure for the bundles can be considered:
bundle <Bundle TYPE> name 
{
<Promise TYPE>:
  <Class Declaration>::
    "<Promise>" 
        <promise keyword> => value;
}
bundle - is the keyword
name - any string
<Promise TYPE> - is the keyword from keyword list, depending on the <Bundle 
TYPE>, ended by the :
<Class Declaration> - as the Class name (any string) ended with :: . It can be 
empty or not.
<Promise> - is any string between two "" commas.
value - can be the value direct, or the return value from function call 
(function can be user defined or special cfengine function)

The most difficult part is between "<Promise>" and ; there are one or more 
promise keywords with their values. 
It can be also no such a structure, only "<Promise>" ; . 

Consider typical format:
<promise keyword> is depends on the <Promise TYPE> and "<Promise>" and mostly 
have the construction:
    "<Promise>" 
        <promise keyword1> => value1,
        <promise keyword2> => value2,
        ...
        <promise keywordN> => valueN;
Where N can be 1 or more. 

Consider the <Promise TYPE> vars:. If the <promise keyword> "policy" does not 
used, Promise have always format: 
    "Promise" <promise keyword> => value;
Where value format depend on the data type of promise keyword, e.g.:

- for string: input range: (arbitrary string)
"xxx"    string => "Some literal string...";
"yyy"    string => readfile( "/home/mark/tmp/testfile" , "33" );

- for int: input range: -99999999999,9999999999. Int variables are strings that 
are expected to be used as integer numbers. Integer values may use suffices 
‘k’, ‘K’, ‘m’, ‘M’, etc., but must only have an integer numeric 
part (so ‘1.5M’ is not allowed).
"scalar" int    => "16k";
"scalar1" int    => "16000";
"ran"    int    => randomint(4,88);
"dim_array" int =>  
readstringarray("array_name","/etc/passwd","#[^\n]*",":",10,4000);

- for real: input range: -9.99999E100,9.99999E100 . Real variables are strings 
that are expected to be used as real numbers (e.g., ‘3’, ‘3.1415’, 
‘.17’, ‘6.02e23’, ‘-9.21e-17’, etc.).
"scalar" real   => "0.5";

- for slist: input range: (arbitrary string). Some functions return slists, an 
slist may contain the values copied from another slist, rlist, or ilist
"xxx"    slist  => {  "literal1",  "literal2" };
"yyy"    slist  => {
                    readstringlist(
                                  "/home/mark/tmp/testlist",
                                  "#[a-zA-Z0-9 ]*",
                                  "[^a-zA-Z0-9]",
                                  15,
                                  4000
                                  )
                    };
"zzz"    slist  => { 
readstringlist("/home/mark/tmp/testlist2","#[^\n]*",",",5,4000) };
"longlist" slist => { @(shortlist), "plus", "plus" };
"shortlist" slist => { "you", "me" };

- for ilist: input range: -99999999999,9999999999. Integer lists are lists of 
strings that are expected to be treated as integers. Some functions return 
ilists, and an ilist may contain the values copied from another slist, rlist, 
or ilist.
"variable_id" ilist => { "10", "11", "12" };

- for rlist: input range: -9.99999E100,9.99999E100. Real lists are lists of 
strings that are expected to be used as real numbers. Some functions return 
rlists, and an rlist may contain the values copied from another slist, rlist, 
or ilist.
"varid" rlist => { "0.1", "0.2", "0.3" };

- for policy: input range: free, overridable, constant, ifdefined. The policy 
for (dis)allowing (re)definition of variables.
"varid"     string => "value...",
            policy => "constant";

But, once again: as value it can be the function which returns the value with 
defined value type. And string can contain the regular expression.

Original comment by olegdulov on 13 Feb 2011 at 12:27

GoogleCodeExporter commented 8 years ago
List of special functions in Excel format with links to the online 
documentation. The summary is on the all Tab.

Original comment by olegdulov on 13 Feb 2011 at 12:29

Attachments:

GoogleCodeExporter commented 8 years ago
List of bundles with ext body description and notes for embedded bundles.

Original comment by olegdulov on 13 Feb 2011 at 12:40

Attachments: