Forum: CFEngine Help Subject: Re: variable method calls using arrays Author: sauer Link to topic: https://cfengine.com/forum/read.php?3,26900,26974#msg-26974
neilhwatson Wrote: ------------------------------------------------------- > Checking Mark's change I found the line in > src/cf3lex.l. > nakedvar > [$@][(]\200-\377.]+[)]|[$@][{]\200-\377.]+[}] > > > I'm trying to expand this line to accout for what > I'd like. What does \200-\377 mean? Is the entire > right side a C regex or Flex or something else? This is just a standard regex, and those are octal character escape values. Specifically, 377 is the octal version of decimal 255 and 200 is the octal form of decimal 128. ASCII is 7-bits, and 8-bit Unicode (UTF-8) uses the 8th bit (representing ASCII in UTF-8 puts a 0 in the first bit - hence decimal 0-127). Those would, therefore, all be bytes which have a "1" in the most-significant bit position, and are thus either "leading bytes" or "continuation bytes". Essentially, bytes starting with "11" tell how long the character is (how many continuation chars to include), and bytes starting with "10" combine to define the actual character. A leading byte like "11110000" would be a character that takes four bytes (four leading ones), so there'd be four more following "10xxxxxx" bytes to define it. The Wikipedia UTF-8 page has a good description of how it works: http://en.wikipedia.org/wiki/UTF-8#Description. The shorter answer is that those are the range of single-byte characters that combine to form all multi-byte UTF-8 character definitions. So, variables can be within $(), @(), ${}, or @{}. A bare variable name can contain one or more of a-z, A-Z, 0-9, [], period, and any non-ASCII UTF-8 character. :) _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine