~ubuntu-branches/ubuntu/saucy/augeas/saucy-proposed

« back to all changes in this revision

Viewing changes to lenses/aliases.aug

  • Committer: Package Import Robot
  • Author(s): Nicolas Valcárcel Scerpella
  • Date: 2011-11-10 09:20:03 UTC
  • mto: (1.5.1) (19.1.11 precise)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: package-import@ubuntu.com-20111110092003-sb3z6bq97rlb96de
Tags: upstream-0.9.0
Import upstream version 0.9.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
module Aliases =
3
3
   autoload xfm
4
4
 
5
 
   let word = /[^, \t\n]+/
6
 
   let name = /([^ \t\n#:@]+|"[^"\n]*")/ (* " make emacs calm down *)
7
 
 
8
 
   let colon = del /:[ \t]+/ ":\t"
 
5
   (************************************************************************
 
6
    * Group:                 USEFUL PRIMITIVES
 
7
    *************************************************************************)
 
8
 
 
9
   (* Group: basic tokens *)
 
10
 
 
11
   (* Variable: word *)
 
12
   let word = /[^\|", \t\n]+/
 
13
   (* Variable: name *)
 
14
   let name = /([^ \t\n#:|@]+|"[^"|\n]*")/ (* " make emacs calm down *)
 
15
 
 
16
   (* Variable: command
 
17
    * a command can contain spaces, if enclosed in double quotes, the case
 
18
    * without spaces is taken care with <word>
 
19
    *)
 
20
   let command = /\|([^", \t\n]+|"[^"\n]+")/
 
21
 
 
22
   (* Group: Comments and empty lines *)
 
23
 
 
24
   (* View: eol *)
9
25
   let eol   = Util.eol
10
 
 
 
26
   (* View: comment *)
11
27
   let comment = Util.comment
 
28
   (* View: empty *)
12
29
   let empty   = Util.empty
13
30
 
14
 
   let comma = del /,[ \t]*(\n[ \t]+)?/ ", "
15
 
   let value_list = Build.opt_list ([ label "value" . store word]) comma
 
31
   (* Group: separators *)
 
32
   (* View: colon
 
33
    * Separation between the alias and it's destinations
 
34
    *)
 
35
   let colon = del /:[ \t]+/ ":\t"
 
36
   (* View: comma
 
37
    * Separation between multiple destinations
 
38
    *)
 
39
   let comma = del /[ \t]*,[ \t]*(\n[ \t]+)?/ ", "
 
40
 
 
41
   (* Group: alias *)
 
42
 
 
43
   (* View: destination
 
44
    * Can be either a word (no spaces included) or a command with spaces
 
45
    *)
 
46
   let destination = ( word | command )
 
47
 
 
48
   (* View: value_list
 
49
    * List of destinations
 
50
    *)
 
51
   let value_list = Build.opt_list ([ label "value" . store destination]) comma
 
52
 
 
53
   (* View: alias
 
54
    * a name with one or more destinations
 
55
    *)
16
56
   let alias = [ seq "alias" .
17
57
                    [ label "name" . store name ] . colon .
18
58
                    value_list