37 |
# - there is no quoting meaning, so this lines are valid : |
# - there is no quoting meaning, so this lines are valid : |
38 |
# variable = some words with blanks, "quotes", or 'any character actually... |
# variable = some words with blanks, "quotes", or 'any character actually... |
39 |
# - the variable may not contain any \W character (that means it must be a word, with no blanks). |
# - the variable may not contain any \W character (that means it must be a word, with no blanks). |
40 |
# - the template parse only one line. This is invalid: |
# - a line can be continued, if the next line begins with a \s (blank, tab...), like this : |
41 |
# debugger_command = |
# debugger_command = |
42 |
# PATH=/usr/bin:/usr/X11R6/bin |
# PATH=/usr/bin:/usr/X11R6/bin |
43 |
# xxgdb $daemon_directory/$process_name $process_id & sleep 5 |
# xxgdb $daemon_directory/$process_name $process_id & sleep 5 |
44 |
# |
# |
|
# This would be interpreted like : |
|
|
# debugger_command = |
|
|
# PATH=/usr/bin:/usr/X11R6/bin |
|
|
# xxgdb $daemon_directory/$process_name $process_id & sleep 5 <-- this produces an error |
|
45 |
|
|
46 |
package Libconf; |
package Libconf; |
47 |
|
|
48 |
$templates{keyvalue} = { |
$templates{keyvalue} = { |
49 |
rules => [ q( if ($in =~ s/^\s*(\w+)\s*=\s*(.*?)\s*$//) { |
rules => [ q( if ($in =~ s/^(\w+)\s*=\s*(.*?)\s*$//) { |
50 |
$atom->{type} = 'KEY_VALUE'; |
$atom->{type} = 'KEY_VALUE'; |
51 |
$atom->{key} = $1; |
$atom->{key} = $1; |
52 |
$atom->{value} = $2; |
$atom->{value} = $2; |
53 |
$matched = 1; |
$matched = 1; |
54 |
|
} |
55 |
|
), |
56 |
|
q( if ($in =~ /^(\s+\w.*?)\s*$/) { |
57 |
|
$switch_to_prev_atom = 1; |
58 |
|
} |
59 |
|
), |
60 |
|
q( if ($in =~ s/^(\s+\w.*?)\s*$//) { |
61 |
|
$atom->{value} .= "\n$1"; |
62 |
|
$matched = 1; |
63 |
} |
} |
64 |
) ], |
), |
65 |
|
], |
66 |
comments => [ ['#'] ], |
comments => [ ['#'] ], |
67 |
output => { |
output => { |
68 |
KEY_VALUE => q( |
KEY_VALUE => q( |